This example project uses the USART Dynamic Driver Library to control a single USART. A computer based terminal program (e.g. Tera Term or CoolTerm) is used to transmit a character to the PIC32 USART. The PIC32 will then increment the ASCII value of the character by one, and transmit this new character back to the terminal program. In other words, if you transmit the character "b" to the PIC32, it will reply with the character "c".
The hardware for this project uses the chipKIT WF32 board from Digilent Inc.. This board uses an FTDI USB to UART converter, which connects to the USART1 TX and RX pins (U1TX, U1RX) on the PIC32.
The "Project and Source Files" download (see below) contains a fully functional project. It can be used as an example and requires no modifications. To gain a deeper understanding of how to use the MPLAB® Harmony Framework, we recommend you generate the project and source files yourself by following the step-by-step procedure below.
|Tool|| About|| Purchase|
This project has been verified to work with the following versions of software tools:
MPLAB® X IDE v3.25, MPLAB® XC32 Compiler v1.40, MPLAB® Harmony v1.07.01
Because we regularly update our tools, occasionally you may discover an issue while using newer versions. If you suspect that to be the case, we recommend that you double check using the same versions that the project was tested with.
Archived versions of our tools can be found on the following Microchip websites:
MPLAB Harmony (see "Archived Downloads" tab)
MPLAB X IDE and XC32 Compiler (see "Downloads Archive" tab)
Note that multiple versions of all these tools can co-exist on the same computer.
| Windows|| Linux|| Mac OSX|
Integrated Development Environment
MPLAB® Harmony 1.xx
Integrated Software Framework
The contents of the following zip file need to be placed in this directory:
<Harmony install path>/apps/training
(example Harmony install path = c:/microchip/harmony/v1_07_01)
If this is not done, the MPLAB® X IDE will not be able to find all source files, and the project will not build successfully.
| Windows|| Linux|| Mac OSX|
Project and Source Files
The "Project and Source Files" download provides a fully functional project. It can be used as an example and requires no modifications. The following steps below provide instruction on how this project was created.
Create a new MPLAB® Harmony project
The Target Device used on the chipKIT™ WF32 is the PIC32MX695F512L.
Use the MPLAB® Harmony Configurator (MHC) to configure the PIC32 clocks
Use MHC to configure the USART
Use MHC to generate the code
Add application states and application variables to your project.
Create a handle for the USART Driver, then initialize the handle by opening the driver.
Add the transmit and receive states to your application state machine.
Connect the development board to your computer, then select the XC32 compiler version and programmer/debugger for the project
The mini USB cable is used to power the board, and to send and receive characters on the USART.
Build, program and run your project
Your development board is now ready to send and receive characters on the USART. Start your terminal emulation program with the following configuration to test the results. Note how the PIC32 increments the ASCII value of the character you transmit by one, before echoing it back to you.
- Baud Rate: 9600
- Data: 8-bit
- Parity: none
- Number of Stop bits: 1
- Flow control: none
You now have the ability to communicate with the PIC32 over the USART. This can be particularly useful while debugging (e.g. transmit a register value, or indicate when a specific section of code is executed). You have also learned how to add your own application variables and states to an MPLAB® Harmony project.