CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Using a WDT
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Mon Apr 24, 2023 7:31 am     Reply with quote

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: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 25, 2023 5:23 am     Reply with quote

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: 19215

View user's profile Send private message

PostPosted: Tue Apr 25, 2023 10:40 am     Reply with quote

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: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 25, 2023 4:34 pm     Reply with quote

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: 1900

View user's profile Send private message

PostPosted: Tue Apr 25, 2023 7:34 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group