02-28-2013 04:48 AM
Hi all,
i'm reading serially bits out of an ADC through sbRIO 9602 via DIO on P4 connector.
ADC sends 24 bits MSB first in two complement format: how i can convert them to the hex number they represent on FPGA VI?
is there already some VI available for this i haven't still found?
Thanks in advance.
Solved! Go to Solution.
02-28-2013 08:13 AM
Hi Mariano76,
The VI I think you are looking for is 'Boolean Array to Number'. This primitive interprets an array of booleans as an integer. If you need to reverse the MSB/sign-bit before it goes into this function, you can use the 'Reverse 1D Array' function. If you want to interpret that hex data in fixed point representation, the cast function is appropriate. Once in FXP format, you can scale the data to the actual range of your ADC (ie +/- 10V). You can drag this code into your LabVIEW FPGA block diagram to test.
Cheers,
spex
02-28-2013 10:25 AM
One other trick is that you can configure the output type directly on the Boolean Array to Number function. Just right-click and select Properties.
02-28-2013 04:26 PM - edited 02-28-2013 04:26 PM
Thank you very much Spex,
I've implemented the code in a SCTL and it works perfectly, the path with reverse 1d array lead to correct hex value.
my range actually is ±3V, positive voltage that exceed +3V returns 7FFFFFh and negative voltage that goes under -3V returns 8000000h
Now i have to convert hex value to real voltage measured from ADC when comprised in [-3V,+3V] so sorry if i don't understand what do you mean when you say that once in FXP i can scale data to ADC range, but exactly what actions have to be done to perform this scaling?
Thanks.
MR