LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract 8-channel 16 bit data from a binary file (ADS1178 ADC)

The aim of this post is to read a binary file, extract bit informations, and plot waveforms of multichannel data.

 

I have a binary file that contains 8 channel 16 bit ADC data, which was orininally acquired through ADS1178 ADC IC. Each sample (for all 8 channels) is stored in 16 bytes format (byte 0 to byte 15). D0s' of these 16 bytes, combined together, form a 16 bit data of channel 0. Similarly all D1s' of the same 16 bytes form channel1 data. Similarly for other channels, upto channel 7. The next 16 bytes contain the next sampled value in the same format. In other words, all MSbs are stored in byte0, and all LSbs in byte 15. This might be something similar to bit extraction and rejoin problem. Kindly refer to the attached code.

0 Kudos
Message 1 of 4
(3,079 Views)
Can you post a sample data file?
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 4
(3,060 Views)

Thanks for your interest. I am attaching the sample data files and another version of the code that plots only till 15th sample point, although the data may be larger.

 

'SN_IITB4.dat' contains ADC generated data, where Ch3 must be having a sine wave of 1Vpp 5KHz, 'SN_IITB4.dat' is manually generated triangular wave data.

Download All
0 Kudos
Message 3 of 4
(3,049 Views)

What you might be able to do is read your 16 bytes from your file and put them into a byte array.  Use the Number To Boolean Array function in a for-loop to build up a boolean array with each boolean representing one bit of your data.  Now, I think you could use the Decimate Array function to pull your data from your boolean array.

 

I don't have an example at the moment, but I might be able to put one together if I remember to do so.

0 Kudos
Message 4 of 4
(3,037 Views)