I am using a cRIO-9076 with a 9213 module to capture thermocouple readings (K-type). Is it possible to convert those readings (FXP data voltage readings) into temperature values on the FPGA? My goal is then to use those temperatures to control an analog output through a PID.
According to the specs, the 9213 should be able to read 8 TC's at 100 Hz. I would like to be able to run the PID as fast as the TC's can be read accurately.
I could not find any example code that does the voltage-to-temperature conversion on the FPGA. The Getting Started example has you send the TC voltage values to the RT processor, which then converts voltages to temperatures. I have not been able to get that to run faster than about 50 Hz in a benchmarking VI. Once I add other code to the RT target, I think I will have to run much slower than 50 Hz.
Any suggestions / examples / white papers you can point me to?
Solved! Go to Solution.
You could convert the example to FPGA code, though thermocouple equations do a lot of multiplication and powers, which isn't efficient on an FPGA. I think you'll be better off using a look up table. Generate the value pairs with something like Matlab or Excel, then either program them into the onboard LUT from the project or programatically during operation.
Thanks for the response. Sounds like a lot of work, and a lot of stuff for me to learn how to do. I was hoping that someone had done this before and was willing to share.
Otherwise, it looks like I would be better off putting that module in scan interface mode and then doing all the processing on the RT target.
Look up tables are something you should learn to use in FPGA anyway. I'm not a fan of scan mode, if you're going to pay for the capabilities of your system, why cripple it with a slow, greedy interface?
Have a look at the 9211 Getting Started.lvpoj from the Example Finder. You can use the same VIs from this project to convert volts to temperature for your 9213 module. In order to preserve the accuracy of the readings it is recommended to convert voltage to temperature in your Host VI. The rate of your control loop is not extremely fast therefore you should be able to run your PID loop and convert your data at the rate of 100Hz in your Host VI.
Thanks for the info. The 9211 Getting Started example is the same idea as the 9213 Getting Started example. But if that is what you need to do to get accurate readings, then I don't have any choice in the matter.
I did take a look at my benchmarking code and found some issues. I now have hopes that I will be able to run the temperature PID at 50 Hz, along with the other code that needs to go in there.
The PID COntrol in FPGA support 16 bit word u can convert Fixed point number to Double value Which will be your temperature value you can see in the examples for this conversion.