Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Serial I/O with the NI 6533 and 6534

2 ratings | 4.00 out of 5
Print

This document describes LabVIEW examples that you can use to perform serial I/O with an NI 6533/34. The output VIs convert 8-bit data to 4-bit, 2-bit, or serial (1-bit) data, then transfer the data to another device. The input VIs program the NI 6533/34 to receive serial, 2-bit, or 4-bit data and, optionally, to convert the data to 8-bit before returning it. Links to these example VIs are at the bottom of this page.

What You Need to Run these VIs

To run these VIs, you must have at least LabVIEW 6.1, NI-DAQ 6.9.x, and an NI 6533 or NI 6534 device installed in your system. Use an SH6868 shielded cable and an accessory like the TBX-68 to make signal connections.

Serial Output
Front Panel Settings

The following figure shows the Serial Output.vi front panel. Use the controls and indicators to configure your output task according to the instructions following the illustration.


[+] Enlarge Image

Set device to the number assigned to the output device in Measurement & Automation Explorer (MAX).

Set Port to select your output port. You can use port 0, DIO channel A; or port 2, DIO Channel C. The 6533/34 supports only 8-, 16-, or 32-bit data widths, so you must select an eight-bit port even if you are performing 1, 2, or 4-bit output. Refer to the 6533/6534 User Manual for Traditional NI-DAQ, Chapter 2, Deciding the Width of Data to Transfer section for a detailed description of port sizes and combinations.

Enter the number of Bytes to Output. This is the number of bytes before conversion to 4-, 2-, or 1-bit data.

Set the Clock Source. Select internal to use the 6533/34 internal clock, or external to use a clock from another source.

If you use the 6533/34 internal clock, enter a value (in hertz) for the Clock Frequency. If you use an external clock this parameter is ignored.

The Trigger Parameters, Wait on Trigger and Transmit Trigger, determine how data output is triggered and how the receiving device is notified of incoming data, respectively.

Set Wait on Trigger as follows:

  • No Trigger--to start data output as soon as you click Run
  • Wait On Trigger--to start data output when the 6533/34 receives a trigger on the appropriate start trigger line. For port 0, the trigger line is ACK1/STARTTRIG1 (PFI 6 for DAQmx) . For port 2, the trigger line is ACK2/STARTTRIG2 (PFI 7 for DAQmx).


Set Transmit Trigger as follows:

  • No Trigger--start output without sending a trigger to the input device
  • Trigger--send a trigger pulse from line 7 of the selected port to the receiving device to indicate the start of data transfer
  • Trigger -2--same operation as Trigger, but the trigger pulse is sent after two data is outputted to give the receiving device time to prepare


Set Data Conversion to one of the following choices:

  • None--8-bit parallel transmission, no data conversion. Transmission requires one clock cycle.
  • 8 bits to 4 bits--each byte is converted to two 4-bit samples. Transmission requires two clock cycles.
  • 8 bits to 2 bits--each byte is converted to four 2-bit samples. Transmission requires four clock cycles.
  • 8 bits to 1 bit--each byte is converted to eight 1-bit samples. Transmission requires eight clock cycles.


Set First Mode to:

  • LSB First--transmits data least significant bit first.
  • MSB First--8-bit data is inverted before conversion to 4-, 2-, or 1-bit data. For example, If your sample is 01101100, the left most bit becomes the first bit to send.


Bytes after Conversion indicates the number of cycles required to transmit data after conversion

Data Conversion Setting Bytes after Conversion
None = Bytes to Output x 1
8 bits to 4 bits = Bytes to Output x 2
8 bits to 2 bits = Bytes to Output x 4
8 bits to 1 bit = Bytes to Output x 8

Output Data--Array of output data bytes

 

Serial Output
Signal Connections

The connections you make depend on how the data transfer is triggered. Refer to the hardware user manual and/or the accessory installation guide for pin locations.

NOTE: These connection instructions assume you are using the default mapping for this example. Unless you configure the ports differently, Port A is the output port.

Data

  • Connect DIOAn, where n is a specific line number of the port, to the corresponding data input line of other device. It is only necessary to connect data lines for the number of bits you transfer, as shown in the following table.


Data Conversion Parameter Setting Data Lines Used
None DIOA<0..7>
8 bits to 4 bits DIOA<0..3>
8 bits to 2 bits DIOA<0..1>
8 bits to 1 bit DIOA0

Clock

  • If you are using an external clock source, connect it to REQ1 (PFI 2 for DAQmx). If you use the internal clock, connect REQ1 (PFI 2 for DAQmx) to the clock input of the receiving device to synchronize data transfer.


Trigger

  • Make trigger connections as shown in the following tables.


Wait on Trigger SettingTrigger Connection
No Trigger None
Trigger Input trigger to ACK1/STARTTRIG1 (PFI 6 for DAQmx)

 

Transmit Trigger Setting Trigger Connection
No Trigger None
Trigger Output trigger from DIOA7
Trigger -2 Output trigger from DIOA7

Serial Input
Front Panel Settings

The following figure shows the Serial Input.vi front panel. Use the controls and indicators to configure and monitor the input task according to the instructions following the illustration.


[+] Enlarge Image

Set device to the number assigned to the output device in Measurement & Automation Explorer (MAX).

Set Port to select the input port. On the 6533/34, one input sample is 8, 16, or 32 bits wide. For 8-bit input, you may use port 0, DIO channel A or port 2, DIO channel C. The 6533/34 supports only 8-, 16-, or 32-bit data widths, so you must select an eight-bit port even if you are performing 1, 2, or 4-bit output. Refer to the 6533/6534 User Manual for Traditional NI-DAQ, Chapter 2, Deciding the Width of Data to Transfer section for a detailed description of port sizes and combinations.

Set Bytes to Receive to the number of samples you expect to receive.

Set the Clock Source. Select internal to use the 6533/34 internal clock, or external to use a clock from another source.

If you use the 6533/34 internal clock, enter a value (in hertz) for the Clock Frequency. If you use an external clock this parameter is ignored.

Set Wait on Trigger as follows:

  • No Trigger--to start receiving data as soon as you click Run
  • Wait On--start data input when the 6533/34 receives a trigger on the trigger line. If you are using port 0, then trigger line is ACK1/STARTTRIG1 (PFI 6 for DAQmx) line. If you are using port 2, then the trigger line is the ACK2/STARTTRIG2 (PFI 7 for DAQmx) line.


Binary Data Received is an array of received data after conversion. Use the ring control to scroll through data.

Set Data Conversion to the type of conversion required for incoming data, as follows:

  • None--no conversion. Read all lines of the input port. For parallel transmissions.
  • 8 bytes to 1--8 data samples from line 0 of the input port are concatenated, from LSB to MSB, into one byte.
  • 4 bytes to 1--4 data samples from lines <0..1> of the input port are concatenated, from LSB to MSB, into one byte.
  • 2 bytes to 1--2 data samples from lines <0..4> of the input port are concatenated, from LSB to MSB, into one byte.


Bytes after Conversion indicates the number of data bytes after conversion, according to the formulas in the following table.

 

Data Conversion Setting Bytes after Conversion
None Bytes to Receive/1
8 bytes to 1 Bytes to Receive/8
4 bytes to 1 Bytes to Receive/4
2 bytes to 1 Bytes to Receive/2

Signal Connections

The connections you make depend on how the data transfer is triggered. Refer to the hardware user manual and/or the accessory installation guide for pin locations.

NOTE: These connection instructions assume you are using the default mapping for this example. Unless you configure the ports differently, Port C is the input port.

Data

  • Connect DIOCn, where n is a specific line number of the port, to the corresponding data output line of transmitting device. It is only necessary to connect data lines for the number of bits you receive, as shown in the following table.


Data Conversion Parameter Setting Data Lines Used
None DIOC<0..7>
8 bytes to 1 DIOC0
4 bytes to 1 DIOC<0..1>
2 bytes to 1 DIOC<0..3>

Clock

  • If you are using an external clock source, connect it to REQ2 (PFI 3 for DAQmx). If you use the internal clock, connect REQ2 (PFI 3 for DAQmx) to the clock input of the output device to synchronize data transfer.


Trigger

  • Make trigger connections as shown in the following table.


Wait on Trigger Setting Trigger Connection
No Trigger None
Trigger Input trigger to ACK2/STARTTRIG2 (PFI 7 for DAQmx)



Related Links:
Serial Input with the NI 6533 and 6534
Serial Output with the NI 6533 and 6534
NI 6533/6534 User Manual for Traditional NI-DAQ
KnowledgeBase 3KDGH0MP: 6533 and 6534 Terminal Name Equivalents

 

2 ratings | 4.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).