UART is an essential interface to PC. Below shows how to use and set the configuration bits in C18. The purpose of the codes below is to loop back to the Hyperterminal the word “Hello” to make sure the settings of the PIC works accordingly. OpenUSART() function is provided by C18 and it is used to set the necessary registers in PIC18F series microcontroller.

Using Serial UART

For some that uses a USB to Serial converter, they are required to test the converter is working properly. Some have been reported not working. The converter can be test by connecting pin 2 and pn 3 together. This allows the data sent from Hyperterminal to loop back to the terminal. After this is done, the above codes can be used to make sure the serial is function properly.

Using Serial UART Figure 1: Connecting pin 2 and pin 3 of serial

Using Serial UART  loopbackFigure 2: Terminal showing the loop back

These test allows you to save time by debugging the necessary erroneous parts in your development.


Engineering Student

Leave a Reply

Your email address will not be published. Required fields are marked *