Connect with us

Newbie PIC problem

Discussion in 'General Electronics' started by Emil Johnsen, Apr 22, 2004.

  1. Emil Johnsen

    Emil Johnsen Guest

    I have made a board with a PIC16F628:
    Pin 5: Gnd
    Pin 14: +5V
    Capacitor between pin 5 and 14.
    LEDs connected to the pins of port B, trough a resistor to gnd.

    I have tried several different programs to turn on the outputs, both on port
    b and port a (just measuring the pins on a with a voltmeter.)

    In all cases nothing happens. All the outputs stay at 0V.

    I have tried with and without a crystal oscillator connected.

    Is there some setting I need to get right to make the PIC use the internal
    oscillator or the crystal?
    Is there something I need to do to 'turn on' the PIC other than connecting
    power?

    What am I doing wrong here?
     
  2. Ok, what about /MCLR pin (4)?
    Of course there is, it's stored in the configuration word. ;-) The
    'Special Features of the CPU' section of the datasheet will tell you
    everything you need to know about using different oscillator setups.
    You have to apply power and it has to ramp up at a certain rate or the
    chip won't come out of reset automatically. You should also have the
    PWRTE config bit turned on. You need to connect /MCLR to +5V as well.
    Read the datasheet on these items.
    Not reading the datasheet?
     
  3. Fred Stevens

    Fred Stevens Guest


    Some suggestions:

    1) Check that your "configuration word" is correct when you program the chip
    2) Make sure the enable/disable pin is at the correct voltage (see data sheet)
    3) Put a 'scope on the oscillator pins
    4) Make sure the bank switching is correct

    Fred.

    (See PIC booklet at http://www.the-electronics-project.com)
     
  4. Emil Johnsen

    Emil Johnsen Guest

    Ok, what about /MCLR pin (4)?
    MCLR is connected as shown in figure 14-11 of the datasheet. (R=39K,
    R1=390ohm, C=10uF.) Voltage on MCLR takes a second or two to come up and
    stabilizes at 4.85V.

    These are the options I have set in IC-prog, as far as I can tell from the
    datasheet these should be correct when using the internal oscillator. Are
    they?

    Oscillator: IntRC I/O
    Code protect: CP OFF
    Fuses: PWRT, MCLR
     
  5. Roland

    Roland Guest

    Hi,


    1. Power = +5 and Ground = 0
    2. MCLR = +5
    3. SET CONFIG BITS correctly
    4. Program Chip
    5. ReadBack Chip and confirm config bits
    6. OSC Get a signal with a scope
    7. INTERNAL TRIS and CMCON regs
    8. Recheck CODE with simulator
    9. pull out your hair and go back to 1or repost

    Note: Check that the configuration bits (5) are set correctly for the
    comparator to be off and the IO assigned to Digital.
    Chips with A/D default to A/D on, maybe the 628 defaults to comparators on.
    They always catch me.


    Regards
    Roland DeLuca
    3Tronics Technical Services
    www.3tronics.com
     
  6. Emil Johnsen

    Emil Johnsen Guest

    The PIC is working. I think that connecting MCLR fixed the problem, but it
    took a while for me to discover that the board was working because one of
    the programs I tested with had a bug.

    Thank you to everyone who replied to my question.
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-