filjoa
Joined: 04 May 2008 Posts: 260
|
timer1 on 12F683 |
Posted: Fri Jun 04, 2010 12:26 pm |
|
|
Hi
I like try start use timers but I don't find anywhere equations to calculate overflow happens.
Someone can explain to me how I can calculate timers interruption?
PS: Now I try to flash an LED (is possible flash with 1s?)...
Code: |
#include <12F683.h>
#FUSES NOWDT, INTRC_IO, NOCPD, NOPROTECT, NOMCLR, PUT, NOBROWNOUT, NOIESO, NOFCMEN
#use delay(clock=8000000)
#define LED PIN_A5
int16 count = 0;
#int_TIMER1
void TIMER1_isr(void)
{
count++;
}
void main()
{
int8 aux = 0 ;
enable_interrupts(GLOBAL);
enable_interrupts(INT_TIMER1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
while(TRUE)
{
if (count >= 1000)
{
if (aux == 0)
{
output_high(LED);
aux = 1;
count = 0;
} else
{
output_low(LED);
aux = 0;
count = 0;
}
}
}
}
|
best regards |
|