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] HOW to interface JHD204A 20x4 LCD with PIC microcontroller

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,.
How to interface LCD with PIC microcontroller. what is the functions to be used . i am using JHD204A 20x4 LCD display and PIC18f452.


Thanks & Regards
sivakumar
 


The following code is not working, what is wrong in this code, i gave connections as per xlcd.h, i am using c18 libraries

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

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 );

while(1)
{


WriteDataXLCD('s'); //write to LCD

}

}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top