Maker Pro
Maker Pro

How to tell if my Pic16f84a is dead

C

ChronoFish

Hi there,

I have rigged up a pic on a bread board and I am not getting much response.

I can put a scope on osc2 and see a nice waveform - but nothing on osc1 (should I be able to?). This is a pic16f84a-20/p which I am
assuming means it will operate up to 20MHz - I'm using a 4MHz crystal.

The code works in my debugger which simply does the following:

If portb > 0 turn on everything on porta
if portb > 3 turn off everything on porta

WHAT SHOULD HAPPEN:
So with an input on portb pin 0 or 1 my LEDs should light
If lit, an input on portb pin 2 or higher should turn off the LEDs
If not lit, an input on portb pin 2 or higher should flash the LEDs 1 time

WHAT DOES HAPPEN:
The reality is that touching portb on any pin with +5v does nothing.
Touching physical pin 4 (the MCLR) turns on porta.


Any ideas?
Thanks!
CF
 
C

ChronoFish

ChronoFish said:
Hi there,

I have rigged up a pic on a bread board and I am not getting much response.

I can put a scope on osc2 and see a nice waveform - but nothing on osc1 (should I be able to?). This is a pic16f84a-20/p which I am
assuming means it will operate up to 20MHz - I'm using a 4MHz crystal.

The code works in my debugger which simply does the following:

If portb > 0 turn on everything on porta
if portb > 3 turn off everything on porta

WHAT SHOULD HAPPEN:
So with an input on portb pin 0 or 1 my LEDs should light
If lit, an input on portb pin 2 or higher should turn off the LEDs
If not lit, an input on portb pin 2 or higher should flash the LEDs 1 time

WHAT DOES HAPPEN:
The reality is that touching portb on any pin with +5v does nothing.
Touching physical pin 4 (the MCLR) turns on porta.


Any ideas?
Thanks!
CF


Nothing like being able to answer your own questions:
1. No it was not dead.
2. You can only watch the OSC on OSC2
Don't know why exactly...
3. You can use a slower OSC than the rated speed
obviously you only go as fast as the OSC you choose
4. I needed to tie the reset (MCLR) to Vdd and did so via a 100R
Still not 100% clear on this, but Myke Predko suggests it in his book
5. Each of my inputs needed to be tied to ground and did so via a 100R
5V turn the pin on, but removing it does not turn it off - something
needs to turn it off and connecting it to ground does this.
6. Thank god the 16f84 series is EEPROM - the perfect chip for a software guy.


-CF
 
S

Spehro Pefhany

Nothing like being able to answer your own questions:
1. No it was not dead.
2. You can only watch the OSC on OSC2
Don't know why exactly...

OSC1 is high impedance (it's an "input" not an "output"), your scope
probe loads it too much and stops the oscillator.
3. You can use a slower OSC than the rated speed
obviously you only go as fast as the OSC you choose
4. I needed to tie the reset (MCLR) to Vdd and did so via a 100R
Still not 100% clear on this, but Myke Predko suggests it in his book

It's the /RESET pin for the chip, effectively. Hold it low and the
chip does nothing.
5. Each of my inputs needed to be tied to ground and did so via a 100R
5V turn the pin on, but removing it does not turn it off - something
needs to turn it off and connecting it to ground does this.

They are like little capacitors- you need to charge and discharge
them.
6. Thank god the 16f84 series is EEPROM - the perfect chip for a software guy.

The 16F628 is better for less $$.


Best regards,
Spehro Pefhany
 
J

Jan-Hinnerk Reichert

ChronoFish said:
Nothing like being able to answer your own questions:
1. No it was not dead.
2. You can only watch the OSC on OSC2
Don't know why exactly...
3. You can use a slower OSC than the rated speed
obviously you only go as fast as the OSC you choose
4. I needed to tie the reset (MCLR) to Vdd and did so via a 100R
Still not 100% clear on this, but Myke Predko suggests it in his
book
5. Each of my inputs needed to be tied to ground and did so via a
100R
5V turn the pin on, but removing it does not turn it off -
something needs to turn it off and connecting it to ground does
this.

It is generally a bad idea to leave inputs open (i.e. not connected).
This does only work on old standard TTL parts (which than act as if
the input is +5V).

CMOS chips may even be damaged by static electricity if inputs are
left floating. In addition, power dissipation can increase
substantialy if inputs are at switching threshold.

However, most microcontrollers (in particular the PIC-series, IIRC)
have built-in pullup resistors on the _port_-pins. These can be
switched on by software. If you want to play safe use external
pull-up resistors (i.e. resistors to +5V). 10k should be enough (see
below)

The usual way to connect pushbuttons is to pull the inputs to +5V with
resistors. Then connecting the switch to GND. So pushing the button
will force the input low. Of course, there is current floating
through the resitor while the button is pressed, so don't use low
values for the resistor.

It is a very bad idea to switch between GND and +5V with the
pushbutton. When you press the button it will not be connected for a
short time.

Have fun
Jan-Hinnerk
 
D

Dingus

.... it won't wake up.


ChronoFish said:
Hi there,

I have rigged up a pic on a bread board and I am not getting much response.

I can put a scope on osc2 and see a nice waveform - but nothing on osc1
(should I be able to?). This is a pic16f84a-20/p which I am
 
Top