Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] LCD interfacing program

Status
Not open for further replies.

bskumar7080

Member level 2
Joined
Feb 8, 2010
Messages
48
Helped
4
Reputation
8
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,579
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
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);
}
 

hello friend,

I think you program will work, but check with interface cable between mc and lcd display. try to put test code to display...
 

My code works i checked the connections , but it is printing in reverse direction like this "olleh dlrow" can i known why is like this
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top