vijaynallasivam
Junior Member level 1
- Joined
- Nov 16, 2015
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 150
my code was working fine .but suddenly all character are black square box .i am change new lcd 16x2 display & pic16f877a controller ,development board also changing but same problem coming. why this problem coming
mp lab/hitech c compiler i am using
my code:
mp lab/hitech c compiler i am using
my 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 header f void CheckBusy() { TRISD = 0xff; do { RE0 = 0; RE1 = 1; RE2 = 1; DelayUs(20); RE2 = 0; }while(RD7); TRISD = 0x00; PORTD = 0x00; } void LCD_SendCmd1(unsigned char cmd) { PORTD = cmd; RE0 = 0; RE1 = 0; RE2 = 1; DelayUs(20); RE2 = 0; } void LCD_SendCmd(unsigned char cmd) { CheckBusy(); PORTD = cmd; RE0 = 0; RE1 = 0; RE2 = 1; DelayUs(20); RE2 = 0; } void LCD_SendData(unsigned char dat) { CheckBusy(); PORTD = dat; RE0 = 1; RE1 = 0; RE2 = 1; DelayUs(20); RE2 = 0; } void ClearLine(short int st) { short int l; for(l=0;l<=15;l++) { LCD_SendCmd(st+l); LCD_SendData(' '); } } void LCD_init() { LCD_SendCmd1(0x38); DelayMs(100); LCD_SendCmd1(0x38); DelayMs(100); LCD_SendCmd1(0x38); DelayMs(100); LCD_SendCmd(0x06); DelayUs(100); LCD_SendCmd(0x0c); DelayUs(100); LCD_SendCmd(0x01); DelayUs(100); LCD_SendCmd(0x02); asm("CLRWDT"); } void LCD_puts(const char * s) { while(*s) { LCD_SendData(*s++); } } program code: #include<pic.h> #include<string.h> #include<stdio.h> #include<lcd.h> #include<uart.h> #define _XTAL_FREQ 20e6 __CONFIG(0x3F3A); void main() { unsigned char i,temp,database; unsigned char data[12]; TRISA = 0xff; TRISC = 0x92; TRISD = 0x00; TRISB = 0x00; TRISE = 0x00; PORTB = 0x00; PORTD = 0x00; PORTE = 0x00; PORTC = 0x02; ADCON1 =0x86; SPBRG = 25; BRGH = 1; TXEN = 1; CREN = 1; SPEN = 1; send_config(0b00000001); send_config(0b00000010); send_config(0b00000110); send_config(0b00001100); send_config(0b00111000); lcd_clr(); lcd_goto(0); send_string("WELCOME"); lcd_goto(20); send_string("STARTING UP....."); delay(300000); while(1) { delay(5000); CREN = 1; database=0; lcd_clr(); lcd_goto(0); send_string("Place your ID"); lcd_goto(20); send_string("on the reader."); temp=0; for(i=0;i<=12;i++)data[i]=uart_rec(); if(temp==0) { lcd_clr(); lcd_goto(0); send_string("ID:"); for(i=1;i<=10;i++)send_char(data[i]); } CREN = 0; delay(300000); } }
Last edited by a moderator: