
Originally Posted by
The Master
Hi, Ive not touched 16F877A's for a while but now i need to use one again and im having more problems with it. Ive written some test code and ive tried mister_e's code from
last time. My test code uses portD but ive tested ports A and B with mister_e's code too and im not picking anything up. Ive done all the usual checks (MCLR, Resonator, Capacitor etc). Ive checked the voltage with my oscilloscope and its extremely smooth. It almost looks like theres no load on it at all. The PIC is definately connected to it so im guessing its just not starting up correctly.
Sir...SIR!!!!
Put down the PIC...now step away from the PIC...Hands behind your ankles...
Is it in backwards? Ya never, know...could happen...
And this is my favorite test code...absolutely nothing fancy, but it tells me that things are working...
Code:
temp var byte
trisa = 0 'set all the pins to outputs
trisb = 0
trisc = 0
trisd = 0
trise = 0
'also turn analog ports to digital and/or set cmcon if applicable
main:
temp = temp + 1
porta=temp
portb=temp
portc=temp
portd = temp
porte = temp
'put a pauseus xxx here if the fastest pin (bit 0 for each port) is entirely too fast
goto main
That way each successive pin on each port will have exactly half the frequency of the pin before it. Of course things change with each different type of PIC and it's application, i.e. whether or not I'm using MCLR as MCLR or an I/O, whether or not I'm using OSC1/OSC2 as clock pins or I/O, and so on and so on...
Bookmarks