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

Reset_cause() return value 3Dh and 35h

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



Joined: 02 Feb 2012
Posts: 4

View user's profile Send private message

Reset_cause() return value 3Dh and 35h
PostPosted: Thu Feb 02, 2012 2:20 pm     Reply with quote

Hi

I am using a PIC16F1938. I am having problems with unknown resets.
I added the Reset_cause() function and are getting unknown codes.
3Dh and 35h that is not listed in the header file.

Does anyone know what the meaning of these codes are?

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 2:25 pm     Reply with quote

The restart_cause() function must be the first thing you call at the start
of main(). It should be placed just after the variable declarations in main().
Is that how you did it ?

Also, what is your compiler version ?
ahc



Joined: 02 Feb 2012
Posts: 4

View user's profile Send private message

PostPosted: Thu Feb 02, 2012 2:44 pm     Reply with quote

It is the second command if the setup statements are excluded.
If I do a power cycle then I get the correct command back.
I will move the reset_cause() to be the first command to see if it makes a difference in the code received.
Will only be possible to post answer tomorrow at earliest

I am using the ver 4.120

Thanks for reply
ahc



Joined: 02 Feb 2012
Posts: 4

View user's profile Send private message

PostPosted: Mon Feb 06, 2012 2:04 pm     Reply with quote

I have moved the reset_cause() statement to be the first command in Main(). Still get a lot of 3Dh values as answer.
Did make a change on the MCLR pin to improve the pullup and added some capacitance to GND. Made some improvement to the reset problem but did not solve it completely.
Ttelmah



Joined: 11 Mar 2010
Posts: 19236

View user's profile Send private message

PostPosted: Mon Feb 06, 2012 3:50 pm     Reply with quote

Are you sure you are using the header from the same compiler?.
0x3D, is a perfectly legal code, and listed in the headers after about V4.110. It is the code for a normal power on reset....
It should be in the 4.120 header.
Your behaviour has all the symptoms of having done a compiler upgrade, and not changed the project to use the new header files.

Best Wishes
ahc



Joined: 02 Feb 2012
Posts: 4

View user's profile Send private message

PostPosted: Tue Feb 07, 2012 1:43 pm     Reply with quote

I have had a look. The header files that I have does not include 3D but does include more than what was in the previous version files.
The latest files that was part of the 4.120 installation only contains the following for the PIC16F1938
Code:
 ////////////////////////////////////////////////////////////////// Control
// Control Functions:  RESET_CPU(), SLEEP(), RESTART_CAUSE()
// Constants returned from RESTART_CAUSE() are:
#define NORMAL_POWER_UP      0x3C
#define BROWNOUT_RESTART     0x3E
#define MCLR_FROM_SLEEP      0x27
#define WDT_TIMEOUT          0x1F
#define WDT_FROM_SLEEP       0x0F
#define INTERRUPT_FROM_SLEEP 0x2F
#define MCLR_FROM_RUN        0x37
#define RESET_INSTRUCTION    0x3B
#define STACK_OVERFLOW       0xBF
#define STACK_UNDERFLOW      0x7F


If the answer for 3D is that it is from a normal start then I have some fault finding to do. Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 07, 2012 1:46 pm     Reply with quote

This post has links regarding random resets:
http://www.ccsinfo.com/forum/viewtopic.php?t=27638&start=4
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