Configuring the Line Direction for the NI 9402 (FPGA Interface)

CompactRIO

Configuring the Line Direction for the NI 9402 (FPGA Interface)

Each digital channel on the NI 9402 is initially configured as a digital input. You can configure the initial line direction for each channel on the NI 9402 at edit time using the C Series Module Properties dialog box. You can programmatically change the line direction for each channel at run time using the FPGA I/O Method Node. The execution of an I/O Method Node that is configured with a Set Output Enable method overwrites the values you configured in the C Series Module Properties dialog box. In addition, the execution of an FPGA I/O Node configured for output automatically configures the line for output and overwrites the values you configured in the C Series Module Properties dialog box or using the Set Output Enable method.

Configuring Line Direction Using the C Series Module Properties Dialog Box

Complete the following steps to set the line direction of channels using the C Series Module Properties dialog box.

  1. Configure the CompactRIO system, and add an NI 9402.
  2. Right-click the NI 9402 in the Project Explorer window and select Properties from the shortcut menu to display the C Series Module Properties dialog box.
  3. Select the channel(s) for which you want to configure the line direction from the Channels table. You can select more than one channel by holding the <Ctrl> or <Shift> key when selecting channels.
  4. Select the direction for the channel(s) from the Direction pull-down menu.
  5. Click the OK button.
  6. Select File»Save All in the Project Explorer window.

Configuring Line Direction of One Channel Using the FPGA I/O Method Node

Complete the following steps to set the line direction of a channel using the FPGA I/O Method Node.

  1. Create FPGA I/O items for the channel of the NI 9402 for which you want to configure the line direction.
  2. Place an FPGA I/O Method Node on the block diagram and configure it for this channel.
  3. Click the Method section and select the Set Output Enable method from the shortcut menu.
  4. Right-click the Enable input and select Create»Control from the shortcut menu.
  5. On the front panel of the VI, click the Enable Boolean control to set it to TRUE if you want to set the line direction of the channel to digital output.

Configuring Line Direction of Multiple Channels Using the FPGA I/O Method Node

Complete the following steps to set the line direction of multiple channels using the FPGA I/O Method Node.

  1. Create FPGA I/O items for the DIO3:0 digital port of the NI 9402.
  2. Place an FPGA I/O Method Node on the block diagram and configure it for the DIO3:0 digital port.
  3. Click the Method section and select the Set Output Enable method from the shortcut menu.
  4. Right-click the Enable input and select Create»Control from the shortcut menu. The Enable control appears as an unsigned 8-bit integer. Each bit in the integer represents the line direction of one channel of the NI 9402.
  5. On the front panel of the VI, use the Enable control to enter the line direction for each channel in the port. Change a bit to 1 to set the line direction of the corresponding channel to digital output. Leave a bit as 0 to set the line direction of the corresponding channel to digital input. Refer to the table below for examples of what to enter in the Enable control.

    Channel Line Direction Configuration Enable Control
    (Floating Point)
    Enable Control
    (Binary)
    Enable Control
    (Hex)
    Change all channels to input 0 0000 0x00
    Change all channels to output 15 1111 0x0F
    Change channel 0 to output 1 0001 0x01