Microcontroller › 8051 › counter › sir,i want a proteses
September 3, 2013 at 4:07 am
#10413
saavanan
Participant
sir,i want a proteses simulation for this code.
#include <REGX51.H>
sbit LED1=P1^0;
sbit LED2=P1^1;
sbit LED3=P1^2;
sbit LED4=P1^3;
void call_blink(unsigned char dat);
void delay(void);
void main()
{
TMOD=0x05;
TH0=0xff; //for 12MHz (12/12MHZ)=1u>per cycle operation
TL0=0xf0;
TR0=1;
while(TF0==0)
{
call_blink(TL0&0x0f);
}
if(TF0==1)
{
TF0=0;
call_blink(0xff);
}
}
void call_blink(unsigned char dat)
{
if(dat==0xff)
{
while(1)
{
LED1=0;delay();
LED1=1;delay();
}
}
if(dat==0x01)
LED2=0;
if(dat==0x04)
LED3=0;
if(dat==0x08)
LED4=0;
}
/******************delay**********************/
void delay(void)
{
unsigned char i;
for(i=0;i<255;i++)
{
for(i=0;i<255;i++);
}
}