Main Content

Asynchronous Scheduling

This example shows how to use the Texas Instruments™ 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 or Texas Instruments LaunchPad/controlSTICK/controlCARD with docking station

  • Oscilloscope and probes

Available Models

These are the Simulink models available for different C2000 processors:

Note: To use the F28M35x/F28M36x controlCARD, you need C2000™ Microcontroller Blockset.

Example Model

Open the c280x_2833x_asyncscheduling_ert.slx example model.

The EV Timer or ePWM blocks are used to configure the timer interrupts. The timer interrupts are triggered based on the timer period, and the eCAN message receive interrupt is triggered when a message is received. The Hardware Interrupt block triggers the interrupt service routines (ISR) for the timer interrupts as well as for the eCAN message receive interrupt. The ISRs in turn call the function-call subsystems connected to the Hardware Interrupt block output ports.

The outputs of the first two subsystems are free-running counters. The sum of the counters is used to control the duty cycle of 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 Receive block whose message output controls the duty cycle of the PWM block (PWMA for F2812 or ePWM1 for F2808/F28335). The duty cycle varies from 0 to 100% because the eCAN messages are received from the eCAN Transmit block.

Note: The Self-Test mode of eCAN_A is enabled to connect the eCAN_A transmitter and receiver internally to avoid external connection between the transmitter and the receiver. For disabling the Self-Test mode of eCAN_A, the transmitter and the receiver must be connected together externally.

Run the Model on the Board

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

Refer to Model Fault-Tolerant Fuel Control System example.

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

  2. Go to Target hardware resources > eCAN_A, select Self-Test Mode, and click OK.

  3. On the Hardware tab, Click Build, Deploy & Start > Build Stand-Alone to generate, build, load, and run the program.

  4. Observe the changes of the PWM waveform on oscilloscope.

More About