Hi Rich,
Just declaring DEFINE OSC 8 does not set the clock completely. Are you using and external crystal or resonator or are you using the internal oscillator?
You program looks like it should work once the oscillator question is determined. It would hurt to add at the start of your program: TRISB = %00000000. 0's set the port pins to outputs and 1's set the pins as inputs. So if you wanted Port B.2 for example to be an input and the rest of Port B to be outputs then TRISB = %00000100 would take care of that. High and low statements make the particular output pin either high or low. You could set PortB.0 to low by saying PortB.0=0 or in your case just like you have it in your program.
I was trying to get online with Microchip to look at the datasheet for your PIC but they seem to be down right now. Look at the pin descriptions near the from of the datasheet. It describes the features available on each pin. If the Port B pins can be analog as well as digital then you must disable the analog feature as Kamikaze was saying.
I really think from the very limited information you have provided the problem is in the oscillator. Give us more information on that: internal vs external: if external are you using a crystal or resonator, 4 or 8mhz. I won't be back until tonight so maybe someone else might jump in here to help out, but I think what I have put here should help you get on track.
HTH,
BobK




Bookmarks