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 CCS Technical Support

PIC18F452 - built-in-test of WDT, interrupt dispatcher code

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



Joined: 21 Oct 2004
Posts: 1

View user's profile Send private message Send e-mail

PIC18F452 - built-in-test of WDT, interrupt dispatcher code
PostPosted: Thu Oct 21, 2004 9:27 pm     Reply with quote

Two questions that are probably easy for (one or more) someone(s) out there ...

1. Is the data memory (RAM, not EEPROM) all zeroed at processor reset ? I would like to implement built-in-test of the WDT's ability to reset to the processor by looking for a unique data pattern in memory at power-on (if it;s not there, I set it up and loop waiting for the WDT to reset me) ... but it seems as if the RAM is always cleared (0's) ... didn't see this in the PIC18F452 datasheet, but perhaps it's common across the PIC18xxx family ? I implemented the same function by looking to see if the WDT tripping was the reset source (don't recall which RCON bit I'm looking at - may be POR) , but the RAM pattern gives a more robust implementation.

2. Can anyone give any guidance on replacing the interrupt dispatch code and/or an annotation of the dispatch code generated by the compiler ? I would like to get to the point where I have the bare minimum of compiler-generated code, for my IR+D project.

Thanks in advance for any help,

Chris Karis
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Oct 21, 2004 9:35 pm     Reply with quote

To answer your second question:

Quote:
#INT_GLOBAL


Syntax:
#int_global



Elements:
None



Purpose:
This directive causes the following function to replace the compiler interrupt dispatcher. The function is normally not required and should be used with great caution. When used, the compiler does not generate start-up code or clean-up code, and does not save the registers.



Examples:
#int_global

isr() { // Will be located at location 4

#asm

bsf isr_flag

retfie

#endasm

}

asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: PIC18F452 - built-in-test of WDT, interrupt dispatcher c
PostPosted: Thu Oct 21, 2004 9:42 pm     Reply with quote

Chris Karis wrote:
Two questions that are probably easy for (one or more) someone(s) out there ...

1. ... but it seems as if the RAM is always cleared (0's) ... didn't see this in the PIC18F452 datasheet, but perhaps it's common across the PIC18xxx family ? I implemented the same function by looking to see if the WDT tripping was the reset source (don't recall which RCON bit I'm looking at - may be POR) , but the RAM pattern gives a more robust implementation.


No this is not the correct behaviour of this processor. It does not clear memory on reset or even power on reset. I know this from first hand experience...
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Re: PIC18F452 - built-in-test of WDT, interrupt dispatcher c
PostPosted: Thu Oct 21, 2004 10:17 pm     Reply with quote

asmallri wrote:
Chris Karis wrote:
Two questions that are probably easy for (one or more) someone(s) out there ...

1. ... but it seems as if the RAM is always cleared (0's) ... didn't see this in the PIC18F452 datasheet, but perhaps it's common across the PIC18xxx family ? I implemented the same function by looking to see if the WDT tripping was the reset source (don't recall which RCON bit I'm looking at - may be POR) , but the RAM pattern gives a more robust implementation.


No this is not the correct behaviour of this processor. It does not clear memory on reset or even power on reset. I know this from first hand experience...


If you want to play it safe take a look at the #zero_ram directive.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 22, 2004 12:19 pm     Reply with quote

Quote:

2. Can anyone give any guidance on replacing the interrupt dispatch
code and/or an annotation of the dispatch code generated by the
compiler ? I would like to get to the point where I have the bare
minimum of compiler-generated code, for my IR+D project.


See the CCS example file, EX_GLINT.C, which is in
this folder: c:\Program Files\Picc\Examples

Here are some links. Not all of them are exactly
pertaining to your question (ie., they might be about
16-series PICs, instead of 18-series), but they will help.
http://www.ccsinfo.com/forum/viewtopic.php?t=7306
http://www.pic-c.com/forum/old/messages/470.html
http://www.ccsinfo.com/forum/viewtopic.php?t=19498
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