PDA

View Full Version : 16F877A don't start :(



nquere
- 8th November 2008, 22:24
Hello,

I want to blink a led on a 16F877A but nothing run :/
This is my code:


'Initialisation des fusibles:
@ DEVICE pic16f877A, HS_OSC, WDT_OFF, LVP_OFF, PROTECT_OFF
define OSC 20

output portc.2
Main:
high portc.2
pause 1000
low portc.2
pause 1000
goto main
end

Nothing really fantastic :/

I've tested with OSC 4 & OSC 8. HS,RC,XT...
On the PIC i can read "16F877A-I/P" not "16F877A-I/P20"

:)

Can you show me a working code to blink a LED on this PIC ?


I'v a 10K pullpup resistor for MCLR connected to +5v, 470ohms for the red 5mm LED, a XTAL 20mhz on PIN 13 & 14, fallowed by 2 capa (22pf) -> GROUND.

I'm speaking bad but i understand good :)

@+
Niko

mister_e
- 8th November 2008, 22:36
Bonjour!
Well in theory the above has to work... maybe your PIC programmer don't program the configuration fuses... or don't have the 16F877A option in the list?

Make sure you have all Vdd and Vss pins connected.
0.1 uF close to your PIC (on Vdd/vss line)

For now use a 4MHz crystal (or resonator) and use XT_OSC.


Bonne chance!

nquere
- 9th November 2008, 10:05
Hie,

OK i will buy a 4mhz osc. My programmer is PicKit 2... :-/

Glenn
- 10th November 2008, 00:33
What software do you use ? "Pickit 2 programmer" or MPLAB IDE ? ..with the later I dont know if the manual settings overrides the settings in the source, I use the Pickit2 software.

I just tried your code, compiled it with

C:\PBP>pbpw -p16f877a blinkit.bas

and loaded the hexfile into the pic with the pickit2 software.

The pic only had a 20MHz xtal between pin 13 and 14, two 22pf caps from both pins to ground and a 10k pullup on ~MCLR, a 470ohm resistor from pin 17 to a LED wich is connectet to ground in the other end. exactly your setup as far as I can see.

And yes, it works here.

Glenn
- 10th November 2008, 00:36
btw the text on my 16F877A also reads "PIC16F877A-I/P" and its 20MHz units, i know coz I ordered it, and I also run them in 20MHz :)

The Master
- 10th November 2008, 13:07
I had problems with that same PIC not so long ago. Mackrackit posted a solution in post 21 of this thread (http://www.picbasic.co.uk/forum/showthread.php?t=9847). It might help here

Glenn
- 10th November 2008, 19:46
yea, but his example works for me without disabling AD-converters and comparators.

nquere
- 10th November 2008, 20:54
Coucou,

Bon j'ai test้ avec un autre PIC et apparement tout est OK ! Surement le PIC qui devaient etre foutu...

J'ai test้ avec et sans

ADCON1=7
CMCON=7 et cela fonctionne :)

Merci เ tous !



-----------------

Oups ! To resume, it's OK with an another PIC. I've tested with A/D off and comparator OFF.
I use PIC Flash soft;)

Thx for your support :)

mister_e
- 10th November 2008, 22:34
Yup ca fait du sens! Anyways the pin you're using aren't multiplexed with ADCs, or comparator...

nquere
- 13th September 2009, 22:56
Erf, i think that i have the same PIC because it don't run today :D

I will buy an another one :/