LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming the NI 9375

Sorry to resurrect a 3 year old thread that doesn't even belong here, but this is the only promising thread I have been able to find on this topic. Could you link to your post on the labview forums? I am having the same issue trying to communicate with both the DI and DO lines of the NI 9375.

0 Kudos
Message 11 of 15
(2,125 Views)

Don't know how to link a post, and I'm not subscribed to the LV forum.  I solved this in LW programming in C.  Not sure anything I have done would help you if you are programming in LabView.

0 Kudos
Message 12 of 15
(2,118 Views)

Alright, thanks anyway. I just added a second module to use one as DO and one as DI.

0 Kudos
Message 13 of 15
(2,094 Views)

I am facing some issue while collecting data from digital input ports of Ni 9375, I am getting all data values as zero. 

SOME INFORMATION-
I need to collect rotary encoder data of connected to servo motor.
Please look into my issue

0 Kudos
Message 14 of 15
(1,257 Views)

Not sure the 9375 is the best choice or a rotary encoder.  You need something to cause an interrupt at the encoder data rate.  I use the 9375 just for control signals out and digital status in.

 

This is an example of my setup code:

// ------------------------------------------------------------------------------------------------------------------------
// Initialize the Module A2 NI9375 16-Channel DI
// Note:  The DIN and DOUT tasks must be started before the Analog task is started, so that the DIN and DOUT tasks are 
// known the first time the Analog interrupt happens.
// ------------------------------------------------------------------------------------------------------------------------
// Create the DIN task
DAQmxErrChk( DAQmxCreateTask( "MbDasDigitalIn", &DinTaskHandle ) );
// Create Digital In channel defined as all 32 bits read at once
DAQmxErrChk( DAQmxCreateDIChan( DinTaskHandle, "MbDas-DIO/port0", "DIN", DAQmx_Val_ChanForAllLines ) ); 
DAQmxErrChk ( DAQmxStartTask( DinTaskHandle ) );
 
  SysLogEntry( "\Initialized Module A6 Digital Input Channels.  Started DinTaskHandle Task.\n" );
Sleep( 100 );
// ------------------------------------------------------------------------------------------------------------------------
 
// ------------------------------------------------------------------------------------------------------------------------
// Initialize the NI9375 16-Channel DO  
// ------------------------------------------------------------------------------------------------------------------------
// Create the DOUT task
DAQmxErrChk( DAQmxCreateTask( "MbDasDigitalOut", &DoutTaskHandle ) );
// Create Digital Out channel defined as all 16 bits read at once
DAQmxErrChk( DAQmxCreateDOChan( DoutTaskHandle, "MbDas-DIO/port1", "DOUT", DAQmx_Val_ChanForAllLines ) ); 
// Start the task
DAQmxErrChk ( DAQmxStartTask( DoutTaskHandle ) );
 
And then within an interrupt handler, this code:
if ( DinTaskHandle )
{
DAQmxReadDigitalScalarU32 ( DinTaskHandle, 0.0, &dinUInt, 0 );
*( unsigned int * )&Din = dinUInt;
}
 
That *( unsigned int * )&Din = dinUInt; writes the UINT into a bit structure.  One thing to remember is that while you read and write 32 bit integers, you are only interested in the lower 16 bits.
 
0 Kudos
Message 15 of 15
(1,247 Views)