Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Read back samples from digital input

Dear All,
 
I have a DI module, NI 9401 and I want to read back the multiple samples written in a port.  I used this API, m_reader->ReadMultiSamplePortByte(m_readBackSample, m_bufferDIMatrix) to achieve my objective. I am attaching my watch window, multiSample1.jpg,  then please tell me which information should I monitor to indicate I am reading back correctly.
 
 

Parameters

samplesPerChannel

The number of samples to read. If you set samplesPerChannel to -1 for a continuous acquisition, the read retrieves all samples available in the buffer at the time of the read. If you set samplesPerChannel to -1 for a finite acquisition, the read behavior is set by the ReadAllAvailableSamples property of the CNiDAQmxStream you are reading from.

 
Another problem that I have is that if I key in a sample size of -1 (refer to brown print), my m_bufferDImatrix values have become vague as seen in this attachment, multiSample2.jpg. 
 
Btw, I am using a cDAQ-9172 & MSVC++.
 
Thank you,
A
 
Download All
0 Kudos
Message 1 of 2
(6,310 Views)

Hi A

It is difficult to tell what you should monitor to determine if you are getting correct data.  Basically it depends on what value you are writing to.  For instance in the watch window that you posted I would assume that you are writing values to m_ReadBackSample, however I can be sure.   It will be the value that you are equating to the reader method that you are using to read data from your DAQ card. 

 

I would suggest looking at the Measurement Studio examples and seeing how your code equates to it.

Chris_K  

0 Kudos
Message 2 of 2
(6,287 Views)