Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

Project Request

Return
Rollson Ipo
rollson

posted on 2016/03/04 09:36:46 AM CET

Audio & Speech

rfid displaying weird characters

hi, am doing final year project on rfid access control. i have this code that i wrote but it keeps displaying weird characters on my lcd. please i need help. Thanks. I use PIC 18F45K22

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

char i,rfid[13] ;

char rfid2[] = "0123456789123" ;
int count = 0;
void main()
{

ANSELB = 0;
ANSELD = 0;
ANSELC = 0;

Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
//Lcd_Out(1,1,"RFID Tag Reader"); // Write text in first row

UART2_Init(9600);

rfid[12] = '\0';

while(1)
{

if(UART2_Data_Ready())
{
for(i=0;i<12;)
{
if(UART2_Data_Ready())
{
rfid[i] = UART2_Read();
i++;
}

}

Lcd_Out(1,1,rfid);

if(!strcmp(rfid,rfid2)){
Lcd_Out(2,1,"ACCESS GRANTED");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
//Lcd_Out(1,1,"RFID Tag Reader");
}
else {
Lcd_Out(2,1, "ACCESS DENIED");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
//Lcd_Out(1,1,"RFID Tag Reader");
}

}
}
}