Maker Pro
Maker Pro

Newbie PIC problem

E

Emil Johnsen

Jan 1, 1970
0
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?
 
A

Anthony Fremont

Jan 1, 1970
0
Emil Johnsen said:
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.

Ok, what about /MCLR pin (4)?
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?

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.
Is there something I need to do to 'turn on' the PIC other than connecting
power?

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.
What am I doing wrong here?

Not reading the datasheet?
 
F

Fred Stevens

Jan 1, 1970
0
Emil Johnsen said:
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?


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)
 
E

Emil Johnsen

Jan 1, 1970
0
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.

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
 
R

Roland

Jan 1, 1970
0
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
 
E

Emil Johnsen

Jan 1, 1970
0
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.
 
Top