NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » delay.c issues with the 328p
December 07, 2009 by n3ueaEMTP |
OK, I got these snazzy new 328s the other day & got around to using them last evening at work, Everything complied fine & the program worked like a charm. I get home this morning and changed the code slightly and now the program will not compile. Here's what the error looks like: The only physical component changes are the addition of the LCD. I'm using the same laptop so the computer may not be the problem. I'm hesitant to change delay.c because it worked fine until now.
I've followed the directions to change the makefile for the 328 as well as adding #include "../libnerdkits/io_328p.h" to the programs. What confuses me the most is that it worked fine last evening at work, the only difference (as best I can tell) is the environment (home vs work). I'm assuming I've done something wrong but cannot figure out what it is, any ideas? |
---|---|
December 07, 2009 by jbremnant |
The error seems to indicate that you don't have delay.h in libnerdkits directory. Did you check whether you have the header file (delay.h) in the same dir as delay.c? |
December 07, 2009 by tech20 |
just to say, i have noticed that delay.c/.h is incompatible with any clock frequency other than the one of the crystal included in the nerdkit. You can use a code mod and some stricter coding guidelines (define F_CPU every time). You can try this code if you can't figure it out and define F_CPU if it's mot already.
|
December 07, 2009 by n3ueaEMTP |
Problems Solved, THANK YOU!!!! It turns out that I needed to add lcd.h & uart.h as well. Chris B. n3ueaEMTP |
December 07, 2009 by mrobbins (NerdKits Staff) |
Hi n3ueaETMP, Not sure why it was broken as "delay.h" includes a definition for NOP, but I'm glad to hear you got things working. tech20, your suggestion about using the avr-libc _delay_us and _delay_ms functions is interesting, but be aware that there are a few caveats to using them -- the big one being that "the delay time must be an expression that is a known constant at compile-time". Our delay functions did not have such a constraint. (In fact, since the delay_ms and delay_us things are themselves functions, I'm not sure that the compiler is smart enough to know that delay at compile-time.) Mike |
Please log in to post a reply.
Did you know that you can turn a $20 digital scale into a live weight sensor using our kit with a few extra parts? Learn more...
|