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_cpu() in int_rda service routine

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








reset_cpu() in int_rda service routine
PostPosted: Wed Mar 01, 2006 4:14 pm     Reply with quote

I thought PIC16F628A has a MCLR instruction set . . . well, it does not, but can I call reset_cpu() in RDA servicie routine?

I know stack will be left intact and possibly a harzard, but as PCM Programmer pointed in various thread, the stack is circular, so no problem . . . but are there any other issues?

Thanks in advance.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

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

Re: reset_cpu() in int_rda service routine
PostPosted: Wed Mar 01, 2006 4:29 pm     Reply with quote

Anonymous wrote:
but can I call reset_cpu() in RDA servicie routine?

I'm not a big fan of microcontroller suicides, so I'm just guessing and I have never tried this myself. You could set up and strobe a watchdog timer (WDT, if your PIC has one). In the ISR you would make a long delay without strobing the WDT. WDT would reset the PIC.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 01, 2006 4:33 pm     Reply with quote

I am wondering if you really have to structure your program in this way ?

Why do you believe that you have to re-start program execution from
the reset vector (address 0x0000) if you receive a 0xFF byte ?

Why not just instead, perhaps go to the start of a while() loop ?
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Mar 01, 2006 4:36 pm     Reply with quote

Quote:

it does not, but can I call reset_cpu() in RDA servicie routine?


I would like to know the reason to do that.
I am convinced that it must have several elegant and much safe solutions.

Humberto
asmallri



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

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

PostPosted: Wed Mar 01, 2006 5:33 pm     Reply with quote

I have done this previously. I did have one verison of the PCH compiler that had a bug (not sure of the versions 3.229?) that required two reset_cpu() instructions one after the other to work. My code was inside a case statement and the time and the compiler incorrectly branched past the first instruction.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Guest








PostPosted: Wed Mar 01, 2006 8:02 pm     Reply with quote

Kender, that is so funny.

Well, WDT works fine but a long delay? in milliseconds? No, I'd rather commit suicide :-)
Guest








PostPosted: Wed Mar 01, 2006 8:06 pm     Reply with quote

PCM programmer, well, I want my core code to execute without any interrupts when delay_xx() is called but want to break that tight loop, so a reset_cpu() or MCLR would be fine.

As you said, maybe I should invest some time to do my own delay routines, I did it using another compiler that does not have a lot of builtin functions but failed at accuracy. So I bought this compiler . . .
Guest








PostPosted: Wed Mar 01, 2006 10:25 pm     Reply with quote

Humberto, the reason is, I am too lazy to figure out my own PRECISE delay function.
Guest








PostPosted: Wed Mar 01, 2006 10:25 pm     Reply with quote

asmallri, thanx.
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