For the assignment for this week, was implemented serial communication between two PSoC microcontrollers. As an upgrade of development achieved in previous assignments (Input Devices and Output Devices ), the objective was read the distance from the sensor on a microcontroller and transmit this data to another microcontroller.
In the GUI, an UART (Universal Asynchronous Receiver Transmitter) block was added. This block enables serial communications on PSoC platform. The block was connected to pins for transmit (TX) and receive (RX), the speed for transmission was set as 256 bits per second, also, the character '+' was set as "Command Terminator" for message termination transmitted.
- Initializing UART block
- Sending out the message
- Clearing out some flags sfter transmission.
For the message, two strategies were tested:
- Sending out strings
- Sending out integer values (data are read from the analog input "ADCData")
With both strategies it was obtained similar performance.
Portions of code additions, (lines 121 to 124), to previous one, are shown below.
A commercial development PSoC board ( CY3210-PSoCEval1 )was used as remote receiver and was set up in a similar way as transmitter microcontroller.
Transmitter and Receiver boards were connected through two separate cables for transmission and reception respectively as follows:
- Transmitter TX pin to Receiver RX pin
- Receiver TX pin to Transmitter RX pin
The code necessary for receive string values is shown as follow:
- In this code, the board waits for the termination token to be detected using UART_1_bCmdCheck() (line 42)
- It stores the string in the buffer with a pointer (lines 44-58)
- It displays the string in the LCD (lines 61-62).
- The flag for the termination token is reset (line 64).
- The process started all over again (command "while" beetween lines 36 and 71) .
At first trials a little bug in transmission-receiving was detected and after checking and debugging, setting up a common ground for both boards let transmit and receive right values.
First attempts to transmit and receive:
After a common ground was set up:
The "little network" working alone (without connection to PC):
- Computer Aided Design
- Computer Controlled Cutting
- Electronics Production
- 3D Scanning and Printing
- Electronics Design
- Computer-Controlled Machining
- Embedded Programming
- Molding and Casting
- Input Devices
- Output Devices
- Mechanical Design
- Interface and Application Programming
- Applications and Implications
- Business Models
- Project Development