Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need help with my first PIC program

Status
Not open for further replies.
Blink a LED finally works!

i had a friend at sk00l bring in his pic chips and his programmer. we used my blink-a-led software. we programmed his chip and tested it, it worked fine.

then we programmed my chip, but put it in his hardware, and walla -LED blinks!- . this is at 4 MHz.

right, my chip, even though 16F877, is a 4MHz device. but then, just for fun we removed the 4MHz crystal from his hardware and put in a 20MHz crystal. put my pic chip back in, and it worked too!! either the device workth with 20MHz or it was seriously over clocked.

so the problem is with my hardware, as we already knew ;)

going over every square mm with a multimeter, we discovered the problem.

the output of Port B.0 went to a 10K resistor, then to LED, then to ground.
but 10Kohm is WAY to high for an LED. it should be around 330 Ohm. oops... i did not catch this earlier because i had put my voltage supply (a big desktop power supply unity) on to the leg of the resistor and to ground and the LED lit up. so i thought "everything works".

but of course the power supply can provide MUCH more current than the PIC chip, so it was able to drive past the 10K resistor, where the PIC chip can not. i was fooled into thinking it was "ok".

i removed the 10K resistor and replaced it with lower value. it works fine :)

i hope that this thread we started will help future PIC newbies as it did for me!

Thanks for your help everyone.

Mr.Cool
 

hi, guys... i'm having a some problem to use PIC16F877A.

initially i use 20Mhz cystal to operate the PIC for around 1 months, but last few days the PIC doesn't work in the right way. so i began to troubleshoot... the PIC877 can be program, shouldn't be a big problem. the cap couple with the cyrstal is 15pF. master clear was connect properly, both Vdd & Vss connected also... but it doesn't work...

finally i found out that, it was my 20Mhz crystal having some very odd phenomena... which is i have to use my finger touch on it, only the PIC will work. or else it will stop. i tried it with some PWM or timer base program, say led blinking program. i have to use my finger contact with crystal only it will start to blink, but it do not look like the same timing as i play last time, it is much slower.lastly once i remove my finger from it, it stop...

i have try to separate remove the old crystal and place in a new 1 and this time i sepearate the crystal's leg. same thing again... then i decide to rebuild all the component in a brand new vero borad. bad news is it couldn't work at ALL... it is the same problem again. :cry:

can any1 tell me what's going on??? can i use a 4Mhz cystal? the code foe my PIC is PIC16F877A I/P 04083U4...
 

Sephirot_hr,

Check first if is there a broken via or a broken tack, or brocken zocket. Check if is there a broken cold solder, its normal on bad quality prototipes.

Second, your marking code of PIC is not for 20MHZ, it appears be only for 4MHz, so, even most pics of 4Mhz works ok on 20Mhz its not a good choice. So change your cristal for a lower than 4Mhz.

Good luck.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top