Desperrado
New Member
Im one day away from my deadline and my project isnt working!!i realli nid help.I have connected a Cygnal C8051F005 to a farnell lcd.My connections are : LCD pin 7 to 14 to c8051 port 1(p1.6 to p 1.1) and i nid to show the words " Height : " without the quotes.The lcd still cant work after i inputted the program.here is my program.Pls correct my program.The datasheet for the lcd is **broken link removed** reply to alone_againSQ@hotmail.com.I really appreciate any help at all and many thanks to those reading the post.
#include<c8051f000.h>
sbit E =P0^4;
sbit RS =P0^6;
sbit RW =P0^7;
void delay(unsigned a,unsigned b)
{
TMOD = 0x01;
TR0 = 0;
TF0 = 0;
TH0 = a;
TL0 = b;
TR0 = 1;
while(TF0==1);
}
void delay_1()
{
int a;
TMOD = 0x01; // Timer Mode Register
for(a=0;a<50;a++)
{
TH0 = 0x00; // Timer 0 High Byte
TL0 = 0x00; // Timer 0 Low Byte
TF0 = 0;
TR0 = 1;
while(TF0==0)
{
TR0 = 0;
}
}
}
void delay_2(unsigned int x)
{
while(x!=0)
{
x--;
}
}
void strobe()
{
E = 1;
delay(0xFF,0x69);
E = 0;
delay(0xFF,0x69);
}
void data_write(unsigned char x)
{
RS = 0;
RW = 0;
P1 = x;
strobe();
}
void control_write(unsigned char x)
{
RS = 1;
RW = 0;
P1 = x;
strobe();
}
void display_init()
{
XBR0 = 0x00;
XBR1 = 0x00;
XBR2 = 0x40;
PRT1CF=0xFF;
PRT0CF=0xFF;
delay(0x8A,0x00);
RS = 0;
RW = 0;
P1 = 0x38;
strobe();
delay(0xFF,0x00);
RS = 0;
RW = 0;
P1 = 0x0E;
strobe();
delay(0xFF,0x00);
RS = 0;
RW = 0;
P1 = 0x01;
strobe();
delay(0xFA,0x00);
RS = 0;
RW = 0;
P1 = 0x06;
strobe();
}
void main()
{
display_init();
control_write(0x80);
data_write(0x48);
delay(0xFF,0x00);
}
#include<c8051f000.h>
sbit E =P0^4;
sbit RS =P0^6;
sbit RW =P0^7;
void delay(unsigned a,unsigned b)
{
TMOD = 0x01;
TR0 = 0;
TF0 = 0;
TH0 = a;
TL0 = b;
TR0 = 1;
while(TF0==1);
}
void delay_1()
{
int a;
TMOD = 0x01; // Timer Mode Register
for(a=0;a<50;a++)
{
TH0 = 0x00; // Timer 0 High Byte
TL0 = 0x00; // Timer 0 Low Byte
TF0 = 0;
TR0 = 1;
while(TF0==0)
{
TR0 = 0;
}
}
}
void delay_2(unsigned int x)
{
while(x!=0)
{
x--;
}
}
void strobe()
{
E = 1;
delay(0xFF,0x69);
E = 0;
delay(0xFF,0x69);
}
void data_write(unsigned char x)
{
RS = 0;
RW = 0;
P1 = x;
strobe();
}
void control_write(unsigned char x)
{
RS = 1;
RW = 0;
P1 = x;
strobe();
}
void display_init()
{
XBR0 = 0x00;
XBR1 = 0x00;
XBR2 = 0x40;
PRT1CF=0xFF;
PRT0CF=0xFF;
delay(0x8A,0x00);
RS = 0;
RW = 0;
P1 = 0x38;
strobe();
delay(0xFF,0x00);
RS = 0;
RW = 0;
P1 = 0x0E;
strobe();
delay(0xFF,0x00);
RS = 0;
RW = 0;
P1 = 0x01;
strobe();
delay(0xFA,0x00);
RS = 0;
RW = 0;
P1 = 0x06;
strobe();
}
void main()
{
display_init();
control_write(0x80);
data_write(0x48);
delay(0xFF,0x00);
}