akhilpaulv
Full Member level 2
- Joined
- Apr 20, 2013
- Messages
- 136
- Helped
- 7
- Reputation
- 14
- Reaction score
- 7
- Trophy points
- 1,298
- Location
- Thrissur, India
- Activity points
- 2,051
when i am trying to simulate in Proteus it comes with error
here is the program(programed in mikroc pro for 8051 and microcontroller is at89s51)
here is the program(programed in mikroc pro for 8051 and microcontroller is at89s51)
Code:
sbit LCD_RS at P0_0_bit;
sbit LCD_EN at P0_1_bit;
sbit LCD_D4 at P2_4_bit;
sbit LCD_D5 at P2_5_bit;
sbit LCD_D6 at P2_6_bit;
sbit LCD_D7 at P2_7_bit;
sbit h at P3_6_bit;
sbit s at P3_5_bit;
void main()
{
int i,a[25],p,b,w,g,t;
char txt1[] = "push button";
char txt2[] = "got it";
char txt3[] = "no";
char txt4[] = "yes";
char txt5[] = "searching";
char txt8[] = "ready to begin";
P1=0xFF;
h=1;
s=1;
P3=00;
P1=00;
h=0;
s=0;
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt1); // Write text in first row
while(s)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt5);
for(g=0;g<25;i++)
{
for(i=0;i<2;i++)
{
P3=0x01; //0001
delay_ms(10);
P3=0x04; //0100
delay_ms(10);
P3=0x02; //0010
delay_ms(10);
P3=0x08; //1000
delay_ms(10);
}
a[i]=P2;
}
for(i=0;i<25;i++)
if(t=1)
{
a[w]=0;
{
if(a[i]>p)
{
b=i;
p=a[i];
}
}
for(i=0;i<b;i++)
{
for(g=0;g<2;g++)
{
P3=0x01; //0001
delay_ms(10);
P3=0x04; //0100
delay_ms(10);
P3=0x02; //0010
delay_ms(10);
P3=0x08; //1000
delay_ms(10);
}
}
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt2);
switch(h)
{
case 1 :
{
w=b;
t=1;
}
case 0 :
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt8);
}
}
}
{
}
}
}
Last edited by a moderator: