Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading battery voltage using the 10 bit ADC via SPI on MyRIO-1900

Hi there,
I am trying to read a battery voltage (3.39 V) using 10bit-ADC (MCP3002 with SPI) by MyRIO 1900. I think I have connected everything correctly (plz see the attached). However, the output value is constant on 1023 which is equal to 2^10 (in other words, all the bits of ADC have one value (1111111111)), which is the completely wrong value. Also, the result (1023) will not change even if all the wires between ADC and MyRIO are disconnected. MyRIO .vi file and other pictograms are attached.
Please, is there anybody can tell me where is my mistake?
Thanks for any help in advance!

Download All
0 Kudos
Message 1 of 2
(2,596 Views)

In SPI block,
1) I have changed the frame length from 10 bit to 16 bit as required in ADC datasheet.
2) I have tried SPI (0,0) mode and (1,1) mode.
3) MSB and LSB of the data direction have been tried.
4) i have measured the voltage for MISO and MOSI pins of MyRIO and the voltage for Do pin of ADC chip during the operational.
MISO = 3.2 V. is this normal?
MOSI = 0 V.
Do = 0.62 V.
But, unfortunately, there is no right result.
The output results are 1023 and 65535 when the frame length as 10 bit and 16 bit, respectively.
The expected result is 694 (1010110110).
Any idea, guys

thank you very much in advance

0 Kudos
Message 2 of 2
(2,532 Views)