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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/28/01 04:09
Read: times


 
#18145 - RE:bruce this is the code
i wrote in spjsystems 8051 compiler
void lcd_init();
void lcd_cmd();
void ready();
void delay15ms();
//void delay5ms();
void disp();
void disp_string(char *v);
unsigned char val,data;
unsigned char ch[16]="welcome";
unsigned char ch1[16]="tops";
void main()
{
lcd_init();
val=0x85;
lcd_cmd();
data=ch[0];
disp();
data=ch[1];
disp();
data=ch[2];
disp();
val=0xc5;
lcd_cmd();
disp_string(ch1);
while(1)
{}
}
void lcd_init()
{
delay15ms();
val=0x3c;
lcd_cmd();
val=0x06;
lcd_cmd();
val=0x01;
lcd_cmd();
val = 0x08;
lcd_cmd();
val=0x0e;
lcd_cmd();
}
void lcd_cmd()
{
ready();
asm mov dptr,#_val
asm movx a,@dptr
asm mov p1,a
asm clr p0.2 //; p0.2=rs
asm clr p0.3 //; p0.3 =rw
asm setb p0.4 //; p0.4 =en
asm clr p0.4
}
void disp()
{
ready();
asm mov dptr,#_data
asm movx a,@dptr
asm mov p1,a
asm setb p0.2
asm clr p0.3
asm setb p0.4
asm clr p0.4
//asm ret
//delay5ms();
}
void disp_string(char *v)
{
while(*v)
{
data=*v++;
disp();
}
}
void ready()
{
asm clr p0.4
asm mov p1,#0ffh
asm clr p0.2
asm setb p0.3
asm wait:
asm clr p0.4
asm setb p0.4
asm jb p1.7,wait
asm clr p0.4
//asm ret
}
void delay15ms()
{
asm mov r1,#0fh
asm mov r2,#64h
asm mov r3,#0ah
asm gg1:
asm djnz r3,gg1
asm gg2:
asm djnz r2,gg2
asm gg3:
asm djnz r1,gg3
//asm ret
}
void delay5ms()
{
asm mov r1,#05h
asm mov r2,#64h
asm mov r3,#0ah
asm gg4:
asm djnz r3,gg4
asm gg5:
asm djnz r2,gg5
asm gg6:
asm djnz r1,gg6
//asm ret
}

List of 11 messages in thread
TopicAuthorDate
problem with stringdisplay on lcd            01/01/70 00:00      
RE: problem with stringdisplay on lcd            01/01/70 00:00      
RE: problem with stringdisplay on lcd            01/01/70 00:00      
RE:bruce this is the code            01/01/70 00:00      
RE: RE:bruce this is the code            01/01/70 00:00      
RE: RE:bruce this is the code            01/01/70 00:00      
RE: problem with stringdisplay on lcd            01/01/70 00:00      
RE: problem with stringdisplay on lcd            01/01/70 00:00      
RE: RE:bruce this is the code            01/01/70 00:00      
silviu : i am using spjsystems            01/01/70 00:00      
RE: silviu : i am using spjsystems            01/01/70 00:00      

Back to Subject List