NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Something very odd with the LED array code
June 07, 2014 by lailai |
I'd like to scroll a predefined message on my LED array. However, something very odd is happening - if I add the code to increment the character offset, the LED array gets broken BEFORE the code is actually executed! Here is my code (note the commented out line):
If I comment that line out, my LED array scrolls like: 'H H H H H '.. (expected) If I do not comment the line: '? ? ? ? ? '.. What is odd is that the first character becomes '?' even before the characterOffset++ has the chance to execute. I've tested that by placing a delay_ms(80000) before characterOffset++ is executed, and somehow it still screws up the first character despite never being executed ?!? |
---|---|
June 08, 2014 by Rick_S |
Many years ago, I heavily modified the NK code to give it much more flexibility for stored strings. While that writeup may still be available here, you can find it and the modified code on my website at rs-micro.com The test pattern function in my version of the program is all you need to modify to include the strings / characters you want to display. Rick |
June 08, 2014 by lailai |
Hi Rick, Thanks for sharing that code! I am still interested learning what is wrong with my current code though, for learning purposes. |
June 10, 2014 by lailai |
Any ideas? I'd really like to know what's happening here. I stripped the code to it's core and tested with gcc and it works as expected.. |
June 10, 2014 by lailai |
Interestingly: printf("%u", characterOffset); gives empty spaces in the serial connection.. Even though on the first run, it should be 0. I thought it may be running out of stack/heap (not sure correct term), but that doesn't seem to be the case.. |
Please log in to post a reply.
Did you know that NerdKits has been featured in the MIT Undergraduate Research Journal? Learn more...
|