Mel,
Your Olympic timer program is a piece of work. Wow. The example has given me a pretty good start with timer operation.
I was wanting to use the PIC's TMR1 resource to do two things.
1. Act as "a timer" as in the Olympic Timer Demo to set a FLAG after 5 mins
2. Simulate a program PAUSE (say 3 seconds)
I gather from your program description that instructions can NOT take longer thatn 10ms, otherwise my 5 min timer will in (1) will not be accurate. (Hence cant use a simple PAUSE command)
I have attached code that I think should work (but doesn't) and was wondering if you could help me out.
This is the main difference:
DELAY VAR BYTE
TIME_END VAR BYTE
TIME_START VAR BYTE
Begin:
DELAY = 3 ' CREATE A THREE SECOND DELAY
TIME_START = SECONDS ' SAVE CURRENT TIME
GOSUB KILLTIME ' GO WAIT FOR THE DELAY
TOGGLE PORTB.0 ' DELAY FINISHED NOW TOGGLE LED
goto begin ' DO IT ALL OVER AGAIN
DISABLE
KILLTIME: ' KEEP DOING THIS ROUTINe UNTIL delay time reached
TIME_END = SECONDS-TIME_START ' MINUS START TIME EQUALS THE CHOSEN DELAY
IF TIME_END > DELAY THEN RETURN
GOTO KILLTIME




Bookmarks