Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Read multiple ports .net

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(5,951 Views)
Solution
Accepted by Semir

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

Best Regards,
T Simon
National Instruments
Applications Engineer
Certified LabVIEW Developer - Certified TestStand Architect
Message 2 of 3
(5,919 Views)

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

0 Kudos
Message 3 of 3
(5,898 Views)