1. Arm yourself with the PICs Datasheet.
2. Have a look at Section 5 - Timer1 Module
3. Have a look at section 5-1 T1CON... see if you can figure why I would set it to...
T1CON=%00000001
4. Find TMR1H, TMR1L anf PIR1... see why I would load them thus...
TMR1H=$E0
TMR1L=$00
PIR1.0=0
5. Read section 5.6 it might interest you...
6. Have a look at Bit 0 of PIR1 (Datasheet 2-5) what would this piece of code do?...
While PIR.0=0:Wend
Answers to these questions will qualify you as a Timer1 expert, and gain you the appropriate shoulder badge...
Very brief example (assuming your 32kHz clock)...
*smiles*Code:LED var GPIO.0 TRISIO=%00000000 T1CON=%00000001 Loop: TMR1H=$E0 TMR1L=$00 PIR1.0=0 Toggle LED While PIR1.0=0:Wend Goto Loop End
Next step will be the Interrupt Navigators badge.... however, I think I've mentioned before that interrupts on a 12 series PIC are a bit limited...




Bookmarks