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

Warm boot vs cold boot

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ringo



Joined: 10 Feb 2004
Posts: 8

View user's profile Send private message

Warm boot vs cold boot
PostPosted: Tue Feb 10, 2004 2:45 pm     Reply with quote

Is there a way to tell on program startup if it is a warm boot or a cold boot. In other words can you tell if you just powered up the circuit or if the watchdog timer has casued a reboot?
I'm using a 16f877 if it matters.
Thanks
Ringo
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Tue Feb 10, 2004 2:56 pm     Reply with quote

Quote:
RESTART_CAUSE()
Syntax:
value = restart_cause()
Parameters:
None
Returns:
A value indicating the cause of the last processor reset. The actual values are device dependent. See the device .h file for specific values for a specific device. Some example values are: WDT_FROM_SLEEP, WDT_TIMEOUT, MCLR_FROM_SLEEP and NORMAL_POWER_UP.
Function:
This is a general purpose device reset. It will jump to location 0 on PCB and PCM parts and also reset the registers to power-up state on the PIC18XXX.
Availability:
All devices
Requires
Constants are defined in the devices .h file.
Examples:
switch ( restart_cause() ) {
case WDT_FROM_SLEEP:
case WDT_TIMEOUT:
handle_error();
}
Example Files:
ex_wdt.c
Also See:
restart_wdt(), reset_cpu()
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Feb 10, 2004 3:24 pm     Reply with quote

Restart_Cause() does not cause a restart, as Newtone's message implies. It is put near the beginning of main() to determine what the cause of the last restart was.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Tue Feb 10, 2004 3:57 pm     Reply with quote

My mistake I ripped that from the manual without reading it first.
ringo



Joined: 10 Feb 2004
Posts: 8

View user's profile Send private message

PostPosted: Wed Feb 11, 2004 8:35 am     Reply with quote

Thanks, That's excactly what I need. I didn't know that function existed.
Ringo
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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