Hi there
I am new to embedded,i have programmed my boards using assembly language but now m trying to learn it using embedded C.
I am using keil, controller-89V51RD2
I want to use timer without using interrupt.
my code is:
#include<reg51.h>
sbit LED1=P3^0;
//Timer 0 is used
void main()
{
while(1)
{
unsigned int x;
//Mode 1 is used
TMOD=0x01;
TH0=0xFF;
TL0=0xFF;
LED1=1;
TF0=0; //clearing the overflow flag
TR0=1; //START TIMER
while(TF0==0)
{
//waiting till the timer flag overflows
}
x=x+1;
if(x%99==0)
{
LED1=!LED1;
}
TF0=0;
TR0=0;
}
}
the code shows 2 warning when i execute it.
I am wondering that if something is wrong with my code or logic...not able to figure it out.
thanks
I am new to embedded,i have programmed my boards using assembly language but now m trying to learn it using embedded C.
I am using keil, controller-89V51RD2
I want to use timer without using interrupt.
my code is:
#include<reg51.h>
sbit LED1=P3^0;
//Timer 0 is used
void main()
{
while(1)
{
unsigned int x;
//Mode 1 is used
TMOD=0x01;
TH0=0xFF;
TL0=0xFF;
LED1=1;
TF0=0; //clearing the overflow flag
TR0=1; //START TIMER
while(TF0==0)
{
//waiting till the timer flag overflows
}
x=x+1;
if(x%99==0)
{
LED1=!LED1;
}
TF0=0;
TR0=0;
}
}
the code shows 2 warning when i execute it.
I am wondering that if something is wrong with my code or logic...not able to figure it out.
thanks