th3gr8
Member level 4
- Joined
- Aug 27, 2013
- Messages
- 68
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 8
- Activity points
- 398
Hello all ..
I have interfaced a 128x64 GLCD and keypad with microcontroller (PIC16F877A) .. The problem i am facing is that GLCD shows garbage text first and when i reset the PIC and start again, GLCD displays more garbage text and the garbage text increases with every reset .. How can i remove this garbage text??
I am posting code of function which receives data from keypad and displays it on GLCD.
Pictures of garbage text:
I have interfaced a 128x64 GLCD and keypad with microcontroller (PIC16F877A) .. The problem i am facing is that GLCD shows garbage text first and when i reset the PIC and start again, GLCD displays more garbage text and the garbage text increases with every reset .. How can i remove this garbage text??
I am posting code of function which receives data from keypad and displays it on GLCD.
Code:
int readThermometer(void)
{
n=0;
while(1)
{
k = kbd_getc();
if(k!=0)
{
temp1[n]=k;
//!if(temp1[n]=='*')
//!{
//!temp1[n]='.';
//!}
if(k=='#')
{
goto here;
}
glcd_text57(5, 15, temp1,1,ON);
here:
k=0;
delay_ms(250);
n++;
}
delay_ms(1);
if(temp1[n-1]=='#')
{
unsigned int8 length, count,i;
length = strlen(temp1);
count=length-1;
for(i=count;i<count+1;i--)
{
temp2[count-i] = temp1[count-i];
}
//!if(temp1[n-1]=='#')
//!{
//!temp2[0] = temp1[0];
//!temp2[1] = temp1[1];
//!temp2[2] = temp1[2];
//!temp2[3] = 0;
temp3=atoi(temp2);
break;
}
}
return temp3;
}
Pictures of garbage text: