Apr 2, 2014 #1 M Muhammad Faran Newbie level 4 Joined Apr 2, 2014 Messages 5 Helped 0 Reputation 0 Reaction score 0 Trophy points 1 Activity points 36 i am using lcd jhd 162A and using microcontroller AT89c51 lcd only shows black boxes in the second line... dont know whats the problem is it initialization problem or something else in coding??? plz plz help CODE: 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 #include<reg51.h> #define port2 P2 sbit rs = P1^0; sbit rw = P1^1; sbit e = P1^2; //DELAY FUNCTION void delay(unsigned int msec) { int i,j ; for(i=0;i<msec;i++) for(j=0;j<1275;j++); } // LCD COMMAND SENDING FUNCTION void lcd_cmd(unsigned char item) { port2 = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } // LCD DATA SENDING FUNCTION void lcd_data(unsigned char item) { port2 = item; rs= 1; rw=0; e=1; delay(1); e=0; return; } // LCD STRING SENDING FUNCTION void lcd_string(unsigned char *str) { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(10); } return; } void main() { lcd_cmd(0x38); //2 LINE, 5X7 MATRIX lcd_cmd(0x0e); //DISPLAY ON, CURSOR BLINKING lcd_string(unsigned char “working”); } }
i am using lcd jhd 162A and using microcontroller AT89c51 lcd only shows black boxes in the second line... dont know whats the problem is it initialization problem or something else in coding??? plz plz help CODE: 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 #include<reg51.h> #define port2 P2 sbit rs = P1^0; sbit rw = P1^1; sbit e = P1^2; //DELAY FUNCTION void delay(unsigned int msec) { int i,j ; for(i=0;i<msec;i++) for(j=0;j<1275;j++); } // LCD COMMAND SENDING FUNCTION void lcd_cmd(unsigned char item) { port2 = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } // LCD DATA SENDING FUNCTION void lcd_data(unsigned char item) { port2 = item; rs= 1; rw=0; e=1; delay(1); e=0; return; } // LCD STRING SENDING FUNCTION void lcd_string(unsigned char *str) { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(10); } return; } void main() { lcd_cmd(0x38); //2 LINE, 5X7 MATRIX lcd_cmd(0x0e); //DISPLAY ON, CURSOR BLINKING lcd_string(unsigned char “working”); } }
Apr 2, 2014 #2 C cl10greg Full Member level 3 Joined Mar 29, 2012 Messages 177 Helped 36 Reputation 72 Reaction score 36 Trophy points 1,308 Activity points 2,491 When this happened to me it was either a contrast problem or a compiler setting problem (i think it was something along the lines of floating point). I would verify those are set correctly first.
When this happened to me it was either a contrast problem or a compiler setting problem (i think it was something along the lines of floating point). I would verify those are set correctly first.
Apr 2, 2014 #3 M Muhammad Faran Newbie level 4 Joined Apr 2, 2014 Messages 5 Helped 0 Reputation 0 Reaction score 0 Trophy points 1 Activity points 36 what you mean by floating lines - - - Updated - - - what you meant by floating lines