PDA

View Full Version : pic first build test board not running



comwarrior
- 28th June 2009, 12:43
hi everyone...
I finally got all the hardware and wrote a little test program for my pic (16f877A)
i built a llittle test board with 8 3mm red LED's
The test program i wrote is a simple knight rider led sequence...
I'm using a 20MHz crystal with 2 X 10pf caps. the programmer was set to HS crystal...

The software runs fine in my pic simulator software but i get no signes of life...
it's running off a since lithium ion cell with a voltage under load at 4.3 volts.

i've double checked the voltage is going to both sets of pins, i've re-verified the pic program by putting pic back in the prodrammer...

I've experience building circuits with the Z80180...

Does anyone have any ideas to find whats wrong?
Thanks

comwarrior
- 28th June 2009, 14:28
i double checked the led's... they all light up...
multimeter reads 1.8v DC, 0V AC on osc1... 0.8V DC, 0V AC on OSC2 compairred to VSS
my multimeter may not be sensitive enough to detect a 20MHz xtal fluctuations

Jumper
- 28th June 2009, 14:32
Try to turn on only one (or all) at the same time and leave them on. Toggle pins on the same port rapidy after each other can give RMW (read modify write) problems when running the pic at 20 MHz.

So all on or one, but leave the blink blink for step 2

/me

comwarrior
- 28th June 2009, 14:52
here is the program i threw together in about 2 mins just for a test sequence...



Define OSC 20
Define CONF_WORD = 0x3F72

ALLDIGITAL
TrisA = %00000000 'Set everything on port A as output
TrisB = %00000000 'Set everything on port B as output
TrisC = %00000000 'Set everything on port C as output
TrisD = %00000000 'Set everything on port D as output
TrisE = %00000000

main:
low 0
low 1
low 2
low 3
low 4
low 5
low 6
low 7

High 0
pause 500
Low 0
high 1
pause 500
low 1
high 2
pause 500
low 2
high 3
pause 500
low 3
high 4
pause 500
low 4
high 5
pause 500
low 5
high 6
pause 500
low 6
high 7
pause 500
Low 7
high 6
pause 500
low 6
high 5
pause 500
low 5
high 4
pause 500
low 4
high 3
pause 500
low 3
high 2
pause 500
low 2
high 1
pause 500
low 1

goto main
END


Reprogramming to turn all on and enter nop loop

Melanie
- 28th June 2009, 15:28
1. The 877A has multiple Ground and Power pins, make sure you have them all connected.

2. You did remember to do something meaningful with the MCLR pin?

3. Whilst you have defined OSC 20 for your program, you need to set HS OSC in the PIC Configuration Fuses. Whilst your program compiles wihout error, it didn't do much for the CONFIG Fuse settings for my programmer which remained at XT OSC.

4. I don't recall what the default Brown-Out is for that PIC (again my programmer reported it ENABLED by Default)... you might need to turn it OFF to run at 4.3v.

comwarrior
- 28th June 2009, 15:38
jumper:
I threw this code in and compiled it...



Define OSC 20
Define CONF_WORD = 0x3F72

main:
TrisB = %00000000 'Set everything on port B as output
PORTB = 255
goto main


oshon pic simulator reports all LED's on port B light up...
again, nothing on my test board...

Mel:
I'm using WinPIC800 and JDM programmer...
I'm loading the program and then clicking on settings and selecting HS under OSC...
Please correct me if i've wrong, but i thaught the CONF_WORD set the OCS type?

Thanks

comwarrior
- 28th June 2009, 16:09
when i re-read the chip into an empty winpic800 with default fuse options it reads the program and fuse settings in which it the fuse setting and switched to HS... so, i'm 99% sure it's setting the chip to HS... unless you want to tell me diferent...

sinoteq
- 28th June 2009, 16:31
Defines must be in capital letters DEFINE OSC 20.

Make sure MCLR is pulled up to VDD.

Make sure BOR is off.

I would take away the Conf_Word and set the config manually in my programmer. Just to make sure it is the correct setting, I have never seen your way of using a Define this way.

comwarrior
- 28th June 2009, 19:55
it seems i have some sort of oscilator problem...

it could be a bad solder joint or something like that... but it once lit all 8 LED's and then once i disconnected the power it refused to work again...
so i rebuilt the circuit on a small piece of plugboard and used a salvaged 1.4MHz crystal... wouldn't mind so much, but the pair of 20MHz crystals i've got spacifically to do the job are brand new...
The second crystal is allready in my proper build board...

I don't need the timing acuracy of an xtal but the speed will be required, has anyone got a formula for using RC? or is that not advisable at such speeds?

Thanks to everyone

comwarrior
- 28th June 2009, 21:57
i found the problem...

I re-checked my test board could find a problem... so i decided i must have a dead crystal so i went to unsolder it... and then i noticed that the solder created a line half way between the crystal pin and the pic's socket pin...

So it turns out that i had a hairline crack in the copper track that, quite frankly was so small that i couldn't see it dispite looking very closely...

So, theirs one for the FAQ... when using stripboard, run solder down the lines for the oscilator...

Also, it's worth noting that on my prototype plug board I tried a 24.576MHz crystal which worked too... even though my 16f877A I/P is rated at 20MHz... so thats a very nice 22% overclock...

Thanks to everyone for the help, especially Mel...

Jumper
- 29th June 2009, 12:08
Hi,

Speed= increased current consumption

that also means that the PIC will run hotter and this might work at room temperature but it will not for 100% sure keep you running at max ambient temp according to the datasheet.

As long as you keep that in mind ...

comwarrior
- 29th June 2009, 16:48
my PC is liquid cooled with an overclock of aproximatly 10% on my processor and about 15% on my gfx card... it's the best i can run in summer... looking farware to winters sub zero cooling...

thans for the warning Jumper, it's appreciated...