PicAxe 14M resetting

markdil

New Member
I have push buttons wired to the inputs of the 14M. The inputs are tied to +5VDC through a 10K resistor. When the button is pushed, it grounds the input taking the pin low.

On the "In 3" input (pin4), sometimes, just touching the the lead hooked to the button
makes the PixAxe reset. This does NOT happen with any of the other inputs. I am
positive the circuit is reseting because altered the code to output a sound when the
circuit reset, (just for testing purposes).

Any ideas? How can I stop this. And, why does it just happen on input 3 and none
of the other inputs as they are all wired the same.

I also tried changing the 10K resistor to a 1K resistor and it did not help.

Thanks,

Mark
 

hippy

Ex-Staff (retired)
Even if your body were acting as an aerial it shouldn't be enough to force the 14M to reset. I suspect there is something else not quite right with the circuit; do you have the Serial In download interface wired up correctly ?
 

markdil

New Member
Even if your body were acting as an aerial it shouldn't be enough to force the 14M to reset. I suspect there is something else not quite right with the circuit; do you have the Serial In download interface wired up correctly ?
Yes, I have the serial download wired up correctly. It is the weirdest thing I have ever
seen.
 

slurp

Senior Member
On the "In 3" input (pin4), sometimes, just touching the the lead hooked to the button
makes the PixAxe reset. This does NOT happen with any of the other inputs. I am
positive the circuit is reseting because altered the code to output a sound when the
circuit reset, (just for testing purposes).
Sounds like a short circuit to me, is this breadboarded or soldered?
What type of button switch do you have?

If it's one of those four pin, single pole, push to make - have you got it wire the right way round? They can be tricky to keep connected on a bread board too!

Photo's of the offending circuit might help...

regards,
colin
 

markdil

New Member
Sounds like a short circuit to me, is this breadboarded or soldered?
What type of button switch do you have?

If it's one of those four pin, single pole, push to make - have you got it wire the right way round? They can be tricky to keep connected on a bread board too!

Photo's of the offending circuit might help...

regards,
colin
Hi Colin, it is a complete circuit board, not breadboard. All connections are perfect.

Mark
 

eclectic

Moderator
Which
"complete circuit board"?

And, can you provide both of the programs?

And again, a photograph really would help.

e
 

MartinM57

Moderator
With all connections allegedly perfect and not being able to see the mimimalistic code that shows the problem...I don't think anyone's crystal ball is good enough tonight...
 

markdil

New Member
With all connections allegedly perfect and not being able to see the mimimalistic code that shows the problem...I don't think anyone's crystal ball is good enough tonight...
Here is the program. I will take a picture tomorrow. Thanks, Mark



'input pin0 park
'input pin1 reverse
'input pin2 neutral
'input pin4 D1 and D2

'output pin1 park
'output pin2 reverse
'output pin3 neutral
'output pin4 D2
'output pin5 D1

SYMBOL debounce_time=600 'set switch debounce time
pause 200 'pause 0.2 of a second
b0=0 'keep track of D1 and D2
gosub all_off 'make sure ALL relays are off
high 1 'start in the park position

main: 'scan all the switches

if pin0=0 then goto park_pos 'park
if pin1=0 then goto reverse_pos 'reverse
if pin2=0 then goto neutral_pos 'neutral
if pin4=0 then goto drive1_pos 'drive
goto main

end 'stop program just in case

park_pos: 'PARK

if pin3=0 then main 'check to see if motion sensor is on
gosub all_off 'turn all relays off
high 1
hold0:
if pin0=0 then hold0
pause debounce_time
b0=0
goto main

reverse_pos: 'REVERSE

if pin3=0 then main 'check to see if motion sensor is on
gosub all_off 'turn all relays off
high 2
hold1:
if pin1=0 then hold1
pause debounce_time
b0=0
goto main

neutral_pos: 'NEUTRAL

gosub all_off 'turn all relays off
high 3
hold2:
if pin2=0 then hold2
pause debounce_time
b0=0
goto main

drive1_pos: 'D1

if b0=1 then drive2_pos 'turn all relays off
gosub all_off
high 5
hold4_1:
if pin4=0 then hold4_1
pause debounce_time
b0=1
goto main

drive2_pos: 'D2

gosub all_off 'turn all relays off
high 4
hold4_2:
if pin4=0 then hold4_2
pause debounce_time
b0=0
goto main

all_off: 'this subroutine turns off all relays

low 1
low 2
low 3
low 4
low 5
return
 

markdil

New Member
Can you try with a different 14M? THe code looks fine - I suspect it is a hardware/ciruit issue.

A
I did that. I have tried everything. Very, very frustrating.

I have worked with these for years along with Basic Stamps, etc, and never had this
happen.

I do not believe it is the code, because even if I force and "end" of program, it still will
reset.

Thanks,

Mark
 

MartinM57

Moderator
Code eyeballs fine to me too.

This obviously isn't the code that makes a sound when the PICAXE resets - was that materially different?

If you delete all the code except for that needed for pin4 processing, does it reset then?
 

MartinM57

Moderator
i.e.
Code:
'input pin4 D1 and D2

'output pin4 D2
'output pin5 D1

SYMBOL debounce_time=600 'set switch debounce time
pause 200                'pause 0.2 of a second
b0=0                     'keep track of D1 and D2
gosub all_off           'make sure ALL relays are off
high 1                     'start in the park position

main: 'scan all the switches
if pin4=0 then goto drive1_pos 'drive
goto main

end 'stop program just in case

drive1_pos: 'D1

if b0=1 then drive2_pos 'turn all relays off
gosub all_off
high 5
hold4_1:
if pin4=0 then hold4_1
pause debounce_time
b0=1
goto main

drive2_pos: 'D2

gosub all_off 'turn all relays off
high 4
hold4_2:
if pin4=0 then hold4_2
pause debounce_time
b0=0
goto main

all_off: 'this subroutine turns off all relays

low 1
low 2
low 3
low 4
low 5
return
 

markdil

New Member
Code eyeballs fine to me too.

This obviously isn't the code that makes a sound when the PICAXE resets - was that materially different?

If you delete all the code except for that needed for pin4 processing, does it reset then?
I haven't tried that. I inserted "end" and long "pauses" and it does reset when I touch
the input wire which is hooked to the button. It does not do it every time, but it should not do it at all. All the other inputs are fine and there are no issues.

Mark
 

hippy

Ex-Staff (retired)
Make sure you put any reset indicating code before the 'main:' label. I cannot see any reason the code is resetting but it would be worth trying the following and observing the result using the Programming Editor Terminal while touching the Pin 3 line -

#Picaxe 14M
#Terminal 4800
SerTxd( "RESET" )
Do : Loop
 

mymps3

New Member
Checked the resistor values??? You might have one wrong? Also check for hairline breaks in your circuit board. I made a PCB but it had a few tracks that were a bit suspect but you could not see them with the human eye!
 

Andrew Cowan

Senior Member
I think that that is the problem. What is the power supply - do you have a 100uF and a 100nF capacitor close to the power pins? I would imagine that when you touch the wire/move the board, power is lost briefly, thus the chip resets. Is it in an electrically noisy environment?

A
 

Dippy

Moderator
Inaddition to above suggestions..
Have you checked the PSU and all connections right back to PICAXE with a multimeter?
i.e. double-checked all resistor connections to PICAXE pins. Bad/dry joints happen to everyone regardless of many hundreds of years experience :)
Decoupling the PICAXE +V/ 0V is always a good default idea as suggested by Andrew.

What happens if you tie Input 3 (pin 4) down to ground via, for example, a 150R resistor?
I mean, tie it down, and try and run the programme without references to Input 3.
I'm clutching at straws here but pin4 is the MCLR pin on the base PIC. It may just be coincidental of course.
 

markdil

New Member
Inaddition to above suggestions..
Have you checked the PSU and all connections right back to PICAXE with a multimeter?
i.e. double-checked all resistor connections to PICAXE pins. Bad/dry joints happen to everyone regardless of many hundreds of years experience :)
Decoupling the PICAXE +V/ 0V is always a good default idea as suggested by Andrew.

What happens if you tie Input 3 (pin 4) down to ground via, for example, a 150R resistor?
I mean, tie it down, and try and run the programme without references to Input 3.
I'm clutching at straws here but pin4 is the MCLR pin on the base PIC. It may just be coincidental of course.
You guys are going to think I have lost my mind, but here
is what I have come up with. I think the problem has
something to do with the Infrain. On both the 08M and
14M I can get the chips to reset by touching that input
pin. Of course the input pin is tied to +5VDC via a 10K
resistor (even a 1K will not stop it).

I am using a 12VDC battery, with a 5 volt regulator. I do
have the capacitors on both sides of the regulator and
a decoupling one as well.

Here is how you can duplicate what I am seeing and I really
can not explain why as I do not know how the inter-workings of
the PIC.

Simply touch the +12 volt DC terminal with your finger, then take
a screwdriver, or any metal object in the other hand
and touch the Infrain pin with that metal object (or any wire
that is tied to it, or the switch it is hooked to). The circuit
will reset EVERY time.

Without touching the +12 volt DC terminal or not using a metal
object and just touching it with your finger, it will reset
ever once and a while.

None of the other input pins do this.

Try it and see for yourselves.

I fixed the problem by tying the pin to ground through a 1K resistor
and taking it high to change the state. Problem solved.
 

BeanieBots

Moderator
I didn't see any reference to 'infrain' within your code so cannot see how it could be relevant.

However, your symbols imply this is fitted in a car:eek:
Is it? (that would explain a lot!).
 

Andrew Cowan

Senior Member
I aslo missed the'infrain'. Manual 2 (under the INFRAIN command) has the circuit for wiring up the IR receiver. There should be a 4K7 pullup resistor on the line between the data line and the input. Did you forget to include this? If so, there's your problem - the 4K7 is needed for it to work. 1K will probably work as well, but a 4K7 is better.

A
 

markdil

New Member
I aslo missed the'infrain'. Manual 2 (under the INFRAIN command) has the circuit for wiring up the IR receiver. There should be a 4K7 pullup resistor on the line between the data line and the input. Did you forget to include this? If so, there's your problem - the 4K7 is needed for it to work. 1K will probably work as well, but a 4K7 is better.

A
I am NOT using the INFRAIN. I am using that pin as an input. Those pins cause unwanted
resets when tied to 5+ VDC with a 10K or even a 1K resistor.
 

BeanieBots

Moderator
but is this circuit in a car or 'on the bench'?
Does fitting a diode between input pin and supply rail (pointy end to supply rail) fix the problem?
 

hippy

Ex-Staff (retired)
I think by "infrain pin" Mark means Pin 3 / Leg 4 not that there's an IR receiver connected.

No matter how hard I try, with a completely floating pin 3 I cannot get my 14M to reset.

It seems like there's something peculiar with the hardware ( floating 0V ? ) or perhaps the PICAXE has been damaged during experimentation.
 

BeanieBots

Moderator
As pointed out by Dippy, pin 4 is also MCLR but this might be coincidental.
Also, input 3 (on an 08M) is the only input without internal clamping. Again might be coincidental.

A few questions.
Is it REALLY resetting or just not working as expected?
Does a voltage greater than Vcc (or lower than 0v) on input 3 cause a reset?
Is this either in an automotive environment or right underneath a flouroscent lamp?

Has a minimalist code been used to PROVE that a reset is happening?
 

hippy

Ex-Staff (retired)
@ Mark : The code seems to be some gear selector system and includes the words which could be a clue; "make sure ALL relays are off" ... I think it would be best to describe what you have in entirety, what it's installed in, exactly how it's powered and connected, how you have interfaced the relays, and provide a circuit diagram and photograph if you can.
 

markdil

New Member
As pointed out by Dippy, pin 4 is also MCLR but this might be coincidental.
Also, input 3 (on an 08M) is the only input without internal clamping. Again might be coincidental.

A few questions.
Is it REALLY resetting or just not working as expected?
Does a voltage greater than Vcc (or lower than 0v) on input 3 cause a reset?
Is this either in an automotive environment or right underneath a flouroscent lamp?

Has a minimalist code been used to PROVE that a reset is happening?
Yes, the pic is resetting. I put a piece of code in the startup to flash and LED so I knew
the unit rebooted. I am testing it on the bench. I have tried MANY pic parts.

To get the pic to reset, use a 12 volt battery (of course use a regulator). Touch the 12 volt
positive terminal with a finger. Then, with the other hand grap the metal end of a screwdriver and touch pin 4, which is (In 3) on the 14M. The pic will reset. I spent half the night trying
to figure this out. I am just about ready to hang myself!!

It just happens on that pin, all the other pins are fine. My guess is, the problem lies
with the Infrain part of that pin. Just a guess though.

Thanks guys!

Mark
 

MartinM57

Moderator
Well - knock me over with a feather.

14M
12v SLA battery
7805 regulator plus all the caps
standard download circuit
AXE027 cable
pin 1 - Vcc
pin 14 - Gnd
pin2 - 22k resistor - then rest of circuit
pin 13 - straight to PC (no 180R)
pin 4 - open circuit.

Code:
#PICAXE14M
#terminal 4800

pause 1000
sertxd ("...reset", CR, LF)

do:loop
Touch +ve terminal of battery with left index finger. Touch pin 4 with right index figer and thumb holding a metal screwdriver.....yep, PICAXE resets every time

Code:
...reset
...reset
...reset
...reset
...reset
...reset
...reset
Remove left index finger from battery - no resets.

With left index finger on battery and other input pins - no resets.

Off to find a resistor to tie pin 4 to +ve and/or Gnd - but might nip off to watch the darts first...

At the moment, I'm stumped...EDIT: s'pose I ought to put my scope on the screwdriver and see what's going on ;)
EDIT2:not that touching input pins is a particuarly realistic scenario, but I might not now leave pin 4 floating on a 14M circuit
 
Last edited:

markdil

New Member
Well - knock me over with a feather.

14M
12v SLA battery
7805 regulator plus all the caps
standard download circuit
AXE027 cable
pin 1 - Vcc
pin 14 - Gnd
pin2 - 22k resistor - then rest of circuit
pin 13 - straight to PC (no 180R)
pin 4 - open circuit.

Code:
#PICAXE14M
#terminal 4800

pause 1000
sertxd ("...reset", CR, LF)

do:loop
Touch +ve terminal of battery with left index finger. Touch pin 4 with right index figer and thumb holding a metal screwdriver.....yep, PICAXE resets every time

Code:
...reset
...reset
...reset
...reset
...reset
...reset
...reset
Remove left index finger from battery - no resets.

With left index finger on battery and other input pins - no resets.

Off to find a resistor to tie pin 4 to +ve and/or Gnd - but might nip off to watch the darts first...

At the moment, I'm stumped...EDIT: s'pose I ought to put my scope on the screwdriver and see what's going on ;)
EDIT2:not that touching input pins is a particuarly realistic scenario, but I might not now leave pin 4 floating on a 14M circuit
Yup, it is unbelievable. I am sure a few of you wanted me committed!!

Funny thing is, if you do not use a piece of metal, it does NOT reset... what's with that??

Finally, I have been vindicated.

mark
 

MartinM57

Moderator
High impedance (10x) scope probe.

1st region - 0 to 2.5 secs - probe on screwdriver - no fingers anywhere

2nd region - 2.5 to 5.8 seconds - probe on screwdriver - right hand on screwdriver, left hand in pocket. 50Hz mains induced hum, 2v p-p...

3rd region - 5.8 seconds onwards - probe on screwdriver - right hand on screwdriver, left hand on battery +ve. 50Hz mains induced hum, 2v p-p...but with a (unexpected?) +20v DC offset

...but with right hand on screwdriver, left hand on battery +ve, probe on screwdriver - no resets on pin4

I'm gonna give up I think - not very conclusive and too much high impedance induced voltage around. Lesson learned - for good practice:
- if not using pin4, tie it directly to Gnd
- if using pin4, don't touch it whilst holding on to battery +ve



EDIT:BTW, the sine wave of period ~0.2 secs is a display artefact - it's not there if you zoom in to the saved waveform. That's the problem with cheap scopes ;)
 
Last edited:

Dippy

Moderator
Interesting.
Though I'm a bit confused now.
Martin's test with his cheap (cough,cough) 'scope and fat fingers had Inp3 (Pin4) open.
I thought Mark's was with Pin4 tied down with a resistor?

Does this reset happen regardless of value of tie down resistor?

What are the other connections on the PICAXE pins.

I'm probably off at a complete tangent here, but I was wondering if the touching of Pin4 (MCLR/Vpp) was briefly putting it into (PIC HV) programme mode. However, this would (should) depend on the status of other pins too (12&13).
It just seemed hugely coincidental that when Martin applied quite a few volts then it did a reset.

The Pin4 (MCLR/Vpp on PIC) won't have a clamp diode as this pin is raised in voltage when hardware HV programming.
But I'll repeat BeanieBot's question: Does this problem go away if you place a diode bewtween Pin4 and the supply Voltage? (Pin4 --->|--- Vdd +supply)
i.e. in effect, add a clamping diode.
 

Dippy

Moderator
Sorry, I forgot PICAXErs are leg men :)

It would be an interesting test.
If it is reproducible maybe a little note should be made somewhere as all this may be forgotten in a few weeks time.
And does this happen with other PICAXEs which use the MCLR/Vpp (PIC) pin (sorry, leg) as an I/O?
If, of course, the reason is something completely different it would be nice to nail the reason.
 

BeanieBots

Moderator
I think the diode clamp would be a valueable test.
Also, test to see if it is pure volts which causes an issue or if 'noise' is also required.
There's no doubt that the source is high impedance so I'm surprised the issue manifests when there is a pullup/down resistor attached. However, the srewdriver/body capacitance/discharge could be significant.

Does it reset with an OC leg4 when 12v is applied via say 100k?
 

MartinM57

Moderator
...just firing up the scope now...I'll be back...;)

Planned tests:
- finger test with 10K to Vcc
- finger test with 10K to Gnd
- finger test with 1K to Vcc
- finger test with 1K to Gnd
- finger test with diode to Vcc (no resistor)
- 12v via 100K, no fingers

Any more?
 

Andrew Cowan

Senior Member
An 08M may act oddly too - pin 3 (leg 4) is MCLR and has no clamping diode - can you test that?

And finger test with finger to 240Vac, please ;).

A
 

Dippy

Moderator
Sausage, egg & chips please.

Sounds good Martin.
Can you repeat the 12V via 100K to pin4 with Pns 12 & 13 tied to gnd via lowish resistors, say a couple hundred Ohms.

Andrew: thats why I posed my question in Post#33 re other PICAXEs.
 

BeanieBots

Moderator
@Martin,
Those will be a very informative set of results.
I suspect that 'environment' will also play a significant role so something a little more 'controlled' would be useful.

Short of 100k (and maybe some other values but >20k) to 12v I'm not sure what else to try. If 100k to 12v has no effect even on OC leg4, then maybe 100k to sig-gen with ~12v frequency source. (50/60Hz sine being an obvious starting point).

If a reliable controlled, reproduceable reset mechanism can be determined, then the cause can be counteracted.

EDIT: with and without pins 12 & 13 tied high/low as pointed out by Dippy.
 
Last edited:

Dippy

Moderator
And if the results are predictable and reproducible then maybe hippy could add a note in the Manuals? (A PICAXE is not just for Christmas you know :) )
 

MartinM57

Moderator
Pins 12 and 13 open circuit:
1. finger test direct to leg 4 - resets
2. finger test with 10K to Vcc - resets
3. finger test with 10K to Gnd - no resets
4. finger test with 1K to Vcc - no resets
5. finger test with 1K to Gnd - no resets
6. finger test with diode (BAT85) pointy end to Vcc (no resistor) - no resets
7. finger test to 100K then leg 4, no other resistors or diode -no resets
8. 12v via 100K, no fingers - no resets

Very repeatable - have gone backwards and forwards between tests.

Not tried the legs 12 and 13 to ground yet because there's other things confusing me...
...with the tests that reset (1 and 2) i have to use a screwdriver (3" non insulated jeweller type) to touch leg 4. If I touch leg 4 directly with my fingers, then no resets (I think OP noticed this as well)
...if I put the scope probe on leg 4 then I don't get resets for tests 1 and 2 either - note that the previous scope picture was just with the probe attached to screwdriver and touching the screwdriver i.e. no PICAXE involved

Where next?
 
Top