Software reset PIC
Posted: Sun Apr 28, 2013 9:35 pm
Hello,
I'm using a PIC16F819 in a small project and I need to reset the PIC via the software.
I will explain:
I use the EEprom of the PIC and I a special case I need to clear the EEprom and make the PIC start the whole program from start (so all variables may be cleared).
At this point I "kinda" clear the EEprom by writing 255 via a loop from address 0 to 255. This looks good.
But after this the PIC should start from scratch at the point where it starts after a reset (or after the a power up).
I found two software resets:
asm("reset");
and
GOTO 0x000
Is there a better way of doing this?
It's not a problem that all variables are cleared, and even no problem if the whole EEprom gets wiped.
All help is welcome!
I'm using a PIC16F819 in a small project and I need to reset the PIC via the software.
I will explain:
I use the EEprom of the PIC and I a special case I need to clear the EEprom and make the PIC start the whole program from start (so all variables may be cleared).
At this point I "kinda" clear the EEprom by writing 255 via a loop from address 0 to 255. This looks good.
But after this the PIC should start from scratch at the point where it starts after a reset (or after the a power up).
I found two software resets:
asm("reset");
and
GOTO 0x000
Is there a better way of doing this?
It's not a problem that all variables are cleared, and even no problem if the whole EEprom gets wiped.
All help is welcome!