Fast External Interrupt

Generate asynchronous function-call trigger when interrupt occurs

Library

Target Support Package IC1/ C166 Driver Library/ Interrupts

Description

The Fast External Interrupt block executes a function-call triggered subsystem in the context of the service routine for a fast external interrupt. To generate the interrupt, you must select one of the upper eight pins of Port 2 (P2.8 to P2.15)

The function-call subsystem will be executed as an asynchronous task. Use this block to assign the task a Simulink® priority and a CPU interrupt level. The settings that you assign must be consistent with priorities and interrupt levels of other tasks defined in the model.

Limitations on XC16x Hardware

On XC16x hardware, this block is unable to generate code to enable fast external interrupts. Fast external interrupts must be enabled by setting bits in the register EXICON. On XC16x devices this register is write protected after execution of the special EINIT instruction by the processor's register security mechanism. It is not possible for the driver block to generate code that is executed before the EINIT instruction.

If you want to use this block on XC16x hardware, you must set the required bits in register EXICON in the Project Options within the Tasking EDE. For example, to enable fast external interrupts on rising or falling edges for both of pins P2.8 and P2.9 (as required by the demo model c166_async), follow these steps:

  1. Build the model c166_async.

  2. Open the project c166_async_c166 within the Tasking EDE.

  3. Select Project > Project Options.

  4. In the Project Options dialog box, select in the tree Application > Startup > EXICON.

    1. Set the value to 0x000F.

    2. Select the check box to Include in startup code.

  5. From within the Tasking EDE, re-build the project c166_async_c166.

  6. Download to the XC16x by launching Crossview from the CrossView button in the Tasking EDE.

Alternatively, you can create a new template project with the required setting for EXICON. You can easily create a new template project from the MATLAB® Start menu by selecting Start > Links and Targets > Embedded IDE Link TS > Create New Template Projects.

Dialog Box

Port 2 pin number

Select a port. Options are 8 to 15.

Trigger mode

Select from Rising or falling edge (the default), Rising edge, Falling edge, or Disabled.

Priority

Set a Simulink priority. The default is 30.

Interrupt level

Select an interrupt level from 1 to 15. The default is 5.

Interrupt level group

Select an interrupt level group from 0 to 3. The default is 1.

Show simulation input

Select this check box (and click Apply) to get an input port for simulation.

  


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