Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Bidirectional digital I/O with LabVIEW/NIDAQmx: How?

Hi,

 

I am a NIDAQmx novice and need some help for the following task:

 

I need to rewrite a piece of C-code (that uses routines presumably from NIDAQ.DLL) in LabVIEW (8.5 or higher) using NIDAQmx VIs.


The hardware is a PCI-6503 card, and the port0 of that card is to be used in bidirectional mode. The following code fragment lists the bare functions as they are used in the C-code (I removed all error checking and query-for-ready calls):

 

int16 Port = 0;
int16 HandShaking = 1;
int16 Bidirectional = 2;

/*Initialise Board and Ports*/

Init_DA_Brds(*deviceNumber, &deviceNumberCode);

Timing = HandShaking;
Mode = Bidirectional;
DIG_Prt_Config (*deviceNumber, Port, Timing, Mode);

begin loop
/*perform a write/read */

DIG_Out_Prt (DeviceNumber, Port, Port_writeData); /*Write one byte of data */

DIG_In_Prt (DeviceNumber, Port, &*Port_readData); /* Read one byte of data */

end loop

 




In the loop, the change between Out_Prt and In_Prt should be as fast as possible. I guess I need to create two tasks in NIDAQmx, one for input and one for output, both tasks using the same port (port0) of the PCI-6503.

 


The LabVIEW examples 'Handshaking Output-8255.vi' and 'Handshaking Input-8255.vi' show me how to configure the tasks, but I have no idea how to implement the bidirectional behaviour.

I tried to get help in this forum already by waking up  the thread CVI - DAQmx : How do I configure a channel as bidirectional? , and I had consulted message#3 of another thread , but I'm still not sure what exactly I should do.

 

I'd appreciate any help or any hint to an example program which demonstrated what I want.

 

 

-Franz

0 Kudos
Message 1 of 2
(3,783 Views)

Hello Franz,

 

in general:

 

The PCI-6503 can only be configured one port at a time. Each port has 8 lines, all of which must be used as either inputs or outputs, except port 0 (Bank A) which may utilize bidirectionality.
 
Port A may be configured in LabVIEW as bidirectional, using the "Group Direction" terminal of the DIO Config function (found on All Functions>>NI Measurements>>Data Acquisition>>Digital I/O Palette). When this is done, port 2 (Bank C) must be reserved for handshaking, using the ACK and STB lines. The ACK and STB lines should be connected to the instrument's respective lines and held high.

When creating the block diagram, wire the output of the bidirectional DIO Config function to a DIO start task, and create an "I/O Connector" constant to the "handshaking source" terminal.
 
Other boards, such as E-series boards have the capability of configuring individual lines as inputs or outputs. 
 

Also the following Links should help you to get a bettter understanding to your hardware and the bidirectional configuration:

Understanding the Bi-Directional Mode of 8255 Chip
http://digital.ni.com/public.nsf/allkb/F865C1157622C9DE8625648B00782CDA?OpenDocument

How Do I Use Bidirectional Mode with an 8255 DIO Chip?
http://digital.ni.com/public.nsf/allkb/92582BD25EE97F8D85256442005968C9?OpenDocument

 

Best wishes, Jan
Jan Kniewasser | Applications Engineer | Tel.: +49 89 7413130 | Fax: +49 89 7146035

»
0 Kudos
Message 2 of 2
(3,754 Views)