I'm using a 18F2620 with 10 Mhz crytal + 2 x 18pf caps.
I connected on port B a LCD and only would like to display a test message on it.
When powering up the Pic initialises the LCD but nothing is been displayed.
I think there is something wrong with my fuses settings.
Can you tell me what i should set in my project settings ?
Here are what is currently selected :
OSC_HS_1H
LVP_OFF_4L
XINST_OFF_4L
Many thanks for your help,
Code: Select all
/*******************************************************************************
LCD Test for 18F2620
10 Mhz Crystal
Hardware configuration :
LCD RST = RB2
LCD E = RB3
LCD D4 = RB4
LCD D5 = RB5
LCD D6 = RB6
LCD D7 = RB7
*******************************************************************************/
// Initialisations
// Definition for Inputs & Outputs :
#define LCD_BL PORTB.F1 // LCD Back light
void Init(void)
{
ADCON1 = 0x0E; // Set AN0 channel pin as analog
ADCON1 = 7; // Configure AN pins as digital I/O
// For AN -> Dig conversion :
TRISA = 0B11001111;
ADCON1= 0x82; // configure VDD as Vref, and analog channels
PORTB = 0x00; //initialize PORTB
TRISB = 0;
PORTC = 0x00;
TRISC = 0B11000000; // RC6 & RC7 : inputs - RC0 to RC5 : outputs
//Lcd_Config(&PORTB, 0, 1, 7, 5, 4, 3, 2);
Lcd_Init(&PORTB);
Lcd_Cmd(LCD_CLEAR); // Clear display
Lcd_Cmd(LCD_CURSOR_OFF); // Turn cursor off
}
//----------------------------------------------------------------------------------
void main()
//----------------------------------------------------------------------------------
{
Init(); // Initialize Pic ( pins & lcd )
LCD_BL = 1; // Switch the LCD back light ON
while(1) // boucle infinie
{
Lcd_Custom_Out(1, 5, "Hello!"); // Print “Hello!” on LCD at line 1, char 5
Lcd_Custom_Out(2, 3, "test display !");
//----------wait approx. 1.2s
Delay_ms(1200);
}
}