I have an ADC of ADS1256, I try to use Myrio to read the data via SPI, but I get stuck when converting the data~ Can you help how to get the correct data?(ADS1256datasheet )
I gave a set of ARDUINO's code which works fine, and I tried to emulate his conversion without success.
I'm trying to put this code on labview now, can anyone help me?
Where am I doing wrong?
Note, FORLOOP is used to read multiple values consecutively.
已解决! 转到解答。
Hi koukileo,
@koukileo wrote:
adc_val[i] = SPI.transfer(0);
adc_val[i] <<= 8; //shift to left
adc_val[i] |= SPI.transfer(0);
adc_val[i] <<= 8;
adc_val[i] |= SPI.transfer(0);
for (i=0; i <= 2; i++){ // Single ended Measurements
if(adc_val[i] > 0x7fffff){ //if MSB == 1
adc_val[i] = adc_val[i]-16777216; //do 2's complement
}
What about this one:

Thanks for your reply, I finally understand my problem, the ADC is 24bit data, so I want to divide it into three sections with 8bit. The code is as follows~
Hi koukileo,
@koukileo wrote:
Thanks for your reply, I finally understand my problem, the ADC is 24bit data, so I want to divide it into three sections with 8bit. The code is as follows…
Quite convoluted!
Whenever you start to copy&paste the same code several times you should think about using a loop to call that code repeatedly! (And when you combine this with LabVIEW autoindexing feature it becomes really easy…)
What you can see in the picture is to demonstrate the use.
I actually have a 3-axis accelerometer, so I end up needing 3 DATA~
Best regards