bskumar7080
Member level 2
Hi all,
i was trying to interface 20 x 4 LCD with pic p18f452 but i am not getting any output, i am using 20mhz crystal, c18 compiler
If anyone interfaced LCD please share your code
my code below is not working
i was trying to interface 20 x 4 LCD with pic p18f452 but i am not getting any output, i am using 20mhz crystal, c18 compiler
If anyone interfaced LCD please share your code
my code below is not working
Code:
#include <p18f452.h>
#include <xlcd.h>
#include <delays.h>
#include <usart.h>
//**************Configuration Bits******************
#pragma config OSC = HS
#pragma config OSCS = ON
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config CCP2MUX = OFF
#pragma config STVR = OFF
#pragma config LVP =OFF
#pragma config DEBUG = OFF
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CP2 = OFF
#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 =OFF
#pragma config WRT2 = OFF
#pragma config WRT3 = OFF
#pragma config WRTB = OFF
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTR2 = OFF
#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
//***********************************main***************************************
void DelayFor18TCY( void )
{
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
}
void DelayPORXLCD (void)
{
Delay1KTCYx(60); // Delay of 15ms
// Cycles = (TimeDelay * Fosc) / 4
// Cycles = (15ms * 16MHz) / 4
// Cycles = 60,000
return;
}
void DelayXLCD (void)
{
Delay1KTCYx(20); // Delay of 5ms
// Cycles = (TimeDelay * Fosc) / 4
// Cycles = (5ms * 16MHz) / 4
// Cycles = 20,000
return;
}
void main( void )
{
char data;
// configure external LCD
OpenXLCD( FOUR_BIT & LINES_5X7 );
WriteDataXLCD('s'); //write to LCD
while(1);
}