Serial Communication with CASP

 

This example project demonstrates how to establish serial communication between the target board and the host (native) PC. Analog data is acquired from the target board and sent to the host PC for plotting and control through USB cable. The on-board LED present on the target boards are controlled from the host PC.

 

Target

Vega Aries v2 is used for this project. However, any CASP supported micro-controller board can be used.

 

Circuit Diagram

 

 

Model

Target Model

 

Native Model

 

Procedure

Connect any sensor to the ADC pin A0 of Vega Aries v2 for sensing. The on-board LED is used for controlling. Communication is established between Vega Aries v2 and the host PC through USB serial. Following are the steps to properly program Arduino and native target to achieve above objective.

·       Connect Vega Aries v2 to the host PC via a USB cable.

·       Note the serial port number to which the board is connected to the host PC, from the host operating system.

·       Run CASP and load the ‘target_model’ project.

·     Open Home->Simulation->Setup Simulation Parameters menu item. Under TargetHW->General tabs set ‘Target Hardware Programmer Port’ parameter to the serial port to which the board is connected.

·     Build the model and program the board by clicking on Run button.

·     After the board is programmed, close the current project.

·     Load the ‘native_model’ project and open the ‘native.wsp’ workspace file. Double click on the ‘Serial SimPanel’ block and set ‘Serial Port Settings->Serial Port’ parameter to the serial port to which the board is connected as shown in below figure.

 

·       Run the model by clicking on the Run button. A simulation panel window should open and communicate with the board. A screen shot is shown below.

·      From the simulation panel toggle the switch to control the on-board LED.

  

References

Please go through our video tutorials, tutorial projects and CASP main documentation for getting started with CASP.