Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/23/03 17:25
Read: times


 
#37005 - RE: 87LPC764 and LCD display help
Hi everyone,

I have tried everyone's suggestions and it is still just displaying the cursors on line 1 of the 2 line LCD. Thats all i can see - and its quite frustrating! Here is my code, I know its quite long, sorry. Hopefully anyone can point me in the right direction? I know there are lots of delays in it, but this is just to try and get it to work!!


#include <reg764.h>
#include <stdio.h>

#define EN P1_7
#define RS P1_6
#define RW T0
#define DB7 T1
#define DATA P0

void delay_ms(char a){
char j=0;
char k=0;
while(j<a){
j++;
while(k<2){
k++;
}
k=0;
}

}

void wait_lcd(void){
int i=0;
do { DB7=1;
RS=1;
RW=1;
EN=1;
delay_ms(1);
i=DATA;
EN=0;
delay_ms(1);
EN=1;
delay_ms(4);
EN=0;
} while(i & 0x80);
}

void print_char(char a){
RS=1;
RW=0;
delay_ms(1);
EN=1;
DATA=a;
delay_ms(1);
EN=0;
delay_ms(1);
wait_lcd();
}

void write_inst(void){
RS=0;
RW=0;
delay_ms(1);
EN=1;
delay_ms(1);
EN=0;
wait_lcd();
}

void init_lcd(void){
char i=0;
delay_ms(15);
RS=0;
RW=0;
for(i=1;i<=3;++i) {
DATA=0x30;
delay_ms(10);
EN=1;
delay_ms(1);
EN=0;
}
DATA=0x38;
write_inst();
delay_ms(10);
DATA=0x06;
write_inst();
delay_ms(10);
DATA=0x0E;
write_inst();
delay_ms(10);
DATA=0x01;
write_inst();
delay_ms(10);
}

void print_score (void){
DATA=0x01;
write_inst();
print_char(rh);
print_char(rm);
print_char(rl);
print_char('-');
print_char(wick);
print_char(' ');
print_char('(');
print_char(ovh);
print_char(ovl);
print_char(' ');
print_char('o');
print_char('v');
print_char('e');
print_char('r');
print_char('s');
print_char(')');
DATA=0xC3;
write_inst();
print_char('t');
print_char('a');
print_char('r');
print_char('g');
print_char('e');
print_char('t');
print_char(' ');
print_char(targh);
print_char(targm);
print_char(targl);
}

void main(void){
P0M2=0xff;
P1M2=0xC0;
DATA=0;
delay_ms(15);
init_lcd();
while(1){
DATA=0x01;
write_inst();
print_char('h');
print_char('e');
print_char('l');
print_char('l');
print_char('o');
DATA=0xC3;
write_inst();
print_char('w');
print_char('o');
print_char('r');
print_char('l');
print_char('d');
delay_ms(15);
}
}


You are welcome to email me on amfmorris@hotmail.com.

Thanks very much,
Adam Morris

List of 21 messages in thread
TopicAuthorDate
87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      
RE: 87LPC764 and LCD display help            01/01/70 00:00      

Back to Subject List