humphpicaxe
New Member
Dear All,
Tried to use code similar to the snippet for 18x to detect whether a reset was due to reset or power down. The equivalent bit to the one described for the 18x is POR in register RCON, ie bit 1 of FD0h. However, contrary to picaxe 20x2/ microchip's 18F1XK22 spec sheet, that bit does not go to zero after a power down. I looked through the registers to find something that does change from assigned state to 0 after a power down, and found register T3CON. If you are not controlling timer 3 you can write ones to this register which are only set to zeroes after a power down. Thus, the code equivalent to the 18x is:
peeksfr $B1,b0 ' this location is called T3CON, and is 0 at powerup, unchanged after reset
if b0=1 then goto codeafterreset
codeafterpowerup:
sertxd (#b0,10,13)
pokesfr $B1,1
'insert other code afterpowerup here
codeafterreset:
Tried to use code similar to the snippet for 18x to detect whether a reset was due to reset or power down. The equivalent bit to the one described for the 18x is POR in register RCON, ie bit 1 of FD0h. However, contrary to picaxe 20x2/ microchip's 18F1XK22 spec sheet, that bit does not go to zero after a power down. I looked through the registers to find something that does change from assigned state to 0 after a power down, and found register T3CON. If you are not controlling timer 3 you can write ones to this register which are only set to zeroes after a power down. Thus, the code equivalent to the 18x is:
peeksfr $B1,b0 ' this location is called T3CON, and is 0 at powerup, unchanged after reset
if b0=1 then goto codeafterreset
codeafterpowerup:
sertxd (#b0,10,13)
pokesfr $B1,1
'insert other code afterpowerup here
codeafterreset: