Monday 19 October 2015

PIC16F877A TIMER1 FOR 10MS






#include<pic.h>
#include<htc.h>
#define __PIC16F877A_H
__CONFIG(PWRTE_ON & FOSC_HS & LVP_OFF & WDTE_OFF);

int count=0;

void delay()
{
while(!TMR1IF);
TMR1IF=0;
count++;
if(count==30)
{
count=0;
}
}

void main()
{
TRISD=0x00;
T1CON=0x01;
while(1)
{
PORTD=0xff;
delay();
PORTD=0x00;
delay();
}
}

No comments:

Post a Comment