Sorry if I missed something above and this is redundant - dismiss as necessary.@BobaMosfet
I am using a PIC development board so I assumed the crystal on the board is part of the MCU circuit supplying the clock speed right?
Are you using the Ready-Pic-Dip40 board? If so, yes the crystal is attached. Others such as Easy PIC need some hardware configuration.
The code you posed is incorrect:
C:
sbit LCD_RS at LATC4_bit;
sbit LCD_EN at LATC5_bit;
sbit LCD_D0 at LATD0_bit;
sbit LCD_D4 at LATC0_bit;
sbit LCD_D5 at LATC1_bit;
sbit LCD_D6 at LATC2_bit;
sbit LCD_D7 at LATC3_bit;
sbit LCD_RS_Direction at TRISC4_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
void main() {
//TRISC = 0; //CONFIGURE PORTC AS OUPUT
//TRISD = 0; //CONFIGURE PORTD AS OUTPUT
ANSELC = 0; // configure PORTC pins as digital
//ANSELD = 0;
Lcd_Init(); // initialize LCD
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
//Lcd_Cmd(_LCD_BLINK_CURSOR_ON); // blink cursor
Lcd_Out(1, 1, "Hello World");
Lcd_Out(2, 1, "LCD Display");
Lcd_Chr_CP('@');
while (1)
{
}
}
Uncomment line 23 to make port D a digital port.
I know you're not using PORTD but it's a good practice not to leave uncommitted pins as analog inputs. While you're at it, be sure to initialize all the other ports for the same reason. Set unused ones to output 0.
If that's not it, post your current code and actual circuit.
Good luck!
Last edited: