Post Created date
signed to unsigned
Maybe GBaars wants it in offset binary, in which case you do add 0x80 (or EOR, but AVR lacks an immediate form so add is preferred): -128 becomes 0, 0 becomes 0x80, and +127...
Friday, 11 October 2013 - 19:23
(more noob stuff) - polling an input pin and odd behaviour
It might be your code, but you didn't post the code you're using to get feedback. How does the following run? (I'm assuming you have an LED connected to some pin on port B) int...
Friday, 11 October 2013 - 19:19
Question about multiple interrupts
Quote:When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served. I wonder whether...
Friday, 11 October 2013 - 03:30
Optimize but not soo much.. How?
SprinterSB wrote:wek wrote:IMO it's foolish to go this far to "help" the compilerIt's not about "helping", it's about aliasing because a write to char* might change p. Thus p *...
Thursday, 10 October 2013 - 21:25
Optimize but not soo much.. How?
Quote:IMO it's foolish to go this far to "help" the compiler Adding const, or caching in a local variable? If the latter, the way I see it, the maintenance cost of making a local...
Thursday, 10 October 2013 - 20:13
Optimize but not soo much.. How?
You actually don't even need to use the local copy approach, since making DATA_p const fixes this as well. That's less work. Regarding understanding why all of this occurs. Start...
Thursday, 10 October 2013 - 18:09
random number generation using srand()
You don't need to save the seed in EEPROM. Look up seeding the RNG based on a user button press. The basic idea is to precisely measure the time from when your code starts waiting...
Thursday, 10 October 2013 - 17:38
Local variable or Gloabal variables
Arguments in favor of locals over globals where you have a choice: Behavior: locals allow recursive/multi-threaded calls. Clarity: the local must be initialized when calling the...
Thursday, 10 October 2013 - 17:32
optimization and warning
It saves one instruction because of sbci and the way it sets the zero flag based on the first cpi, thus one only needs a single branch. From the 8-bit instruction ref: CPI: Z flag...
Thursday, 10 October 2013 - 00:50
Optimize but not soo much.. How?
sagi2313 wrote:So if I get it right, you suggest that i pass col[] as volatile? No; cache the pointer in a local variable if the compiler keeps needlessly reloading it: volatile...
Thursday, 10 October 2013 - 00:39
Optimize but not soo much.. How?
$ cat aliasing.c void f( char* a, volatile char* b ) { *a = 0; *a = 0; *b = 0; *b = 0; } char* c; volatile char* d; int main( void ) { *c = 0; *c...
Wednesday, 9 October 2013 - 17:19
#if #elif etc whats wrong?
#define OFFSET3 0x50 #define OFFSET2 0x60 #define OFFSET1 0x70 #define OFFSET OFFSET1 #if(OFFSET==OFFSET1) #define OFFSET_ADR 24 #elif (OFFSET==OFFSET2) #define OFFSET_ADR 16...
Tuesday, 8 October 2013 - 17:58

Pages