NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Compiler issue?
May 11, 2012 by RogerFL |
Mysteriously my LCD quit working - just writes to top row instead of using both lines of my two line display. After many hours of debugging, this "fix" makes me think this is a compiler bug or I'm not using the right compiler options. Here's the code (from the NerdKits LCD driver):
It only works if row_offset is defined at the top of the function and it is not initialized to zero. Causes a warning, but it works. Leaving it where it was (uncomment two lines down), causes row_offset to always be 0xff in that printf_P statement, when for second line it should be 0x40. I'm using the latest CrossPack. Here's the compile command and output:
Anyone else seen something like this? |
---|---|
May 11, 2012 by pcbolt |
Roger - I knew that problem rang a bell somewhere, so I tracked down This Thread. Humberto suggested changing the compiler optimizations. I know there was even another thread about it but I couldn't find it. I think Rick S. had a fix that involved just downloading and re-installing the original lcd.c and lcd.h files without the lcd.o file, then re-compiling. You mentioned using a 2-line display...was that from an older Nerdkit, before they shipped with the 4-line model? I know the 4-line model can be thought of as a 2-line model just displayed on 4 lines (if that makes any sense). |
May 17, 2012 by RogerFL |
pcbolt, thanks for the info! No, I got this 2-line LCD from sparkfun. But I did connect the 4-line display from NK and it had the same exact problem. Some optimizer bug related to switch statements seems to be the root cause. Thanks again. |
Please log in to post a reply.
Did you know that inductors try to keep their current constant over short periods of time? Learn more...
|