Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Issue successfully resolved

???
07/21/04 07:33
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#74535 - RE: WD in lengthy functions
Responding to: ???'s previous message
hi,

now I say a thing which may look terrible but please read all before claim my carma (=

Indeed, some my projects have deep subroutines which take a lot of time to be done. Fortunatelly, they are called from main cycle time to time; but when one of them is entered, it takes long time before program returns to main().
From other side I like watchdog and I always use it. To reset watchdog counter I need do some steps: disable all interrupts, write 0x1E then 0xE1 into watchdog SFR then re-enable interrupts.
Well, first time I have creating a macro and then inserted it in main() and inside of those "long-time" subroutines.

After some time I switched to another way (and now the time you kick me =)
I moved this piece of code inside a timer ISR which executes often enough to reset watchdog counter before it resets program (here I use PCA counter overflow interrupt).
I know, I know, you say:
     !!! DO NOT PUT WATCHDOG RESET CODE INTO TIMER ISR !!!
.I have read it in many books, yes. But look here:
; flag allocation
FLAGS_MISC	DATA	0x2D
FLG_WATCHDOG	BIT	FLAGS_MISC.7	; reset counter request flag
; ...

; somewhere inside ISR of PCA (counter overflow condition):
INT_PCA_OVER:
; check if watchdog counter reset is required somewhere
	JNB	FLG_WATCHDOG,INT_PCA_WATCHDOG_END
	CLR	EA
	MOV	WDTRST,#0x1E	; reset watchdog counter
	MOV	WDTRST,#0xE1
	CLR	FLG_WATCHDOG    ; clear request flag
	SETB	EA
INT_PCA_WATCHDOG_END:
; ...

; somewhere inside main() and inside each "long-time" subroutines:
;
	SETB	FLG_WATCHDOG    ; pending request
;
As you can see, PCA timer ISR does not reset watchdog timer at each execution undoubtedly. Instead, it checks is a part of program requests for such task. And if some part of code has set request flag then watchdog timer been reset only.

Regards,
Oleg

List of 55 messages in thread
TopicAuthorDate
WD in lengthy functions            01/01/70 00:00      
   RE: WD in lengthy functions            01/01/70 00:00      
      RE: WD in lengthy functions            01/01/70 00:00      
         Watchdogs in general            01/01/70 00:00      
            RE: Watchdogs in general            01/01/70 00:00      
               RE: Watchdogs in general            01/01/70 00:00      
                  RE: Watchdogs in general            01/01/70 00:00      
                     RE: Watchdogs in general            01/01/70 00:00      
                  RE: Watchdogs in general            01/01/70 00:00      
                     RE: Watchdogs in general            01/01/70 00:00      
                        RE: Watchdogs in general            01/01/70 00:00      
                           RE: Watchdogs in general            01/01/70 00:00      
            RE: Watchdogs in general            01/01/70 00:00      
               RE: Watchdogs in general            01/01/70 00:00      
         RE: WD in lengthy functions            01/01/70 00:00      
      RE: WD in lengthy functions            01/01/70 00:00      
         RE: WD in lengthy functions            01/01/70 00:00      
            RE: WD in lengthy functions            01/01/70 00:00      
               RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
                     RE: WD in lengthy functions            01/01/70 00:00      
                        RE: WD in lengthy functions            01/01/70 00:00      
                           RE: WD in lengthy functions            01/01/70 00:00      
                              RE: WD in lengthy functions            01/01/70 00:00      
               RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
                     RE: WD in lengthy functions            01/01/70 00:00      
         RE: WD in lengthy functions            01/01/70 00:00      
      RE: WD in lengthy functions            01/01/70 00:00      
         RE: infinite loop error trapping            01/01/70 00:00      
            RE: infinite loop error trapping            01/01/70 00:00      
               RE: infinite loop error trapping            01/01/70 00:00      
                  RE: infinite loop error trapping            01/01/70 00:00      
                     RE: infinite loop error trapping            01/01/70 00:00      
         RE: WD in lengthy functions            01/01/70 00:00      
            RE: WD in lengthy functions            01/01/70 00:00      
               RE: adding a detail            01/01/70 00:00      
            RE: WD in lengthy functions            01/01/70 00:00      
               RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
      RE: WD in lengthy functions            01/01/70 00:00      
         RE: WD in lengthy functions            01/01/70 00:00      
            RE: WD in lengthy functions            01/01/70 00:00      
               RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
                     RE: WD in lengthy functions            01/01/70 00:00      
                        RE: WD in lengthy functions            01/01/70 00:00      
                           RE: WD in lengthy functions            01/01/70 00:00      
               RE: WD in lengthy functions            01/01/70 00:00      
                  RE: WD in lengthy functions            01/01/70 00:00      
                     RE: WD in lengthy functions            01/01/70 00:00      
                        RE: WD in lengthy functions            01/01/70 00:00      
                           RE: WD in lengthy functions            01/01/70 00:00      
   RE: WD in lengthy functions            01/01/70 00:00      

Back to Subject List