LoginSignup
4
2

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