Documentation

Use I/O Boards

Typically I/O boards are preset from the factory for certain base addresses, voltage levels, and unipolar or bipolar modes of operation. Boards often include switches or jumpers that allow you to change many of these initial settings. For information about setting up and installing an I/O board, read the board manufacturer documentation.

For an online list of I/O boards that Simulink® Desktop Real-Time™ software supports, see www.mathworks.com/hardware-support/simulink-desktop-real-time.html.

Install and Configure I/O Boards and Drivers

A Simulink Desktop Real-Time model connects to a board by including an I/O driver block. This block provides an interface to the device driver of the board and the board-specific settings. The device drivers included with the Simulink Desktop Real-Time software usually provide the same flexibility of settings offered by the board manufacturer. You can enter I/O board settings by using the I/O Block Parameters dialog box; setting jumpers and switches on the board; or both. The three types of board settings are:

  • Software selectable — Specify the desired settings in the I/O Block Parameters dialog box. The driver writes the settings you specify to the board. Examples include A/D gain inputs and selecting unipolar or bipolar D/A outputs.

  • Hardware selectable, software readable — Specify the desired settings by configuring jumpers or switches on the board. The driver reads the settings you selected and displays them in the I/O Block Parameters dialog box.

  • Hardware selectable, not software readable — Set jumpers or switches on the physical board. Enter the same settings in the I/O Block Parameters dialog box. These entries must match the hardware jumpers or switches you set on the board. Use this type of setting when the board manufacturer does not provide a means for the I/O driver to write or read the board settings. Examples include base address, D/A gain, and differential or single-ended A/D inputs.

You can configure a Simulink Desktop Real-Time model to use an I/O board whether the board exists in the computer. However, you cannot run the model until the board is installed with its jumpers and switches set. Details of installation and configuration depend on the data transfer direction and the specific board, but are similar. Details for various types of boards and drivers appear later in this topic.

The following instructions configure the HUMUSOFT® AD512 I/O board for analog input. They assume that you physically configure and install the board in your computer before you add its driver to your model. To achieve the results you need, customize the steps.

To install and configure an I/O board and its driver,

  1. Install the board in the computer, setting jumpers or switches according to the board documentation.

  2. In the model window, to display the Simulink Library Browser, click View > Library Browser.

  3. Drag an Analog Input I/O driver block into your model from the Simulink Desktop Real-Time library.

  4. Double-click the driver block in the model.

    The I/O Block Parameters dialog box opens.

  5. Click Install new board. From the list that appears, point to a manufacturer, then select a board type. For example, point to Humusoft, then click AD512.

    The I/O board dialog box opens. The name of this dialog box depends on which I/O board you selected.

  6. Select one of the following, as required by the board type:

    • For an ISA bus board, enter a hexadecimal base address. This value must match the base address jumpers or switches set on the physical board. For example, to enter a base address of 0x300, in the Address box, type:

      	300

      You can also select the base address by checking boxes A9 through A3.

      Note

      Support for ISA bus boards will be removed in a future release. Use PCI, PC/104, Compact PCI, or PCMCIA boards instead.

    • For a PCI bus board, enter the logical device number in the Device order box or check Auto-detect.

  7. Set the other required block parameters using the I/O Block Parameters dialog box.

  8. Click Test.

    The Simulink Desktop Real-Time kernel tries to connect to the selected board, and if it does so without an error, displays a message indicating that it found the board.

  9. Click OK on the message box, and again on the I/O Block Parameters dialog box.

    The I/O Block Parameters dialog box closes, and the parameter values are included in your Simulink model.

Multiple Boards of Identical Type

When multiple boards of identical type exist, execute the complete installation sequence for each board as if the boards were of different types. Thus, two identical PCI boards result in two entries in the list of installed boards. The entries differ only in the logical device number shown in the Device order box for each board.

Autodetect Multiple Boards.  The Autodetect feature cannot be used to locate multiple boards of the same type. Specify their logical device numbers manually.

Multiple Driver Blocks for One Board

When you have used the I/O Block Parameters dialog box to configure a board driver, you can add additional I/O driver blocks for the same board. Drag each driver block into the model, open its I/O Block Parameters dialog box, and select the board from the list of installed boards.

Scope of Driver Block Parameters.  I/O driver blocks that use a given board share identical parameters. You specify these parameters only once, when you first add the board and configure its driver. If you change a parameter in the driver block for a board, the same change occurs in the other driver blocks connected to that board.

ISA Bus Board

Most ISA bus I/O boards are preset with a base address of 0x300. If you use multiple I/O boards or other boards (for example, network cards) that already use address 0x300, reset your board with another base address.

In the I/O board dialog box, enter the same base address that you set on the physical board. You open the I/O board dialog box from an I/O driver Block Parameters dialog box.

Note

Support for ISA bus boards will be removed in a future release. Use PCI, PC/104, Compact PCI, or PCMCIA boards instead.

PCI Bus Board

You do not have to set a base address for a PCI board. The plug-and-play feature of the operating system assigns a PCI slot number and logical device number. You can enter the logical device number in the Device order box, or you can let the driver determine the device number for you. The Device order box is in the I/O board dialog box, which you can open from an I/O driver Block Parameters dialog box.

Before you use a PCI or PCMCIA board, install the drivers supplied by the board manufacturer. The Simulink Desktop Real-Time software does not use these manufacturer-supplied drivers. However, they sometimes initiate the plug-and-play recognition of the board. Without these drivers installed, some boards are invisible to your computer and to the Simulink Desktop Real-Time software.

Write PCI Bus Board Drivers

Simulink Desktop Real-Time applications cannot use DLLs and kernel-mode drivers, which are not suitable for real-time operation. The device drivers supported by the Simulink Desktop Real-Time software are listed at www.mathworks.com/hardware-support/simulink-desktop-real-time.html. If no driver is listed for the board that you want to use, you can sometimes write a custom device driver.

A user-written custom device driver must program the board directly at the register level. All supported Simulink Desktop Real-Time drivers use this technique. The Simulink Desktop Real-Time software supports I/O mapped board registers for custom device drivers. The Simulink Desktop Real-Time software does not support memory-mapped board registers for custom device drivers.

To report that you require support for an unsupported board, contact MathWorks Technical Support at www.mathworks.com/contact_TS.html.

PC/104 Board

Most PC/104 bus I/O boards are preset with a base address of 0x300. If you use multiple I/O boards or other boards (for example, network cards) that already use the address 0x300, reset your board with another base address.

In the I/O board dialog box, enter the same base address that you set on the physical board. You open the I/O board dialog box from an I/O driver Block Parameters dialog box.

Compact PCI Board

If you use a compact PCI board (PXI®, PXI Express) use a compact PC (industrial PC). Also, install the operating system, the MATLAB® environment, Simulink software, and Simulink Desktop Real-Time software on the compact PC.

PCMCIA Board

The plug-and-play feature of the operating system assigns a base address automatically. You can enter this address in the I/O board dialog box, or you can let the driver determine the address for you. You open the I/O board dialog box from an I/O driver Block Parameters dialog box.

Before you use a PCI or PCMCIA board, install the drivers supplied by the board manufacturer. Simulink Desktop Real-Time software does not use these manufacturer-supplied drivers. However, they sometimes initiate the plug-and-play recognition of the board. Without these drivers installed, some boards are invisible to your computer and to the Simulink Desktop Real-Time software.

Was this topic helpful?