Skip to Main Content Skip to Search
Product Documentation

Using Parallel Ports

Introduction

Most target PCs have a parallel port that you can use for a variety of devices. The xPC Target block library provides blocks that enable you to use the parallel ports of a target PC for digital input and output, and source interrupts.

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

FunctionChannel12345678Additional Pins
Bit01234567
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 xPC Target model as follows:

  1. Select Simulation > Configuration Parameters > xPC Target options.

  2. 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:

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, use the xpctarget.xpc.getxpcpci function with the 'verbose' option. For example

    getxpcpci('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.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS