14m running after 5v removed?

BCJKiwi

Senior Member
Currently testing an accelerometer and program. It is set up on breadboard with 3D accelerometer, PICAXE 14M Firmware 9.B

program applies;
let dirsc = %00000000 'change leg 8,9,10 to input for ADC1,2,3
to allow for 3 readadc10 instructions on legs 8,9,10 (ADC 1, 2, 3).
Serin attached via programming cable via enhanced download circuit
serout connected to LCD input (Anderson K107)
Input 4 is high (connected to 5V)
Input 2 is high (connected to 5V)
Other inputs individually tied to ground via 10k resistors

Program reads in 3 separate ADC values (the 3 axes of the accelerometer) and displays these on the LCD with typical voltages from 1.6V through 2.0V.

Everything operates as expected except that at one point I found all three readings sent to the LCD had jumped up by approximately the same amount.

Tested all the voltages etc and everything was as expected. Eventually I discovered the 5V supply jumper had become dislodged from leg 1 of the 14M but the chip had not turned off!

Once 5V was reconnected everything returned to normal.
A readadc10 Value of 332 (at 5.06V) increased to 403 with no 5V
This would suggest the 14M was still seeing a reduced supply voltage and in fact a reading of 4.32v can be seen with a DMM on leg1 when there is no supply on it.

This voltage does not quite tally with the calculated changed supply voltage required to generate the readadc10 value of 403 but it is close.

Does anyone have an explanation for this behaviour?
 
Last edited:

hippy

Technical Support
Staff member
All ( well nearly all ) I/O lines are connected to +V and 0V by diodes, therefore any voltage which is present on an I/O pin can keep the PICAXE alive. This could come from the PC's serial port or any other input. The 4.32V seen is probably Vsupply-Vdiode, Vdiode is usually around 0.6V.
 

BCJKiwi

Senior Member
OK thanks.

I figured it might be something like that but really didn't expect it.

So to restart a 14M you have to turn off the entire supply to every input, not just V+?
 

hippy

Technical Support
Staff member
You have to remove the source of power which is keeping the PICAXE running, which means having to identify where the source of the power comes from. It may be via the PC's serial port, it could be from a pulled-up line which is held high by something which remains powered up, it could be something actively driving an input line.

The usual solution is to power everything within a system from the same power supply so everything powers-down and everything stops working. During development it is not unusual to keep things like LCD modules powered-up or run from separate supplies, but then this 'phantom supply' problem can materialise.

For PICAXE's with a reset line it's not usally so much of a problem as a hard reset will force the program to restart regardless of phantom power, for those without they can only be reset by removing power, real or phantom.

We'd really need to see your entire circuit diagram and know exactly what was powered by what to say where the probem likely arises. One thing you can try is to check the +V line is at 4.3V with power off then check to see which I/O lines are showing ~5V. That may help point towards the culprit.
 

BCJKiwi

Senior Member
Thanks Hippy.
I don't really need to hunt down the source as the situation is abnormal and will not arise in the final design (or in further testing). A simple test indicates it is probably from multiple sources - i.e. everything tied to V+ as removing any of them individually makes no difference.
Normally on the breadboard I drop the entire supply which is everything and have no trouble.
In this instance the V+ became dislodged and funny things began.

However I wonder if this is a PIC design flaw. I would have expected the PIC design to have shut down the entire chip if there was no V+, not to continue to run by dragging power from other sources such as inputs. For example, what happens if the entire PIC current loading is higher than the input supplying power can cope with?
 

hippy

Technical Support
Staff member
I wonder if this is a PIC design flaw.
Not really a flaw as such, but a design feature. The benefits usually outweigh the disadvantages and a lot of microcontrollers include such clamping.

The clamping diodes give the PICmicro resilience against ESD and out-of-spec voltage inputs. It allows tricks like interfacing serial, even mains, without having to add much more than a single resistor.

There are other unusual tricks which can be used ( but not particularly recommended unless you know what you are doing ), such as feeding a suitable AC signal into two pins and using the internal diodes as a bridge rectifier :)

For example, what happens if the entire PIC current loading is higher than the input supplying power can cope with?
Draw more current than those clamping diodes or the supply can cope with and it will likely "crash and burns", in the most literal of senses :)
 

BeanieBots

Moderator
I wonder if this is a PIC design flaw.
It is an absolutely deliberate design feature that can be found on just about every chip out there. That's why nearly every electrical spec for inputs state maximum input voltage Vcc+0.6v. If Vcc is 0v, then the maximum input voltage becomes 0.6v.
Whilst not impossible to design a chip to cope with inputs above power rail voltage, it would make the internals MUCH more complex and result in significantly higher costs and would also remove what is for the most, a valuable feature.
 
Top