First page Back Continue Last page Graphics
External Watch Dog Timer
- In websrv65_v310/src/mxwebsrvr.c
- Put this in TWO places:
- In the main() initialization section before the infinite while(1) loop
- In the interrupt HighISR() loop where it’ll be repeated 1200 times a second
- //-------------------------------------------------
- // Normal external watchdog timer state
- // Make RC0 = input & RC0 = 1
- //-------------------------------------------------
- TRISC = 0xff;
- LATC0 = 1;
- Everytime we process an ADC variable macro found on a fetched webpage, pull the line to the external watch dog timer
- In main initialization and 1200 Hz ISR routine, return the line to the external watch dog timer to idle state
- In websrv65_v310/src/cmd.c
- /////////////////////////////////////////////////
- //ADC variables
- else if (tagGroup == VARGROUP_ANALOG)
- {
- if (tagVal < 40)
- pGetTagInfo->ref = cmdGetWordVar(ref, pGetTagInfo->val, AdcValues[tagVal]);
- TRISC = 0; // set tickle line to output to external WDT
- LATC0 = 0; // set tickle line low to discharge external WDT
- return 1; //One byte was written
- }
- The instructions will permit the program to run without WDT reset only as long as it continues responding to webpages containing ADC macros on a periodic basis. If there is any lapse, the WDT will pull the reset line to the PIC.