03-15-2013 01:09 PM
Hi,
I am stucked with how to read multiple ports with visual c# 2008 when the port number in the task's channel is more than 4 (for eg when using 6509)?
That results in more bits, then 32 and the DigitalSingleChannelReader only let's you read 8, 16, 32 bits.
Thank you for your help!
Bests,
András
Solved! Go to Solution.
03-19-2013 05:13 AM
Hi András,
Unfortunately the data type that is returned if you read digital lines in "port" mode is - as you discovered - max 32 bits integer.
If you wish to acquire digital data wider that that (if you have the 6509), then you have an alternative:
Simply acquire the data as lines (booleans), and select multiple lines (N>32) when creating the acquisition task. It should return an array of booleans per sample
This is a common use-case, so I recommend that you take a look at some the example code that installs with the driver.
I found that looking at LabVIEW code can be quite helpful to understand how NI driver functions work, even if you do not know LabVIEW.
You can find examples using the C API in one of the following directory locations:
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C
or
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C
For the .NET API, you can find examples in one of the following directory locations:
C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\DAQmx
or
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0
Let me know how it goes!
Best Regards,
Tamás Simon
03-21-2013 03:51 AM
Hi,
thank you very much for your answer.
I already have experience with NI DIO inside .NET, this was just a blind spot before.
Bests,
András