View previous topic :: View next topic |
Author |
Message |
art
Joined: 21 May 2015 Posts: 181
|
Reset PIC Method |
Posted: Sun Jul 14, 2019 8:09 am |
|
|
Hi,
I would like to know is there is any method to reset PIC by coding ?
Normally people will connect MCLR pin of PIC to ground.
Hope someone can share their ideas or codes.
Thank you |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sun Jul 14, 2019 8:51 am |
|
|
I don't know which PIC you're using.
The PIC manual shows a software reset instruction for PIC18(L)F2X/4XK22 type chips, and presumably most others.
There SHOULD be something similar in the CCS manual.
If not use the machine code instruction in assembler.
Mike
PS I found it. The CCS version seems to be reset_cpu(). |
|
|
art
Joined: 21 May 2015 Posts: 181
|
|
Posted: Mon Jul 15, 2019 6:00 am |
|
|
Thank you mike,
I'm using pic18f4550. I really hope reset_cpu() works. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19518
|
|
Posted: Mon Jul 15, 2019 6:50 am |
|
|
reset_cpu, issues the processor's own reset instruction.
Understand that this gives a different code from 'restart_cause', than
a power on reset (POR).
It also boots quicker than a POR, not giving any oscillator delay (since this
is already running).
Some bits are left unchanged by the reset instruction. For instance
STKFUL and STKUNF are both 'unchanged' by this reset, but are clear
after a POR. Look at the table entitled:
STATUS BITS, THEIR SIGNIFICANCE AND THE INITIALIZATION CONDITION
FOR RCON REGISTER
in the data sheet. This and the next table detail what is reset and what is left
unchanged. |
|
|
|