CASP models can interface with hardware input outputs on embedded micro-controller boards. This example, demonstrates a model that measures speed of a motor and display on a 4 into 8×8 Dot Matrix Display module using Arduino Uno.
Pre-Requisites
- Arduino Uno board.
- DC motor as EUT.
- IR obstacle avoidance sensor.
- SPI 8×8 Dot matrix display module
- CASP software is installed.
- Arduino BSP is installed.
- The project files are located at CASP installed directory ‘CASP/support/examples/hardware_interface/09_max72xx’. These are also available for download at this link.
Description
An infra red proximity sensor is connected to pin-2 of the target board. A 4 into 8×8 dot matrix display is connected to the board via SPI interface as shown in the circuit diagram. A model is developed to measure the number of counts the motor shaft rotates and correspondingly the speed in RPS and display on the dot matrix display. To display the speed in RPM modify the ‘multiplication factor’ block value from 1 to 60. Please note that interrupt is enabled on pin-2 by default for better timing. However, user may disable the interrupt and enter suitable value in the ‘De-bounce Time’ parameter in the ‘pulse counter’ block if the sensor signal is noisy. Please go through the individual block parameters used in the model along with respective documentation for better understanding.

CASP Model

Procedure
- Run CASP and open the project ‘CASP/support/examples/hardware_interface/09_max72xx/09_max72xx.prj’ from CASP installed directory.
- Open ‘Setup Simulation’ window and change the ‘Target Programmer Port’ to which the board is connected.
- Click Run button to build the model and program the board.
