(the code needed to store tension[i] is actually relatively substantial:
tension[i] = word(tension_high, tension_low);
8d6: e0 91 2b 03 lds r30, 0x032B ; 0x80032b <i>
8da: f0 e0 ldi r31, 0x00 ; 0
8dc: ee 0f add r30, r30
8de: ff 1f adc r31, r31
8e0: eb 5c subi r30, 0xCB ; 203
8e2: fe 4f sbci r31, 0xFE ; 254
8e4: 80 91 29 03 lds r24, 0x0329 ; 0x800329 <tension_high>
8e8: 90 91 2a 03 lds r25, 0x032A ; 0x80032a <tension_low>
8ec: 89 27 eor r24, r25
8ee: 98 27 eor r25, r24
8f0: 89 27 eor r24, r25
8f2: 91 83 std Z+1, r25 ; 0x01
8f4: 80 83 st Z, r24
word() does not seem to be very optimal, nor does it get very optimized ![]()
It looks like things will improve substantially if you make some of the variables local to loop:
void loop() {
byte i = 0;
byte courant_low;
byte courant_high;
byte tension_low;
byte tension_high;
The loop code goes from ~84 bytes to 30 bytes!