PicMultiCalc doesn't do TMR2,4,6 unless PR2=255 and you reload on every interrupt.
TMR2 counts up to the PR2 value + 1, then resets and interrupts.
So you were only getting 64 counts. (62.5Khz)
For 200 counts, set PR2 to 199.
PicMultiCalc doesn't do TMR2,4,6 unless PR2=255 and you reload on every interrupt.
TMR2 counts up to the PR2 value + 1, then resets and interrupts.
So you were only getting 64 counts. (62.5Khz)
For 200 counts, set PR2 to 199.
Last edited by Darrel Taylor; - 26th August 2011 at 05:13.
DT
Thanks guys.... PR2 of 199 does indeed get me a toggle frequency of 10khz (actually it's showing bouncing between 9.99khz & 10.0khz ....but that's likely to be a rounding/beating error to do with my scope).
Darrel thanks for solving the multicalc puzzle to ...thought I was going insane (I probably am anyway "Nurse, more medication quick").
You know I knew that, and as soon as I opened this this morning I thought "PR needs to be reload value -1", I bet thats what DT has posted. It still doesn't explain 9.93K, cuz the math if using 201 for the value (pr=200) works out to 9.95K. Thats where I was stumped.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks