PIC timer0 / timer1 for SONAR application

Status
Not open for further replies.

zenoneder

New Member
i just discovered this site and i'm wondering if anyone can help me with PIC timing. i'm using a PIC16F872 clocked at 20 MHz. ideally i'd like to use timer1 (16 bit) at a frequency of 625 kHz, so in CSS i iniated it with:

setup_timer_1(T1_DIV_BY_8);

i expected the following:
20 MHz freq of oscilation / 4 cycles per clock tick = 5 MHz internal clocking
5 MHz / 8 = 625 kHz timer1 frequency

when i read from the timer at an interval that should be within its range at this frequency, i am getting negative values. i need to measure intervals ranging from 100 uSec to 100 mSec. any help would be greatly appreciated.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…