Badhon Jahid
Newbie level 1
- Joined
- Jul 9, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 18
can any one tell me what is wrong with this code... please help
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 // LCD module connections sbit LCD_RS at RD2_bit; sbit LCD_EN at RD3_bit; sbit LCD_D4 at RD4_bit; sbit LCD_D5 at RD5_bit; sbit LCD_D6 at RD6_bit; sbit LCD_D7 at RD7_bit; sbit LCD_RS_Direction at TRISD2_bit; sbit LCD_EN_Direction at TRISD3_bit; sbit LCD_D4_Direction at TRISD4_bit; sbit LCD_D5_Direction at TRISD5_bit; sbit LCD_D6_Direction at TRISD6_bit; sbit LCD_D7_Direction at TRISD7_bit; // End LCD module connections char i; int row=1,col=1; void main() { uart1_init(115200); delay_ms(1000); Lcd_Init(); delay_ms(200); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off Lcd_Cmd(_LCD_UNDERLINE_ON); //Underline fashion cursor Lcd_Out(1,2,"LCD/UART TEST"); Delay_ms(2000); Lcd_Cmd(_LCD_CLEAR); //Lcd_Cmd(_LCD_CLEAR); delay_ms(5000); uart1_write_text("AT"); uart1_write(0x0d); uart1_write(0x0a); delay_ms(2000); uart1_write_text("AT+CMGF=1"); uart1_write(0x0d); uart1_write(0x0a); delay_ms(200); uart1_write_text("AT+CMGR=1"); uart1_write(0x0d); uart1_write(0x0a); delay_ms(200); while(1){ if(UART1_Data_Ready()==1){ //If Data Ready, i=UART1_Read(); //Read it and store in variable i Lcd_Chr(row,col,i); //Print it in co-ordinates specified if(i==27){ //If ESC is pressed, clear display Lcd_Cmd(_LCD_CLEAR); col=1,row=1; } col=col+1; } if(col==17 && row==1){ //On end of row, goto second row row=2; col=1; } if(row==2 && col==17){ //On end of display, clear display Lcd_Cmd(_LCD_CLEAR); col=1; row=1; } } }
Last edited by a moderator: