Main Content

Trigger Downstream Function-Call Subsystem Using C2000 External Interrupt Block with Single Tap Event on BMI160 Sensor

This example shows how to use the C2000™ Microcontroller Blockset to trigger a downstream function-call in Monitor and Tune action when Single tap event occurs on BMI160 sensor using a TI C2000 External Interrupt block. This example model for monitor and tune simulation, shows the capabilities of the External Interrupt block during single tap event on BMI160 sensor.

When you use the Monitor and Tune (External mode) action, a single tap event occurring on BMI160 sensor drives downstream subsystem through the digital pin externally. For every rising edge of this input pulse signal, the downstream function-call subsystem is triggered.

Prerequisite

If you are new to Simulink, we recommend completing the:

Required Hardware

  • Texas Instruments™ F280049C LaunchPad

  • BMI160 Boosterpack

  • Micro USB cable

  • Connecting wires

Configure Simulink Model for Counting Single Taps on BMI160 Sensor

For the monitor and tune (external mode) action, this example uses a preconfigured Simulink model from the C2000® Microcontroller Blockset.

Open the c28x_i2c_singletap_interrupt_detection.slx model.

Configure the following parameters:

1. In the Interrupt Source area, Initialize Function subsystem consists of BMI160 block and Event Listener blocks. In the Event Listener block, ensure that Event type is set to Initialize.

2. In the BMI160 Sensor, ensure that Single tap option is selected for Generate interrupts on parameter.

3. Configure the External Interrupt block parameters to its default values. Ensure that the Add simulation input port option is cleared.

Signal Monitoring and Parameter Tuning

To run the model for signal monitoring and parameter tuning, on the Hardware tab, in the Mode section, select Run on board and then click Monitor & Tune to start signal monitoring and parameter tuning.

During simulation, the single tap event on the sensor generates interrupt on the C2000® Microcontroller Blockset. Observe the increment of the counter values in Display block for every rising edge of the taps.

You can notice a delay in the downstream function-call.

You can also view the output of the manual switch and rate transition block output on the Simulation Data Inspector(SDI) and Logic Analyzer.