Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:piot:chapter_4_9 [2026/01/20 12:51] ktokarzen:multiasm:piot:chapter_4_9 [2026/01/20 12:59] (current) – [Examples] ktokarz
Line 36: Line 36:
  
 **Add two numbers using AVR registers** **Add two numbers using AVR registers**
 +<code c>
   void setup() {   void setup() {
     Serial.begin(9600);     Serial.begin(9600);
Line 44: Line 45:
       "add r24, r25\n"  // r24 = a + b       "add r24, r25\n"  // r24 = a + b
       "mov %0, r24\n"   // result = r24       "mov %0, r24\n"   // result = r24
-      : "=r"(result) +      : "=r"(result)    // agrument %0 
-      : "r"(a), "r"(b) +      : "r"(a), "r"(b)  // arguments %1, %2 
-      : "r24", "r25", "cc" +      : "r24", "r25", "cc" // preserve the content of r24 and r25
     );     );
     Serial.println(result);     Serial.println(result);
   }   }
   void loop() {}   void loop() {}
 +</code>
 ---- ----
  
 **Read digital input (PD2, bit 2 on PORTD)** **Read digital input (PD2, bit 2 on PORTD)**
 +<code c>
   void setup() {   void setup() {
     Serial.begin(9600);     Serial.begin(9600);
Line 68: Line 70:
     delay(200);     delay(200);
   }   }
-  +</code> 
en/multiasm/piot/chapter_4_9.1768906303.txt.gz · Last modified: by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0