Monday 1 August 2016

Timer with PIC

Program:



#include<pic.h>
#include<htc.h>
#define __16f877A_H
__CONFIG(WDTE_OFF&LVP_OFF&FOSC_HS&PWRTE_ON);
void main()
{
unsigned int i;
TRISB=0x00;
OPTION_REG=0x01;
PORTB=0xff;
while(1)
{
for(i=0;i<3921;i++)
{
TMR0=0x00;
while(!TMR0IF);
TMR0IF=0;
}
TMR0=0x6f;
//while(!TMR0IF);
//TMR0IF=0;
PORTB=~PORTB;
}
}

0 comments:

Post a Comment

if you have any doubt please let me know