MATLAB Examples

Asynchronous Scheduling

This example shows how to use the c28x peripherals and Hardware Interrupt blocks to control the real-time execution of Simulink® function-call subsystems in an asynchronous fashion.

Required Hardware:

  • Spectrum Digital F2808/F2812/F28335 eZdsp
  • Texas Instruments™ F2808/F28035/F28069/F28335/F28343 ControlCARD with docking station
  • Texas Instruments™ F28069 ControlSTICK
  • Texas Instruments™ F28M35xx/F28M36xx ControlCARD(To use F28M35x/F28M36x you need Texas Instruments C2000 Concerto Support Package)
  • Texas Instruments™ F2807x/F2837xS/F2837xD ControlCARD or LaunchPad
  • Oscilloscope and probes

Available versions of this example:

Contents

Model

The following figure shows the example model.

Description

The EV Timer blocks are used to configure timer interrupts to be raised on period match. Hardware Interrupt block installs the ISRs for the timer interrupts as well as for an eCAN message receive interrupt. The ISRs in turn call function-call subsystems connected to the Hardware Interrupt block output ports.

Configure the interrupt operation with Configuration Parameters > Hardware Implementation > Hardware board settings > Target hardware resources > External Interrupt. For more information, see docid:texasinstrumentsc2000_ref.bvnmppr.

The outputs of first two subsystems are running counters. Their sum is used to control the duty cycle of the PWMB for F2812 or ePWM2 for F2808/F28335. The PWM waveform duty cycle increases linearly from 0 to 100 %. The third subsystem contains an eCAN Rcv block whose message output drives a PWM block (PWMA for F2812 or ePWM1 for F2808/F28335) to control its duty cycle. The duty cycle varies from 0 to 100 % as the eCAN messages are received from an eCAN Xmt block.

Note: The Self-Test mode of eCAN_A is enabled to connect eCAN_A transmitter and receiver internally to avoid external connection between transmitter and receiver. Disabling the Self-Test mode for eCAN_A requires transmitter and receiver to be connected together externally.

How to Run the Model on the Board

To configure, build, and deploy the application that corresponds to your Simulink model:

1. Open the model corresponding to the target hardware you are using. Each model is configured for a default target hardware. To select a different target hardware, browse to Model Configuration Parameters > Hardware Implementation > Hardware board.

2. Browse to Hardware Implementation > Target Hardware Resources > eCAN_A, select Self-Test Mode, and Click OK.

3. Click Build Model to generate, build, load, and run the program.

6. Observe the change of the PWM waveform on the oscilloscope.

More About