View previous topic :: View next topic |
Author |
Message |
SlavaPHP
Joined: 17 Oct 2013 Posts: 16 Location: NY
|
Input pin powers the chip? |
Posted: Thu Oct 17, 2013 4:56 pm |
|
|
I have a problem... I made a program that flashes an LED when the PORTA.0 pin is high... the weird thing is... when i unplug the power, the circuit keeps going (its getting power from the I/O pin!) .. is there any solution to this?
Another question... why do you prefer CCS C over HI_TECH C?
Thanks! _________________ -Slava |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 17, 2013 5:36 pm |
|
|
Quote: |
when i unplug the power, the circuit keeps going (its getting power
from the I/O pin!) .. is there any solution to this?
|
Yes, connect your LED like this. Have your PIC supply power to the LED:
Code: |
pin 330 ohms LED
A0 ---/\/\/\/------->|----
|
|
----- Ground
---
-
|
Quote: | Another question... why do you prefer CCS C over HI_TECH C? |
Hi-Tech makes you write too much code for simple things. I want to
concentrate on program design, not on setting up UART registers. |
|
|
SlavaPHP
Joined: 17 Oct 2013 Posts: 16 Location: NY
|
|
Posted: Thu Oct 17, 2013 5:53 pm |
|
|
its normal that an input pin powers the chip without Vcc ? _________________ -Slava |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 17, 2013 6:51 pm |
|
|
I assume you mean the PIC is still running after you did my proposed
solution with the new LED circuit.
I suppose if you have a big capacitor on the output of your voltage
regulator, then the PIC could keep running after the board is unplugged.
I can think of a couple ways to fix it.
What size capacitor do you have on the output of the voltage regulator ?
And also what size cap is on the Vreg input ?
The first thing you can do is to enable the Brownout fuse. You didn't tell
us what your PIC is. If your PIC has several Brownout voltages, then
set it to a level just below your PIC's Vdd voltage. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Fri Oct 18, 2013 1:11 am |
|
|
Yes.
Every output FET on the PIC, acts as a diode if driven 'backwards'. If an input signal is more than about 0.6v 'above' the internal supply of the PIC, the diode conducts. Protects the PIC pin from destruction, by letting current flow from the input to the supply.
Have you switched to wiring as PCM programmer shows?. Here the PIC 'sources' the power for the LED, not 'sinks' it, so when the supply is off, there is no tendency to power the chip.
It is worth perhaps expanding a little further on this.
Switching a chip 'off', does not make the internal circuitry 'disappear'. All the semiconductor junctions are still there, and every data sheet 'rating' still applies. So if the manufacturer says that a pin must not be more than 0.6v above Vdd, and Vdd is 0v, the limit is still there... In many cases powering pins will actually cause damage (the PIC is pretty rugged in this regard), but (for example), if you raise the output pin of a 780x regulator more than about 4v above it's incoming supply connection, this can destroy the regulator. Similarly, many CMOS outputs _will_ switch become 'locked' into operating as a thyristor if the output goes above the supply, resulting in overheating and damage.....
On C's, CCS's big problem is that they tend to release their compilers as 'beta' releases, and not make this clear to people. So users dash out and 'upgrade' to the latest compiler, and are then acting as beta testers with the problems this produces. People who have 'experience' with CCS, keep their current 'good' version when new ones are released, till they are sure how good the new one is.
I've had as many 'deep' problems with both HiTech, and Microchip C's. Often taking a lot longer to get fixed.
The great thing about CCS, is the speed with which simple programs can be written, and work. I've put together complete working 'beta' projects, in less time than it'd take to just start setting up the peripherals on the other C's....
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Oct 18, 2013 7:10 am |
|
|
I've been running this compiler since v2.5xx but haven't upgraded to v5.xxx.I'm also running W98 on a couple machines as well.
True believer in 'if it ain't broke...don't upgrade!'.Unless the lastest version of any software have real features you must use,why 'upgrade'?
As T points out, there are 'headaches' in getting the new version properly running.While it's 'easy' to upgrade a product that only supports one device,a compiler has to handle hundreds of devices( and more on an almost daily rate !).That makes it easy for a bug or two to creep in, especially when an internal peripheral's register layout or active state has been changed by the mfr.
I've looked at Hi-tech and agree , it makes you code a LOT of stuff that CCS 'magically' make happen.Thing is, any high level language is supposed to be 'better,faster,simpler' to code than assembler.Hi-T C isn't that case.
Then there's the 'I'm used to it' factor.Having used CCS C for 15+ years, I've developed an extensive library of code,easily transportable to several devices from 16C71 to 18F46K22.CCS C does more than I need it to and I'm too old to 'flip' over to someone else's compiler just because the ads say I should.
hth
jay |
|
|
SlavaPHP
Joined: 17 Oct 2013 Posts: 16 Location: NY
|
|
Posted: Fri Oct 18, 2013 10:46 am |
|
|
what is the PCM option? _________________ -Slava |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 18, 2013 11:16 am |
|
|
He means connect the LED to your PIC by following the schematic that I posted above. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Oct 18, 2013 10:05 pm |
|
|
I think the PORTA.0 pin is his signal input, not his LED output. Some external system is supplying a logic 1 to PORTA.0 even when the PIC VCC supply is removed.
If so it is not surprising that the PIC can run to some degree from power applied to the logic input. The input protection diode is shunting the logic signal voltage to the power bus.
The solution is to put a series resistance on the logic input pin that is small enough to still deliver the logic signal but large enough to block significant power transfer. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|