Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with "ReadMultiSamplePortUInt16Async" on 6259 "Dev3/port0/line0:15"

Hi,
 
I'm having problem to read a subset of the 6259 DAQ port lines. Even though I define the physical channels to be 16 bits from line 0 to 15, It failed when I use the "ReadMultiSamplePortUInt16Async" function. The error message -200878 complains that the digital channel contains more bits than supported by the 16-bit version of DAQmx Port Read and suggest to use the 32 bit version.
 
It'll work if I use the "ReadMultiSamplePortUInt32Async" function. My questions are:
 
1) Why the "ReadMultiSamplePortUInt16Async" fails when the data size is 16 bits defined from line 0 to line 15?
 
2) If I use the "ReadMultiSamplePortUInt32Async" function, can I still use port0/line16:31 on other tasks such as digital outupt operation independent of the digital input from line0:15?
 
3) What is the best solution to read a subset of a port without affecting the rest of the lines?
 
 
The following is the code:

m_Task = std::auto_ptr<CNiDAQmxTask>(new CNiDAQmxTask("DigitalInputTask"));
// Create the digital input channel
m_Task->DIChannels.CreateChannel("Dev3/port0/line0:15", "", DAQmxOneChannelForAllLines);
// Configure the sample clock
m_Task->Timing.ConfigureSampleClock(m_ClockSource, m_SampleRate,
 DAQmxSampleClockActiveEdgeRising, DAQmxSampleQuantityModeContinuousSamples, 1000);
// Create the reader
m_Reader = std::auto_ptr<CNiDAQmxDigitalSingleChannelReader>(new CNiDAQmxDigitalSingleChannelReader(m_Task->Stream));
m_Reader->InstallEventHandler(*this, OnReadEvent);
m_Reader->ReadMultiSamplePortUInt16Async(m_NumberOfSamples, m_Data, m_Dlg);

Thanks in advance!
 
Ray
0 Kudos
Message 1 of 2
(3,134 Views)

Ray,

Thank you for contacting National Instruments.

When using port reads, you must select a read type capable of holding the entire port even though the entire port may not be returned in this particular task. The reason for this is that port reads respect line ordering within the port. So, you could only specify the upper four bits, but would still need to use the U32 read on a 32-line port. This read will not affect the other lines.

--
Michael P
National Instruments
0 Kudos
Message 2 of 2
(3,121 Views)