uday mehta
Advanced Member level 4
- Joined
- Dec 30, 2011
- Messages
- 104
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 1,298
- Activity points
- 1,979
I write down a program for scrolling display.
it is working properly in first line but then stuck.
when I check this program in keil debugger it works properly.
can you please help me to find where is the problem.
it is working properly in first line but then stuck.
when I check this program in keil debugger it works properly.
can you please help me to find where is the problem.
HTML:
#include<reg51.h>
sbit rs=P3^0;
sbit en=P3^1;
void delay(int c)
{
int i,j;
for(i=0;i<c;i++)
for(j=0;j<1275;j++);
}
void wdata(char a)
{
rs = 1;
P2 = a;
en = 1;
delay(10);
en = 0;
}
void wcmd(int b)
{
rs = 0;
P2 = b;
en = 1;
delay(10);
en = 0;
}
void lcd(char *disp)
{
int k;
int l=0;
for(k=0;disp[k]!=0;k++)
{
wdata(disp[k]);
if(l>15)
{
wcmd(0x07);
delay(10);
}
l++;
}
}
void lcdinit()
{
wcmd(0x38);
delay(50);
wcmd(0x0c);
delay(50);
wcmd(0x01);
delay(50);
wcmd(0x06);
delay(50);
}
void main()
{
lcdinit();
lcd("this is my first movable display program");
delay(10);
wcmd(0x80);
lcd("i am very happy");
while(1);
}