49:14 "Don't make it harder than it needs to be. Inside every complicated program there's a simple program /screaming/ to get out." THESE ARE WISE WORDS! If you take ANYTHING from this lecture, let it be this.
Love these lectures... Two questions though: 1) Would it make sense to use arrays of const uint8_t (instead of const int8_t) for your PROGMEM strings? Seems like you would give yourself twice the space for more ASCII characters, but I'm not sure how often you would need to use those characters above ASCII 127. 2) Are you sure that we need to include the null terminator on those strings going into PROGMEM? My understanding of C is that the null is added automagically by the compiler, when you put the literal inside double quotes. So while you would need to add a null terminator to "cap" a char array you build one by one, I've never had to do that when using an actual string literal. Anyway, thanks again for uploading these videos!
I did a bit more research on this, and came up with this link: www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38003&start=all&postdays=0&postorder=asc The bottom line is that you don't need to add the null terminator at the end of the string literal. As I suspected, GCC will handle this for you. Also, and a somewhat surprising finding for me, was that simply writing these constant strings into PROGMEM still results in them being pulled out and written into RAM when the program first starts (before main is entered). So it would appear that even though you are saving RAM by using flash memory to store the strings, you aren't really helping yourself all that much...unless you use PROGMEM-aware functions that will access them there. So in other words, you can really save the RAM space, because those strings will just get read from flash memory at runtime--not having to be loaded into RAM. But as the post I've linked to above indicates, you have to use the functions from the pgmspace.h header for this. Very good post there by Dean, on the AVR Freaks forum.
@@ece4760 , sorry. it seems that my edition didn't work. Is more like a suggestion. For "sampling" or debouncing many inputs at the same time with out using delays, which decrease processor performance, i'd recommend "vertical adders" algorithm... we have used back in 1990's. PICLIST at MIT. Thank you for your lecture!
49:14 "Don't make it harder than it needs to be. Inside every complicated program there's a simple program /screaming/ to get out." THESE ARE WISE WORDS! If you take ANYTHING from this lecture, let it be this.
It looks to me like a warning against a specific kind of coding, which, if used, will be hard to debug.
Love these lectures... Two questions though:
1) Would it make sense to use arrays of const uint8_t (instead of const int8_t) for your PROGMEM strings? Seems like you would give yourself twice the space for more ASCII characters, but I'm not sure how often you would need to use those characters above ASCII 127.
2) Are you sure that we need to include the null terminator on those strings going into PROGMEM? My understanding of C is that the null is added automagically by the compiler, when you put the literal inside double quotes. So while you would need to add a null terminator to "cap" a char array you build one by one, I've never had to do that when using an actual string literal.
Anyway, thanks again for uploading these videos!
I did a bit more research on this, and came up with this link:
www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38003&start=all&postdays=0&postorder=asc
The bottom line is that you don't need to add the null terminator at the end of the string literal. As I suspected, GCC will handle this for you.
Also, and a somewhat surprising finding for me, was that simply writing these constant strings into PROGMEM still results in them being pulled out and written into RAM when the program first starts (before main is entered). So it would appear that even though you are saving RAM by using flash memory to store the strings, you aren't really helping yourself all that much...unless you use PROGMEM-aware functions that will access them there. So in other words, you can really save the RAM space, because those strings will just get read from flash memory at runtime--not having to be loaded into RAM. But as the post I've linked to above indicates, you have to use the functions from the pgmspace.h header for this.
Very good post there by Dean, on the AVR Freaks forum.
Good lecture. I have some formation with PIC µicros. Hope to get into the AVRs with your videos..... captain.
Woo hoo!! I got Bruce's binary state machine to work for a touchscreen...and I'm just a dumb mechanical guy.
"Captain!, i have a question!"
"Captain"?
@@ece4760 , sorry. it seems that my edition didn't work. Is more like a suggestion. For "sampling" or debouncing many inputs at the same time with out using delays, which decrease processor performance, i'd recommend "vertical adders" algorithm... we have used back in 1990's. PICLIST at MIT. Thank you for your lecture!