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.

[help] Configuration LCD hd44780

Status
Not open for further replies.

yamine

Member level 1
Joined
May 4, 2012
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,507
i want your help to verify my program "interfacing LCD hd44780"
this is my program using m32c87 ,20 MHz, it doesn't work !!

//**********************************************************
#define RS p3_0
#define RW p3_1
#define E p3_2
#define BF p3_7

void tpo(void)
{
unsigned char k;
for(k=0;k<250;k++) ;
}


void tempo(short duree_us)
{
ta0mr=0x00;
ta0=20*duree_us;
ta0ic=0x00;
ta0s=1;
while(ir_ta0ic==0);
ta0s=0;
}
void busy(void)
{

RS=0;
RW=1;
E=1;
pd3=0x00;
while(BF==1);
pd3=0xff;
E=0;
RW=0;


}
void lcd_com(unsigned char cmd)
{
busy();
RS=0;
RW=0;
E=0;
p3=(cmd & 0xf0);
E=1;
tempo(1000);
E=0;
p3=((cmd << 4)& 0x0f);
E=1;
tempo(1000);
E=0;

}
//initialization of screen display
void init_lcd(void)
{
pd3=0xff;
p3=0x00;
RS=0;
RW=0;
E=0;
lcd_com(0x03);
lcd_com(0x28);
lcd_com(0x06);
lcd_com(0x0e);
lcd_com(0x01);
}

void write_to_lcd(unsigned char car)
{
busy();
RS=1;
RW=1;
E=0;
p3=(car & 0xf0);
E=1;
tempo(1000);
E=0;
p3=((car << 4) & 0xf0);
E=1;
tempo(1000);
E=0;
}
// Global function
void main(void)
{
init_lcd();
write_to_lcd('b');
while(1);
}
//******************************************
PLEASE HELP ME
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top