Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Read 212 binary format

Hi,
 
I would like to get some ideas on how I can read a binary file which has 2 voltage signals in 212 format. Each sample is represented by a 12-bit two's complement amplitude. The first sample is obtained from the 12 least significant bits of the first byte pair (stored least significant byte first). The second sample is formed from the 4 remaining bits of the first byte pair (which are the 4 high bits of the 12-bit sample) and the next byte (which contains the remaining 8 bits of the second sample). The process is repeated for each successive pair of samples.
 
Thanks,
Rahul
0 Kudos
Message 1 of 4
(3,589 Views)
Since you posted to the DAQ forum and not one of the programming language ones, we'll just have to guess at what you are using and I'm going to assume LabVIEW.
 
You can use the Read File set for I8 and either read it in byte by byte or all at once as an array. Then you can use a combination of the logical shift /join numbers functions to create your 12 bit numbers. After that, you can use one of the examples at http://forums.ni.com/ni/board/message?board.id=170&message.id=148450&view=by_date_ascending&page=2 to convert from 2's complement.
 
If you want, post an example of a data file and what real values are stored in it.
Message 2 of 4
(3,584 Views)
Thanks for your suggestions. I am attaching my vi which shows some preliminary work. The .dat file has 212 format data to be read. The 2nd and 3rd columns of the text file show what the data should look like after read.
 
Rahul
0 Kudos
Message 3 of 4
(3,555 Views)
I'll try to look at this but I'm going to be very busy for the next couple of days. This question probably should have been posted in the LabVIEW forum in the first place so you might want to repost there so it will get more attention.
0 Kudos
Message 4 of 4
(3,543 Views)