title: Inline assembly code within my C ARDUINO program for a LED delay function
body: <p>I been set the task to replace the delay function in this simple blink arduino program</p>
  
  <pre><code>int ledPin = 13;
  
  void setup()
  {
    pinMode(ledPin,OUTPUT);
  }
  
  void loop()
  {
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
  }
  </code></pre>
  
  <p>So far I've I have this for the assembly function :</p>
  
  <pre><code>asm volatile(
  " lp1:   ldi r17,10         ;                \n"
  " lp2:   ldi r16,100        ;                \n"
  " lp3:   ldi r18,50         ;                \n"
  " np:    nop                ;                \n"       
  "        dec r18            ;                \n"
  "        brne np            ;                \n"
  "        dec r16            ;                \n"
  "        brne lp3           ;                \n"
  "        dec r17            ;                \n"
  "        brne lp2           ;                \n"
  "        sbiw r30,1         ;                \n"
  "        brne lp1           ;                \n"
  "        ret                ;                \n"
  );
  </code></pre>
  
  <p>I'm not sure if I'm right so far, but what I'm mainly confused with is how I'm going to call the function later in the program, so I can call it as many times I want</p>
  
  <p>Will be thankful for any help</p>