![]() TXREG: EUSART TRANSMIT DATA REGISTER -> EUSART: Enhanced USART RCSTA: RECEIVE STATUS AND CONTROL REGISTER TXSTA: RANSMIT STATUS AND CONTROL REGISTER The C code below is for MPLAB XC8 compiler, it was tested with version 2.00 installed on MPLAB X IDE version 5.05. UART Example with PIC microcontroller C code: In this project the PIC16F887 microcontroller runs with its internal oscillator 8 MHz, MCLR pin is configured as an input pin. The GND pin of the USB-to-Serial converter is connected to circuit ground, pins RX and TX are respectively connected to TX (#25) and RX (#26) pins of the PIC16F887 microcontroller. In this example I used the FT232RL module (the main component is FT232RL chip from FTDI), other modules can be used including the Arduino boards. To be able to send/ receive data from/ to the microcontroller to/ from the laptop we need a USB-to-Serial converter module. (All grounded terminals are connected together) The FT232RL module is directly connected to laptop USB port with mini USB cable. The connection between PIC16F887 microcontroller and laptop (or PC) is shown below. ![]() UART Example with PIC microcontroller circuit: USB-to-serial converter (such as FT232RL).PIC16F887 microcontroller -> datasheet.In this example I’m going to use the module in UART mode. The PIC16F887 microcontroller has one USART module, this module can be used as USART or UART depending on the configuration of some registers related with the module. The compiler used in this project is Microchip MPLAB XC8 (MPLAB X IDE with MPLAB XC8 compiler). ![]() UART: Universal Asynchronous Receiver/Transmitter USART: Universal Synchronous/Asynchronous Receiver/Transmitter. ![]() This post shows how to use PIC16F887 microcontroller USART module in order to receive and send data from and to PC serial monitor software (hyper terminal, Arduino IDE serial monitor tool, mikroElektronika USART Terminal …) or any device that uses UART communication. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |