Home › Forums › Microcontrollers › PIC Microcontroller › Displaying UART data on LCD – PIC 16F877A
- This topic has 5 replies, 3 voices, and was last updated 6 years, 4 months ago by Ligo George.
-
AuthorPosts
-
December 15, 2014 at 3:53 pm #10227nitin ahujaParticipant
I want to display data read from UART on 16×2 LCD with MikroC compiler & PIC16F877A microcontroller …
In my program I am sending data through USART terminal of MikroC, it is receiving correctly on virtual terminal in Proteus but not displaying on LCD.
Please check the code written in MikroCsbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB2_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB4_bit; sbit LCD_D7 at RB5_bit; sbit LCD_RS_direction at TRISB0_bit; sbit LCD_EN_direction at TRISB1_bit; sbit LCD_D4_direction at TRISB2_bit; sbit LCD_D5_direction at TRISB3_bit; sbit LCD_D6_direction at TRISB4_bit; sbit LCD_D7_Direction at TRISB5_bit; char gps; void main() { Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1,"log"); Lcd_Out(2,1,"lat"); UART1_Init(9600); here: if (UART1_Data_Ready() == 1) { // if data is received gps = UART1_Read(); delay_ms(100); } Lcd_Out(1,6,gps); Delay_ms(2000); goto here; }
December 15, 2014 at 7:17 pm #10236Ligo GeorgeKeymasterIt is not a good practice to use goto statements in your programs.
Try like this to display UART data on LCD :
void main() { Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); UART1_Init(9600); while(1) { if(UART1_Data_Ready()) { gps = UART1_Read(); Lcd_Chr_Cp(gps); } }
December 15, 2014 at 8:21 pm #10237nitin ahujaParticipantsir , i wana ask that in gps module the time we get is 24 hour format ,,?
December 22, 2014 at 11:16 am #10255Ligo GeorgeKeymasterYes, it is in 24 hour format.
November 10, 2016 at 8:36 am #13095Dona Mary JohnParticipantCan you please send the program for USART with lcd without function oriented.
November 10, 2016 at 11:51 am #13096Ligo GeorgeKeymasterDear Dona,
Kindly open a new topic for asking your doubts.
You can see our complete UART code in the following article.
-
AuthorPosts
- You must be logged in to reply to this topic.