#include <pic.h>
void main()
{
TRISC=0; // PORTC output
PORTC=0; // PORTC clear
T0CS=0; // Internal clock select (Fosc/4)
PSA=0; // Prescaler assigned to TMR0
PS2=1;
PS1=1;
PS0=1; // 1:256 Prescaler ratio
TMR0=61; // (256-195=61) for 195 increments--->195x256=50000uS
RC2=1; // RC0 LED ON
while(1)
{
if(T0IF==1){
TMR0=61;
RC2=!RC2;
T0IF=0; //clear overflow flag bit
}
}
}
void main()
{
TRISC=0; // PORTC output
PORTC=0; // PORTC clear
T0CS=0; // Internal clock select (Fosc/4)
PSA=0; // Prescaler assigned to TMR0
PS2=1;
PS1=1;
PS0=1; // 1:256 Prescaler ratio
TMR0=61; // (256-195=61) for 195 increments--->195x256=50000uS
RC2=1; // RC0 LED ON
while(1)
{
if(T0IF==1){
TMR0=61;
RC2=!RC2;
T0IF=0; //clear overflow flag bit
}
}
}
Comments
Post a Comment