More than 5 years have passed since last update.
Arduinoでインラインアセンブラ
4
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:
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
