NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » double delay time
October 01, 2015 by scootergarrett |
I think I'm loosing it. My delay functions are off by a factor of two, but the real time interrupts are fine. I run this delay code:
and get a ~2s delay between pin changes: then I run this code with OCR1A = 14399; for a one second delay, and that is exactly what I get.
Are the fuses I'm using wrong? I dont understand how the clock is wrong for some features. any ideas?
|
---|---|
October 02, 2015 by BobaMosfet |
scootergarrett- Make sure you are overriding the default F_CPU value in delay.h. BM |
October 05, 2015 by scootergarrett |
I don't understand how changing F_CPU will effect the delay code, its never used
|
October 08, 2015 by BobaMosfet |
scootergarrett- Sorry, I thought you were using standard library routines, not custom. Make sure the delay code you're looking at is actually getting included. Look at your disassembly. BM |
October 09, 2015 by scootergarrett |
I didn't think I was using custom librarys, this is what the Nerdkits uses right? |
October 09, 2015 by BobaMosfet |
scootergarrett- You'll have to look at how your compiler/makefile setup is. I know that what you're looking at doesn't match the macro I have in the delay.h file my compiler links in:
The thing is, the chip is going to do exactly what you tell it to do. So if the output doesn't match your expectation, you need to determine why your expectation is wrong, and find where you're misdirecting the computer. Debugging is about checking all assumptions at the door and methodically checking each possibility. BM |
October 09, 2015 by BobaMosfet |
substitute 'device' for computer in my last. It's all the same, it's binary. |
Please log in to post a reply.
Did you know that interrupts can cause problems if you're not careful about timing and memory access? Learn more...
|