+ Reply to Thread
Results 1 to 5 of 5

Thread: 18F2550 taking power from A1

  1. #1
    arhi Excellent arhi Excellent arhi Excellent arhi Excellent arhi Excellent arhi Excellent
    Join Date
    Apr 2008
    Location
    Belgrade, .rs
    Posts
    832

    Default 18F2550 taking power from A1

    Hi,

    I have a strange "problem" ... now .. let us ignore rest of the circuit, the important part is:

    GND from USB connector is connected to GND on the board
    GND from the regulated 5V source is connected to GND on the board

    1 (mclr) is pushed up to vcc with 10K
    3 (RA1) is connected to 5V from USB connector (so I can detect when usb is connected)
    8,19 (VSS) is connected to the GND on the board
    20 (VDD) is connected to regulated 5V source

    RA1 is set as digital input

    now, I connect 5V regulated and everything works ok, now I connect USB connector and all works ok .. communication works etc etc...

    I disconnect 5V regulated - AND EVERYTHING WORKS !!!!

    I disconnect USB, (so nothing is connected to device) and device shuts down

    I connect USB only - AND EVERYTHING WORKS...

    on board is also one 3V stabilizer (using 5V as a source), few i2c devices ...

    the only way USB 5V can power up all this is trough PIC !! like RA1 and VDD pin's are shorted out ?!?!?!

    anyone?


  2. #2
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,806

    Default

    There is a protection diode from each pic pin to Vdd and this is what is powering your circuit. Place a 10k (maybe 100k) resistor in series with RA1.

    Mike.

  3. #3
    Diver300 Excellent Diver300 Excellent Diver300 Excellent Diver300 Excellent
    Join Date
    Oct 2007
    Location
    England
    Posts
    1,097

    Default

    I would have expected exactly what you describe. You should be very, very careful in designing anything that has input or output voltages higher than the positive supply or lower than the negative supply at any time.

    From the data sheet:-

    Voltage on any pin with respect to VSS (except VDD and MCLR) .............. -0.3V to (VDD + 0.3V)
    There are clamping diodes from every pin (except MCLR and the power pins) to Vss and Vdd, so the input pin cannot rise much above Vdd. In your circuit, the diodes stop Vdd falling below the input voltage.

    Use a continuity tester and you can see that those diodes are there. You can power a PIC like that from any pin, not that you should. Current flows from the pin, through the clamping diode and you will see about 4.4 V on the power rails. The decoupling capacitors will help the PIC run under those conditions.

    There are several things you can do to stop that happening.
    1. Use a transistor as a buffer, with a pull-up to Vdd
    2. Put a big resistor in series. The input current on a digital input is tiny, so you can use a 100kΩ or so, which won't provide enough current to run much.
    3. Use a PIC with high voltage tolerant inputs. Most are 3.3 V devices. In the data sheet they say:-

    Voltage on any digital only pin with respect to VSS ........................................ -0.3V to +6.0V
    Now that has no reference to Vdd, so you can feed it with 5V at any time. They have different clamping systems. You have to chose your pins because analogue capable pins generally don't like higher voltages.
    4. Use a gate like a 74AHC1G04 as a buffer. It can run from 5V and can stand 5V input even with no supply voltage, so if you wire the supply to the gate to the PIC supply, both can fall to 0V while the input (USB) is still at 5V
    5. Power everything off the USB anyhow.
    Last edited by Diver300; 22nd January 2009 at 10:36 AM. Reason: formatting

  4. #4
    arhi Excellent arhi Excellent arhi Excellent arhi Excellent arhi Excellent arhi Excellent
    Join Date
    Apr 2008
    Location
    Belgrade, .rs
    Posts
    832

    Default

    Mike, thanks, I forgot about the diode .. that explains it ..

    Diver, powering from USB is not an option, the device is "logger" .. it has some 20+ sensors and log data into few i2c eproms every 30min ... I just connect it to computer from time to time to download data into my application...

    the 100K in series will do the job, in general, this works as is, problem was I forgot about the diode so was wondering "why" it worked (the pic is anyhow powered with 4.8V to be able to properly get data from 3v spi sensor on board without level shifter )

  5. #5
    almamater Newbie
    Join Date
    Mar 2008
    Posts
    1

    Default

    Hello!

    I have one PIC18F2550 and a PicKit2 from Microchip, where i can find the code to
    make a LED flash with this PIC?

    For the circuit i will connect the PIC to 5V and put a LED via a resistor on one
    of its I/O pins..

    I just want a simple "hello world", im using MPLab...

    Sorry for this question and thank you

+ Reply to Thread

Similar Threads

  1. taking a sound signal to control LEDs
    By foxfan19 in forum General Electronics Chat
    Replies: 3
    Latest: 6th June 2009, 03:14 PM
  2. ...UBW v5 with 18F2550
    By theo92 in forum Micro Controllers
    Replies: 0
    Latest: 26th December 2008, 06:57 AM
  3. Need to know exams of electrical fundamentals , for taking Achievement Exam
    By Abeer_engjbr in forum Electronic Projects Design/Ideas/Reviews
    Replies: 9
    Latest: 16th May 2008, 08:42 PM
  4. Replies: 3
    Latest: 13th November 2006, 07:58 PM
  5. Taking a RGB signal to multiple places using a op-amp
    By FusionITR in forum General Electronics Chat
    Replies: 2
    Latest: 7th April 2006, 06:13 AM

Tags for this Thread