Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

read and write in Binary I16

Hello, I  have some problems to realize a program so as to use the PCI cards 622O(AI) and 6703(AO). This cards are configured in -10 +10 V. And I would like to have an example which illustrate how to use the DAQMX function read and write in Binary I16. There is no documentation in the DAQMX docs that illustrates these functions. Could I expect to have -32768 for the -10V, 0 for the 0V or 32767 for the 10V?

 

Thanks 

 

Best regards

 

Stephanie

0 Kudos
Message 1 of 14
(5,383 Views)

Check out this VI for acquiring voltage in binary

 

C:\Program Files\National Instruments\LabVIEW 8.6\examples\DAQmx\Analog In\Measure Voltage.llb\Cont Acq&Graph Voltage-To File(Binary).vi

 

 

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
Message 2 of 14
(5,364 Views)
Sorry kikiduu but I dont have the Labview folder in Natrional Instruments. So I can't resolve my problem. Can you give me a .txt so as to view how to use the functions.
0 Kudos
Message 3 of 14
(5,355 Views)

Hi Stefany,

 

Which application development enviromnment are you using? 

 

Sorry I assumed that you will be using LabVIEW.Smiley Happy

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 4 of 14
(5,351 Views)

Hi and thanks to post on NI forum,

 

When you connect a I16 datatype, you obtain +32768 for your maximum value and -32767 for the minimum.

 

http://forums.ni.com/ni/attachments/ni/250/45951/1/readwrite_binary.jpg

 

 

Regards.

Message Edité par ajangot le 01-23-2009 07:06 AM
0 Kudos
Message 5 of 14
(5,340 Views)

I make a C program in linux for testing the read and write functions. I just want to know how can I exploit this function in my code. My AI AO channel are configured in -10V/10V. So what does I write so as to have 8V in output( for example)?

 

I try to explain what i do.(plese regards my C program attached on this mail)

 

My four outputs are connected on my four inputs. So if I write a value on my output, i will be able to read the same value on my corresponding input.

 

So as to test that, I tested 4 fonctions: 2 in float and 2 in binary.


The function read/WriteAnalogF64 are OK. I can read what i write.

 

But its more difficult in binary:

 

I think the DaqmxWriteBinaryI16 is wrong:  I can't read what I write 

 

I test the write in float and the read in binary:

When i write 10 V in float, I read 32768 in binary and -10V==> -32768 so there is no problem here.

 

But if I Write in binary and I read in float, the results is wrong:

write -32768 ==> 0,0023V

-16000 ==>5V

-100 ==> 10V

100 ==> -10V

16000 ==> -5V

32000==>  -0,0023V   

 ????????

 

There is an offset in the two scale read and write.

 

So I don't understand how does it work.

 

 

0 Kudos
Message 6 of 14
(5,334 Views)

I don't see why you obtain an incorrect behavior, I will suggest you to contact NI support of your country.

 

Regards.

0 Kudos
Message 7 of 14
(5,329 Views)

SteFaNy wrote: 

 

But if I Write in binary and I read in float, the results is wrong:

write -32768 ==> 0,0023V

-16000 ==>5V

-100 ==> 10V

100 ==> -10V

16000 ==> -5V

32000==>  -0,0023V   

 ????????

 

There is an offset in the two scale read and write.

 

So I don't understand how does it work.

 

 


Stefany,

 

Your program looks all right to me.

 

for 6220 card  if you just consider 16-bit resolution at +/-10V, then the resolution will be 0,0003V. Account for noise in AO and AI and I guess 0,0023 is a good enough measuremnt for 0V.

 

Now if the question is why -32765 correspond to -0V, may be that's the way the device is supposed to respond, but I am not very sure.

 

Your results show that -100 correspond to -10V. This is somewhat puzzling because it implies that the full 16-bit resolution is not avaiable.

 

 

BTW, why do you want to use binary isn't it simple to use the write float value directly?

 

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 8 of 14
(5,324 Views)

Maybe its more easy but with the  binary writing I can't write values>10 or <-10 which could crash the running of the function.

 

 Moreover with the F64 function I don't know how the conversion float==>binary is made.

 

If I use the binary function I would be able to master  the conversion myself and I sure not to waste time in execution function.

0 Kudos
Message 9 of 14
(5,321 Views)
Please see this recent thread about reading binary. It is unscaled and uncalibrated data and you need to acquire the scaling coefficients.
0 Kudos
Message 10 of 14
(5,304 Views)