4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Arduinoでインラインアセンブラ

Last updated at Posted at 2016-02-16

単純な足し算をする。RdとRsが足し算され、結果はRdに格納される。

addvalue.ino

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  
  int val1 = 2,val2 = 3; 
  
  __asm__(
    "add %[Rd],%[Rs]"
    :[Rd] "=r" (val1)
    :[Rs] "r" (val2)
  );
  Serial.print("addvalue = ");
  Serial.println(val1);
}

void loop() {
  // put your main code here, to run repeatedly:
}


4
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?