PIC16F877_Delay and Timer0

Status
Not open for further replies.

fawadbutt

Member level 3
Joined
Oct 29, 2010
Messages
61
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
Lahore, Pakistan, Pakistan
Activity points
1,754
any one help me in Delay and Timers,,,
i m using mikroC
i have the code for 1 second but its not working,,,!
......................................................................................
//Creating the 1 sec delay
int count=0;
void main(void)
{
TMRO=0; //TMR0 initilization
T0CS=0; //choosing to work with internal clock
T0SE=0; //Reaching on Low2High Edge
PSA=0; //choosing to work with Precaler
PS0=1;
PS1=1; //Prescaler value divides in 256
PS2=1;
while(1)
{
while(!T0IF) //staying here 256 times and than T0IF=1
T0IF=0; //Resetting the Overflow Flag
Count++; //Increment by 1
if(count==15)
{
count=0; //when count reching the 15, reseting to 0
}
}
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…