The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
Lowest freq. with timer2 |
Posted: Mon Aug 20, 2007 12:12 pm |
|
|
Give this code the lowest freq for times 2?
Code: |
#include <18F4620.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOBROWNOUT,NOPUT,NOLVP,DEBUG,NOSTVREN,NOPROTECT
#int_TIMER2
void TIMER2_isr() {
output_toggle(PIN_C1);
}
void main() {
setup_timer_2(T2_DIV_BY_16,249,16);
enable_interrupts(INT_TIMER2);
enable_interrupts(GLOBAL);
while(TRUE);
}
|
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Aug 20, 2007 1:03 pm |
|
|
setup_timer_2(T2_DIV_BY_16,255,16);
Should give an interrupt every 13.1ms (@20Mhz xtal clock)
Humberto |
|