Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiUInt8Matrix & data

Dear All,
 
I use a cDAQ-9172 (NI9401 for my DI operation) + MSVC++.
 
I read back continuous samples and passed those to this API and extracted them to save in a csv file.
                             myData = m_bufferDIMatrix(myRow, myCol);
                             where:   CNiUInt8Matrix                                m_bufferDIMatrix
                                           m_bufferDIMatrix.GetRows()         myRow        (based from number of digital lines)
                                           m_bufferDIMatrix.GetCol()             myCol          (based from number of samples)
 
digital lines = 2
samples    = 20
 
I feel weird about the results of the myData variable.  Should the myData value represent a digital data as "1" or "0" or a voltage level?
Please refer to the matrix attachment.  Both signals are 5 volts. 
 
Thanks a bunch,
A
 

 

0 Kudos
Message 1 of 5
(6,828 Views)
Hi A,

I'm afraid our digital modules will only return a high or a low (0 or 1).  They will not return 0 or 5V values.  They follow the TTL logic family and return the detected logic of the signal.  I found the following webpage here with more information on the TTL standard.  In short, they don't actually return the voltage value of the signal.  They only return whether the voltage sampled was determined to be high or low.

Regards,
Paul C.
0 Kudos
Message 2 of 5
(6,792 Views)
Thanks Paul for the information.  If the data denotes the logical level, I still wonder why I have "2" as my data.  I simulated to create a matrix and access the elements to verify I am doing it right.  Again my signals are from 0 - 5 V only.
 
Simulation:
          CNiReal64Matrix   myReal64Matrix(3, 4, 3.5);
          double  aa = myReal64Matrix(0, 0); 
          aa = 3.5;   
 
To achieve myData and the rest of the parameters, I used this kind of implementation:
               unsigned int myRow = m_bufferDIMatrix.GetRows();
               unsigned int myCol = m_bufferDIMatrix.GetCols();
        
               //aa - assignment for myRow
               //bb - assignment for myCol  
               for (aa = 0; aa < myRow; aa++) {
                      for (bb = 0; bb < myCol; bb++) {
                            m_mmyData = m_bufferDIMatrix(aa, bb);    
                            TRACE("myData = %i.  row: %i, col: %i\n", m_mmyData, aa, bb);
  }
                 }
Snippet from previous attachment regarding the wierd myData value = 2 
      
myData 2   row 1  col 0
myData 2   row 1  col 1
myData 2   row 1  col 2

Any insight about the myData value?

Thanks again, A

0 Kudos
Message 3 of 5
(6,781 Views)
I initialized my matrix  at OnInitDialog yet I still have the myData = "2 ".  I am desperate and clueless.
Thanks,
A
0 Kudos
Message 4 of 5
(6,779 Views)

Hi A,

You are measuring 2 digital channels and your result is being returned in the form of 2 binary numbers. These numbers can be used to make an integer like you are seeing. You should format your data into a binary result of only measure a single channel. I hope this is helpful.

Steve B

0 Kudos
Message 5 of 5
(6,746 Views)