Hi i am using C8051F226 to program a 8x2 LCD in C language... I am using Port 3.0-3.7 to DB0-DB7 (Data Bus pins),Port 2.5 for RS ( Register Select pin),Port 2.6 for RW (Read/Write pin) and Port 2.7 for E (Enable pin)...I need help in configuring the ports..My LCD keep on displaying "rows of square dots" even though i had already initialize it...Below is how i configure the ports...I am just wondering whether I am configuring the ports correctly? It would be grateful if you guys can tell me.
Thanks.
// Configure the PRTnMX Registers
PRT0MX = 0x00; // PRT0MX: Initial Reset Value
PRT1MX = 0x00; // PRT1MX: Initial Reset Value
PRT2MX = 0x00; // PRT2MX: Initial Reset Value
// Port configuration (1 = Push Pull Output)
PRT0CF = 0x00; // Output configuration for P0
PRT1CF = 0x00; // Output configuration for P1
PRT2CF = 0x00; // Output configuration for P2
PRT3CF = 0xFF; // Output configuration for P3
P0MODE = 0xFF; // Input configuration for P0
P1MODE = 0xFF; // Input configuration for P1
P2MODE = 0xFF; // Input configuration for P2
P3MODE = 0xFF; // Input configuration for P3
Thanks.
// Configure the PRTnMX Registers
PRT0MX = 0x00; // PRT0MX: Initial Reset Value
PRT1MX = 0x00; // PRT1MX: Initial Reset Value
PRT2MX = 0x00; // PRT2MX: Initial Reset Value
// Port configuration (1 = Push Pull Output)
PRT0CF = 0x00; // Output configuration for P0
PRT1CF = 0x00; // Output configuration for P1
PRT2CF = 0x00; // Output configuration for P2
PRT3CF = 0xFF; // Output configuration for P3
P0MODE = 0xFF; // Input configuration for P0
P1MODE = 0xFF; // Input configuration for P1
P2MODE = 0xFF; // Input configuration for P2
P3MODE = 0xFF; // Input configuration for P3