Using Parallel Ports


Most target computers have a parallel port that you can use for various devices. The Simulink® Real-Time™ block library provides blocks that enable you to use the parallel ports of a target computer for digital input and output, and source interrupts.


The parallel port is part of the motherboard on many computers. Be careful when configuring the port and when connecting external devices to the port. Incorrect connections to the port can damage your computer.

The Simulink Real-Time parallel port blocks assume that the connector to the parallel port has one 25-pin connector whose pins have the following designations:

  • Eight data pins

  • Five status pins

  • Four control pins

  • Eight ground pins

FunctionChannel12345678Additional Pins
Digital Input0203040506070809 
Digital Output0203040506070809 
Digital Input (Status)1513121011    
Digital Output (Control)01141617     
Interrupt        10

Using the Parallel Port as an Interrupt Source

To use the parallel port as an interrupt source, use pin 10 of the parallel port as the interrupt source. Configure the Simulink Real-Time model as follows:

  1. Open the Configuration Parameters dialog box.

  2. Select Code Generation > Simulink Real-Time Options.

  3. In the Execution options pane:

    • From Execution mode, select Real-Time.

    • From Real-time interrupt source, select the IRQ level (typically 7).

    • From I/O board generating the interrupt, select Parallel_Port.

    • In PCI slot (-1: autosearch) or ISA base address, enter the base address of the parallel port (typically 0x378).

If you want to use the Async IRQ Source block, you do not have to configure the model. Instead, you can set the Async IRQ Source block parameters as follows:

  • IRQ line number — Select the IRQ level (typically 7).

  • I/O board generating the interrupt — Select Parallel_Port.

  • PCI slot — Enter the base address of the parallel port (typically 0x378).

Using Add-On Parallel Port Boards

To use an add-on parallel port board with the parallel port blocks, configure the base address for the board as follows:

  1. To get the base address of a board, in the MATLAB® Command Window, call the function getPCIInfo with the 'verbose' option. For example:

    tg = slrt;
    getPCIInfo(tg, 'verbose')
  2. Identify the base address for the add-on parallel port board.

  3. In your model, open the parallel port block and set the value of the Base address parameter to Other.

    The Alternate base address parameter is displayed.

  4. In the Alternate base address parameter, enter the base address you identified in step 2.

  5. Configure the rest of the block as desired.


You cannot use add-on parallel port boards as interrupt sources. You also cannot trigger the execution of a model with these boards.