On a good day I am perhaps 10% as good as the regular and reliable people on this forum but I'll do my best...
A couple of things stand out to me as a little odd.
Code:
' FUSES DEFINE
DEFINE HS_OSC,WDT_OFF,PWRT_ON, BOD_OFF,LVP_OFF,CPD_OFF,WRT_HALF,DEBUG_OFF,PROTECT _OFF
Although this compiles I don't think it does anything. Presuming you're using PBP3, it would be something more like
Code:
#CONFIG
__config _CONFIG1, _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF ;etc
#ENDCONFIG
See Chapter 4.9 of the PBP3 manual.
Regarding
Code:
if TMR1H=0 & TMR1L=0 then
When reading a 16-bit timer you should get in the habit of reading the low byte first. And when writing to the timer, write the high byte first. Check the datasheet for why this is so.
On your schematic, MCLR should be pulled high through a 4.7K (or so) resistor instead of being connected directly to power.
To increase the count from TMR1 I think you might be able to use a pre-scaler, although there would be a loss of resolution. You could also get clever and figure out how many times the TMR1 interrupt flag would occur.
Hope this helps...
Best Regards,
Paul
Bookmarks