View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Apr 24, 2023 7:31 am |
|
|
Either have your variables as global, without an initialisation value, or
local to the main, again without an initialisation. Not static (these are
initialised to zero even if no value is given).
Then have at the start:
Code: |
//at the start of main
value = restart_cause();
//The actual reading of this must be close to the start of main.
//Otherwise some operations will change the value read.
if (value != WDT_TIMEOUT)
{
//here initialise your variables
}
|
You haven't answered whether brownout is enabled?. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Tue Apr 25, 2023 5:23 am |
|
|
re:
Quote: | Our board currently uses 12 SSRs to control parts. However, this board is not our control board which is receiving the transients. |
If powering AC (mains) power, use zero cross SSRs to minimize EMI.
Is the 'control board' in a steel box ?
Is the PIC power 'quiet' and 'suppressed' ?
To locate where the program 'hangs', send a message to a PC terminal program at the beginning of each function or subroutine. You'll KNOW where it 'hangs'.
No amount of software will fix an EMI hardware problem ! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Tue Apr 25, 2023 10:40 am |
|
|
You need to understand a critical thing. The watchdog _resets the chip_.
All of the I/O pins switch to being inputs when this happens. So if it is
switching a particular drive 'on', that causes the lockup, then this will be
turned off by the restart. Result you will have to turn it on again after
the chip resets, and the whole cycle will repeat.
As Jay says, you cannot recover from a hardware problem like this with
software. You have to fix the actual problem. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Tue Apr 25, 2023 4:34 pm |
|
|
Ideally you'd have a HW WDT that automatically shuts down the pump and heaters in case the PIC program 'freezes'. This is a 'fail safe' feature that's kinda important ! |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Tue Apr 25, 2023 7:34 pm |
|
|
temtronic wrote: | Ideally you'd have a HW WDT that automatically shuts down the pump and heaters in case the PIC program 'freezes'. This is a 'fail safe' feature that's kinda important ! |
Especially the heaters. |
|
|
|