PIC problem!

Discussion in 'Embedded Systems and Microcontrollers' started by vane, Nov 8, 2009.

  1. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    I have a PIC16f84A programmed to flash an LED on RB3 port.
    When it is in my experimentation board (velleman k8048) it flashes but when on my breadboard the light goes on constantly.

    I have a 4mhz ceramic resonator with centre pin on Vss (5) with the other pins on 15 and 16.
    MCLR (4) is connected to Vdd (14).
    I have a polarised 63v 100uF Cap across Vss (5) and Vdd (14)
    I have a 4.5v supply, + on Vdd and - on Vss
    LED is on Vdd an RB3

    It is probably a silly mistake :)
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Which resonator is it? Does it say in the datasheet to connect the central pin to ground?

    If there is a MCLR pin, whose function is only to clear the memory and does not have any input/output function, on the PIC then you have to pull it up with a 10K resistor.
     
  3. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    so put a 10k resistor between MCLR and ground? The resonator is light blue, says 400 on it and has an M in a circle, i have no idea if it has a data sheet
     
  4. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    When the 10k resistor goes to vss the LEDs go out, when on Vdd they come on but flicker
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, normally you don't connect MCLR directly to Vdd/Vcc; you use a 10k pull-up resistor. That enables you to use a switch to momentarily ground MCLR to re-set the uC.

    You may be having problems due to the parasitic capacitance/inductance/resistance inherent in the breadboard. The clock/resonator section is very sensitive to additional capacitance/inductance being added.

    It is best to use prototype circuit boards when dealing with circuits in the MHz range.
     
  6. zimbarak

    Active Member

    Feb 8, 2009
    56
    0
  7. zimbarak

    Active Member

    Feb 8, 2009
    56
    0
  8. zimbarak

    Active Member

    Feb 8, 2009
    56
    0
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Zimbarak,
    You are attempting to link to images that are on your computers' desktop.

    You are the only person on the planet that can see them.

    You must use the "Go Advanced" and "Manage Attachments" buttons to upload photos from your computer.
     
  10. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Connect the MCLR pin to Vdd via a 10K resistor. The LED is flashing because I think you have the watchdog timer enabled and it resets the PIC every few ms. If you disable it everything should be fine.
     
  11. zimbarak

    Active Member

    Feb 8, 2009
    56
    0
    yea SgtWookie sorry my frnd get confused :)
     
  12. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    Ill try that, how do i disable it?
     
  13. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    Just loaded a different program onto it whereby you press a button (bridge RA3) to light up the LED, now when i ground RA3 the light comes on solid, when i remove the ground, it flickers. In the code, it shows the WDT is off, i am one step closer though!

    EDIT: Bloody hell! this has gone completely wrong, there may be a loose connection somewhere
     
    Last edited: Nov 9, 2009
  14. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    I swear nothing is working whatsoever :s
     
  15. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    Do you have RA3 pulled High with resistor to Vcc?? If not your input could be "floating", hence the flickering when you remove wire from ground.....

    Anytime you use a switch input that pulls your I/O low, you should always have a pullup resistor on it to keep the input from Floating.... same with outputs, have them tied to either ground or Vcc depending on application....


    My .02
     
  16. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
  17. vane

    Thread Starter Active Member

    Feb 28, 2007
    181
    0
    I think i need a more reliable power source :s, anyone know where i can get a cheap good quality power source?
     
  18. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Ebay - "bench power supply" The unilab one looks pretty useful at £27 inc postage.
    I got a good one for £20 a while back - just a variable single supply but with adjustable current limit and meters for voltage and current.
     
  19. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    If you are looking for a regulated one, try a computer power supply, you can get some that are around 700 Watts for under $30.00, with that you get a regulated +3.3(multiple outputs),+5 (multiple), +12(multiple),and a negative voltage as well(-12) (used to have -5 also, but they removed that from the specs...) anyways, cheap and easy to hook up for multiple voltages..... you can get used or less wattage ones for even cheaper.

    .... or ask that buddy of yours that has a stack of them in his basement or something :D, someone you know is bound to have a pc power supply laying around :rolleyes:...



    My .02
     
  20. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    This is the most basic way of connecting an F84A (See attached circuit)....


    and this is the basic config for a F84A....
    Code ( (Unknown Language)):
    1.  __FUSES _CP_OFF & _WDT_OFF & _RC_OSC & _PWRTE_OFF
     
Loading...