14M RESET command

ciseco

Senior Member
Hi,

I've been looking through the manual and might have missed it but am looking for a command that is equivalent to the RESET command on the X1 parts. This is for the 14M.

Cheers

Miles
________
wiki vaporizer
 
Last edited:

westaust55

Moderator
From what I see in the PICAXE manuals, I concur that the RESET command for the non X1 parts is not supported.

Likely not implimented due to program memory constraints.

Likewise the 14M does not have a pin set up for hardware reset like the 18/20 parts and 28/40X1 parts. The 14M PIC chip has a pin capable of being used as a Master Clear/Reset but with the limited number of IO pins it is used as a simple Input.
 
Last edited:

hippy

Technical Support
Staff member
A simple test is to try it; in this case RESET gives a syntax error when compiled so it is not supported.

It's always possible to use GOTO to the start of a program although that cannot be done from within an interrupt and variables etc may have to be initialised.

There's a hardware 'soft reset' which can be usable in many circumstances with the 08, 08M, 14M and 20M and that is to pull the Serial In pin to +V. That works in cases where a download from the Programming Editor would work, but not when it won't, such as when waiting for SERIN or INFRAIN. It should be possible to connect a PICAXE output via a diode to Serial In; set that output High and it should reset the PICAXE, the reset clearing that output automatically. That High being the equivalent of RESET ...

Code:
                                 .---------.
Tx to PC   <---------------------| SO      |
                     ___         |         |
Rx from PC >---.----|___|---.--->| SI   Ox |---.
              .|.    22K    |    `---------'   |
              | |           |                  |
              |_| 10K       `--------|<|-------'
              _|_                  1N4148
 

ciseco

Senior Member
Hi Hippy,

I've just tried to send it back to init: and it appears to work just peachy. It's so the application can change it's own ID within eeprom and restart with it's new identity. If it proves not to work long term I'll have a bash with your circuit, many thanks for the reply.

Miles
________
vapir no2
 
Last edited:

Dave E

Senior Member
On another microcontroller platform, I have used a GOTO command to call an infinate loop of GOSUBs that caused the microcontroller to reset. I don't know if a PICAXE/PIC will work the same way.

code
code
IF i_want_to_reset THEN
GOSUB RESET_ROUTINE
ENDIF


RESET_ROUTINE:
GOSUB RESET_ROUTINE
RETURN

You might give it a try and see if it works.

Dave E
 

SD2100

New Member
I've been using this on 08M's with no problems, it resets the program counter and restarts the program instantly and clears all variables. Some don't like using it but it's a good quick and dirty reset when your running out of program space and don't have any spare outputs.... :D

Code:
 poke $0A,0
 poke $02,0
 

atharvai

Senior Member
I've been using this on 08M's with no problems, it resets the program counter and restarts the program instantly and clears all variables. Some don't like using it but it's a good quick and dirty reset when your running out of program space and don't have any spare outputs.... :D

Code:
 poke $0A,0
 poke $02,0
haha thats quite clever! never would have thought about the program counter! Need to brush up on some architecture and learn assembly!
 

hippy

Technical Support
Staff member
@ Dave E : That's a neat trick, but won't work on the PICAXE. It doesn't have a stack for Gosub/Return so there's never any stack overflow to cause a reset.

The PICAXE 'stack' is effectively a circular buffer which is why, if you Gosub too deep, no matter how many Returns, the program won't get back to where the first Gosub used was.

The advantage is that there's no need to worry about juming to the start of program even within Gosub routines, but Interrupt is an exception to that rule as internal flags don't get set correctly locking out future interrupts.
 

Dave E

Senior Member
Thanks Hippy.
Good lesson to learn for us expanding to other platforms. Not all micros work the same way.

Dave E
 
Top