Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Flashing an LED problem...

Status
Not open for further replies.
Just re-read your post, if you did put in the loop as we showed, but the led still keeps on flashing, your code is not working right. Did you use the de-bugger to step through your code to see what happens when you hold in the button? You might want to add breakpoints after the delay or it will take a day to step through the code.
 
I didn't put the loop, I'm sure it works. When I step through the program, I change the timer to 2 cycles, so that I don't have to wait too long for the rest of the code to kick in. Then I replace the proper value once I'm satisfied everything works. With the loop does the program go into a watchdog timer brownout or something like that?

I'll be looking at the AD code, maybe I can just D/L an existing program and include it, that would be too easy... :)
 
If you have WDT enabled, just make your loop like this:

Code:
here   CLRWDT
         goto   here

edit: CLRWDT clears the watchdog so that it does not reset the CPU.

Edit to add some more: Put the loop in as we showed, it's the right thing to do :p .
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top