LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Read DI, from multi I/O port.

Hi, i'm using PCI-6229 on windows system.

 

I read correctly 7 lines of port P2 throws the following command:

 

DAQmxCreateDIChan(NITaskHandleDI,'Dev1/port2/line0:7',nil,DAQmx_Val_ChanPerLine);

DAQmxReadDigitalLines(NITaskHandleDI, 1, 10, DAQmx_Val_GroupByChannel, @NIReadDI, sizeof(NIReadDI), @NINumSampleRead, @NINumBytePerSample, nil);

 

Now, i would reading first 4 lines of port P1 and writing other 4 lines of the same port.

P1.0, P1.1, P1.2, P1.3 are input signal.

P1.4, P1.5, P1.6, P1.7 are output signal.

 

How i must configure the channel for reading and writing?

0 Kudos
Message 1 of 4
(1,206 Views)

Hi,

 

To specify channels I guess you just need to configure the command like this:

 

DAQmxCreateDIChan(NITaskHandleDI,'Dev1/port1/line0:3',nil,DAQmx_Val_ChanPerLine)     for creating Digital Inputs 

DAQmxCreateDOChan (TaskHandleDO,'Dev1/port1/line4:7',nil,DAQmx_Val_ChanPerLine)    for creating Digital Outputs

 

For more information, you can follow these links:

DAQmxCreateDIChan

DAQmxCreateDOChan

DAQmxReadDigitalLines

0 Kudos
Message 2 of 4
(1,085 Views)

It is to be said that you can't read and write at the same time to the ports with a single instruction, if this is what you are trying to do: you need a task for reading and a separate task for writing (with appropriate DI and DO channels as shown by Mr.Genius)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(1,078 Views)

And you can't mix and match DI and DO lines or ports in the same task either (for reading obviously, writing to a DI is anyhow impossible).

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(1,066 Views)