PDA

View Full Version : what on earth can I be doing wrong?



dmacq
- 7th February 2008, 22:48
Hi Everyone;

Thanks for your thoughts in getting me started with my Epic Programmer. I believe Picmate was looking in the wrong directory for the Epic so I switched to Microcode Studio, use it to write a hex file and then open Epic to load the hexfile into my chip.
I say BELIEVE, because the Pic still won't work.
EPIC appears to program and verify the 16F876 chip....but when I transfer it to my breadboard --- NOTHING.
I'm using a simple blink the LED program, listed here:


symbol LED = 0 'Rename pin 0 of portb (PIC 16F876 pin 21) to LED

TRISB = %00000000 'Setup port b as RB7-RB1 outputs, RB0 as output
main: 'Label for beginning of main loop
High LED 'Set pin 0 of portb high (5 volts) which turns the LED on
pause 1000 'Pause 1000 milliseconds (1 second) with LED on
Low LED 'Set pin 0 of portb low (0 volts) which turns the LED off
pause 1000 'Pause for 1 second with LED off
goto main ' Jump to the main label and do it again

END

I have quadrupled checked my connections on the breadboard with two different chips and I still get nothing. Tried two different crystals. Two different 5v sources. The logic probe indicates I've got 5v at all the correct places, and ground at all the right places, but the LED still won't blink ( yes I've tried reversing the leads. No dice)
And strangely, my logic probe records a high on RC6. Which is strange since I don't think I've bothered with Port C in any way.
Is there some configuration I haven't set? Is it possible the EPIC programmer only THINKS it's programmed the chip? Or have I found a brand new way to be confused?
ANY THOUGHTS would be appreciated since I would really like to get on with building the strange lights to frighten the villagers.


cheers

MacQ

duncan303
- 7th February 2008, 23:13
hi MacQ

Super quick guess if it progs and verifies but wont run

check your crystal/ resonator are you using internal RC?
have you told the programmer what you are using? intosc xt hs etc etc

sounds like it could just need an oscillator to clock against

duncan

skimask
- 8th February 2008, 20:15
Make it even simplier:


trisb = 0
main:
portb.0 = 1
pause 500
portb.0 = 0
goto main

No variables, no nothing to mess with anything...


And strangely, my logic probe records a high on RC6. Which is strange since I don't think I've bothered with Port C in any way
It's floating... All (ok, most) pins are set to input on RESET so they don't load down the external circuitry (well, that's one reason anyways). So, it's probably floating. I'd be willing to bet if you put a 'scope on it, grounded out the pin with a 1k resistor, it would go to 0v, then when the resistor was pulled away, it would rise 'slowly' back up to 5v.


Or have I found a brand new way to be confused?
Yep...you have...
Do a search on config bits and presetting, etc. There's a bunch of threads on presetting config bits and clock settings, etc.

dmacq
- 8th February 2008, 22:16
thanks skimask for offering the simpler code.

I think you're probably right about the floating pin. Although, I connected a 1k resistor to it and gorund and the pin is still high. I don't have a scope to check though.
I have checked the config settings and tried every option but RC. But no luck. Tomorrow I'll rewire it for RC and see if that makes any difference.

And Duncan303, I think you're right too. The oscillator is almost certainly the problem. But as I say I've tried every configuration and nothing works. I have a smaller 16f876 pic that I will try in the morning.

So frustrating. But thank you so much for trying to help

skimask
- 9th February 2008, 06:58
thanks skimask for offering the simpler code.
I think you're probably right about the floating pin. Although, I connected a 1k resistor to it and gorund and the pin is still high. I don't have a scope to check though.
I have checked the config settings and tried every option but RC. But no luck. Tomorrow I'll rewire it for RC and see if that makes any difference.
And Duncan303, I think you're right too. The oscillator is almost certainly the problem. But as I say I've tried every configuration and nothing works. I have a smaller 16f876 pic that I will try in the morning.
So frustrating. But thank you so much for trying to help

Try a different spot in the breadboard, or a new breadboard.
We've had more than a few discussions here in the past year or so about breadboards gone bad (I should make a video...I'd make million$ !!!)... contacts wearing out, dirty contacts, etc.

Darrel Taylor
- 9th February 2008, 07:13
... I switched to Microcode Studio, use it to write a hex file and then open Epic to load the hexfile into my chip.
I say BELIEVE, because the Pic still won't work.
EPIC appears to program and verify the 16F876 chip....but when I transfer it to my breadboard --- NOTHING.

And strangely, my logic probe records a high on RC6. Which is strange since I don't think I've bothered with Port C in any way.

Which button in MicroCode Studio did you use to compile the program?

Since the TX pin starts up as output high, it appears that you've compiled it for Debug mode (ICD Compile).
The Pic will sit and do nothing until it connects to the MCS Debugger via RS-232.

Use the buttons next to the Device select Drop-down box.
"Compile Only" or "Compile and Program"

hth,

dmacq
- 10th February 2008, 16:57
Which button in MicroCode Studio did you use to compile the program?
Use the buttons next to the Device select Drop-down box.
"Compile Only" or "Compile and Program"

hth,

Well, I'm somewhere north of humiliation and south of seppuku.
After the hours I spent scrupulously examining the components, the power supply, the configurations and the hex files.... I was clicking the wrong button.
Thank you Darrel for spotting the problem. The pic is happily blinking LEDs and even making music.
And thank you ALL for your helpful suggestions.
What a fabulous resource this is. I hope I can repay the favours and not make any more grotesque errors as I make my way through the learning curve.
I have to say the feeling of exhilaration is way out of proportion to the final result: a blinking LED. But it's made my weekend.
Thanks again.

Darrel Taylor
- 10th February 2008, 21:13
Put - The - Sword - Down!!!

If you continue programming microcontrollers ...
You will have MANY problems more deserving of seppuku.
Don't do it over you're first Blinky program. :)

There's 1 problem you won't have again.
Only about a million more to find. :eek:

Every one will be a "bitch".
But like you've already found out, the feeling you get when it finally works, makes it all worthwhile.

Happy PICing!