Post your code that's not working with a note on your config fuse settings.
Post your code that's not working with a note on your config fuse settings.
<thanks to all for any advice>
After a long hair pulling session, figured out the 16F876 starts with the A/D running. I wanted digital out Pin 22 (RB1). This is turned off by command 'ADCON1=7' line.
Working code below to save someone else fustration:
' Ricky V
' 28 March 2005
' Blink Program
' MCU PIC16F876
' Rev 56,098,345
DEFINE OSC 4
ADCON1=7 'disable analogue to digital converter
TRISB = 0 'set all pins on Port B to outputs
LED VAR PORTB.1 'Sets which PIN the LED is on, Pin 22 +5V
loop:
High LED ' Turn on LED connected to PORTB.1 as Set in VAR LED
Pause 500 ' Delay for .5 seconds
Low LED ' Turn off LED connected to PORTB.1 as Set in VAR LED
Pause 500 ' Delay for .5 seconds
Goto loop ' Go back to loop and blink LED forever
End
=-=-=-=-=-=-=-=-==-=-==-=--=-=-=-=-=-=-==-=-=-=-=-==-
I'm glad to hear you got it working, but ADCON1 has no affect on PORTB.
PORTA is the 16F876 A/D port.
AN4 = RA5
AN3 = RA3
AN2 = RA2
AN1 = RA1
AN0 = RA0
I used your exact code (which I know works just from looking at it) and I get this error "Code Programming error at 0000" - any suggestions, help?
-------------------------------
DEFINE OSC 4
TRISB = 0 'set all pins on Port B to outputs
LED VAR PORTB.1 'Sets which PIN the LED is on, Pin 22 +5V
loop:
High LED ' Turn on LED connected to PORTB.1 as Set in VAR LED
Pause 500 ' Delay for .5 seconds
Low LED ' Turn off LED connected to PORTB.1 as Set in VAR LED
Pause 500 ' Delay for .5 seconds
Goto loop ' Go back to loop and blink LED forever
End
------------------------------
Your device programmer should have a help file listing several possible causes
for this particular error message. Lots of things can cause this one. Have you
worked through the list in the help file?
The problem was simple (once I got the installation documentation)
My Zif programmer is screwed down to a board, so I couldn't turn it around. NOW, I know what was happening and why.
I didn't just put my chip in a different direction, I had to turn aroud the Zif programmer and move the cable connector to the other side as well. So my school gave me a new programmer that was't screwed down so I could do that. It was simple, so I feel silly but all ends well.
Bookmarks