How can I erase an instruction in the memory of a PIC when I remove the power?

0

The objective of my program is that when 5v is received on an "x" port, an instruction (assembler) is executed, for example MOVWF TRISA or some other instruction, but that the effect of said institution is erased when removing the PIC feeding.

What I have been trying but I think you can not, is to save an instruction in some RAM memory bank of the PIC, but the RAM is 12 bit wide and an instruction has 16 bit, so it could not be done in that way Probably another option is saving the instruction directly in the flash, but the problem would be, how to make it clear when you stop feeding the PIC, since unlike the ram, the flash is not volatile.

I know that you can erase memory locations from the flash but by software, that is, instructions, it actually comes in the data sheet, but the intention is to remove the power, so my other idea was some way to detect (I do not know if there is any instruction for that) when the PIC is "turned on", and at that moment execute.the erasing of a certain part of the flash memory.

I would appreciate any suggestions.

PIC18F4550

    
asked by esencia 03.11.2018 в 04:00
source

0 answers