03-04-2021 02:11 AM
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?
06-06-2021 01:01 AM
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:
06-07-2021 05:12 AM
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)
06-08-2021 09:32 AM
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).