05-13-2019 01:06 PM
Hi, i am trying to read an analogue signal from an LM35 temperature sensor using the MYRIO. the sensor is connected to 5V, Analogue ground and AI0 on the B block of the MYRIO. i am attempting to read the signal from an FPGA and set the sampling rate and number of samples. i am doing this from the picture below. In the real time VI i convert the data from the input into a voltage and then change to a temperature reading, but on the graph it is not displayed correctly it seems to be reading the desired temperature then constantly going to zero. any help in resolving this issue would be greatly appreciated
Solved! Go to Solution.
05-13-2019 01:43 PM
I have changed the analogue input the AI1+ on the MSP C block and have connected AI1- to analogue ground, from the middle picture above i changed the 0.001221 to 0.004883 for the change in type of analogue input, the graph turns out the same
05-13-2019 08:20 PM
I'm pretty sure that your problem is in the "Number of Elements" input on the RT system.
You see the 0 values when you read an empty array - in that case, the Index Array operation returns the "default default" value for DBL, or 0.
I'd guess your code does something like
If you modify your code to ensure that "Number of Elements" is always > 0, then it should be fine.
However, since you're discarding lots of data (potentially), why not set a specific value (e.g. 1?) and then you'll know what your data rate is?
I didn't check the behaviour of the PID loop on the right hand side - maybe that's related to your decisions about loop rate etc.
05-14-2019 10:26 AM
Thanks very much for your help, it was greatly appreciated. By changing the number of elements to a constant of 1 the signal on the graph is coming out as expected.