karli
12-26-2009, 03:00 AM
··· Hi All,
··· It started out as a 1hr hardware project for a neighbor's kid, commonly called a
·· watchdog timer.· It took a 74hct74 FF and a LM556 dual-timer chip and a few other
·· minor parts, one push button, 2 NPNs and some R's and C's. with one push
·· I toggle the clock pin-3 of the FF; when the Q-pin-5 goes Hi; it enables pin 4
·· of the LM556 and also triggers a 30sec timer loop; after 30sec it resets
· pin 1 of the FF.··· ·BUT, if I push the button a 2nd time, Q-pin goes Lo
· and diables the timer - it pre-terminates (!)·the timing cycle in progress.
· Then I wanted to simulate this function on my Prop-Ed-Kit.
· I coded the waitcnt loop as :·· waitcnt(clkfreq * Delay + cnt)
· before the repeat loop starts I set· Delay := 30, for 30sec.
· But after waitcnt starts with that Delay value I have no control over it,
·such as, externally, redefining· Delay as· Delay := 1· for a quick timeout.
· Then I tried a decrement repeat loop:
· PUB Counter4··· 'watchdog timer ;· monitoring Runlogic == 1 (motor is active)
······················· 'Blink6: P7 Led Blinks at 1Hz while Runlogic == 0(motor is inactive)
····· repeat
········ if Runlogic == 1·· 'if motor turns in either DIR
··········· Delay := 30···· 'set delay for 30sec
··········· repeat until Delay =<1· 'to ensure loop doesn't go below 0
·············· Delay := Delay -1
·············· waitcnt(clkfreq + cnt)·· '1sec decrement steps
············································· 'when loop is done
··········· CCWlogic := 0·· 'stop motor if in CCW DIR
··········· CWlogic·· := 0·· 'stop motor if in CW DIR
······ Blink6
···· This works fine if I let the loop time out
···· I figured that I'd have more luck for··changing· Delay·· while the loop
···· was in progress,· to pre-terminate the·loop time,· ·but no luck.
··· Any ideas you "Pro Santas" out there· what Spin or ASSY code works
·· to simulate a Watchdog timer ?
·· Thanks,
·· karl i.
·
··· It started out as a 1hr hardware project for a neighbor's kid, commonly called a
·· watchdog timer.· It took a 74hct74 FF and a LM556 dual-timer chip and a few other
·· minor parts, one push button, 2 NPNs and some R's and C's. with one push
·· I toggle the clock pin-3 of the FF; when the Q-pin-5 goes Hi; it enables pin 4
·· of the LM556 and also triggers a 30sec timer loop; after 30sec it resets
· pin 1 of the FF.··· ·BUT, if I push the button a 2nd time, Q-pin goes Lo
· and diables the timer - it pre-terminates (!)·the timing cycle in progress.
· Then I wanted to simulate this function on my Prop-Ed-Kit.
· I coded the waitcnt loop as :·· waitcnt(clkfreq * Delay + cnt)
· before the repeat loop starts I set· Delay := 30, for 30sec.
· But after waitcnt starts with that Delay value I have no control over it,
·such as, externally, redefining· Delay as· Delay := 1· for a quick timeout.
· Then I tried a decrement repeat loop:
· PUB Counter4··· 'watchdog timer ;· monitoring Runlogic == 1 (motor is active)
······················· 'Blink6: P7 Led Blinks at 1Hz while Runlogic == 0(motor is inactive)
····· repeat
········ if Runlogic == 1·· 'if motor turns in either DIR
··········· Delay := 30···· 'set delay for 30sec
··········· repeat until Delay =<1· 'to ensure loop doesn't go below 0
·············· Delay := Delay -1
·············· waitcnt(clkfreq + cnt)·· '1sec decrement steps
············································· 'when loop is done
··········· CCWlogic := 0·· 'stop motor if in CCW DIR
··········· CWlogic·· := 0·· 'stop motor if in CW DIR
······ Blink6
···· This works fine if I let the loop time out
···· I figured that I'd have more luck for··changing· Delay·· while the loop
···· was in progress,· to pre-terminate the·loop time,· ·but no luck.
··· Any ideas you "Pro Santas" out there· what Spin or ASSY code works
·· to simulate a Watchdog timer ?
·· Thanks,
·· karl i.
·