#include<pic.h>
#include<htc.h>
#define _XTAL_FREQ 4000000
#define __PIC16F877A_H
__CONFIG(PWRTE_ON & FOSC_HS & LVP_OFF & WDTE_OFF);
void Timer0()
{
OPTION_REG = 0x07;
TMR0 = 0;
while(INTCONbits.TMR0IF == 0); //Wait Here
INTCONbits.TMR0IF = 0; //Reset This Bit
}
void main()
{
unsigned int i;
TRISB = 0x00;
PORTB = 0x00;
TMR0 = 0;
while(1)
{
for(i=0;i<4;i++)
{
Timer0();
}
PORTB =~ PORTB;
}
}
No comments:
Post a Comment