Hey guys I'm trying to figure out why this assembler routine isn't working. I'm using an atmega16U2 chip connected to my USB port. The routine is just the assembly equivalent of
"counthigh++;"
void loop() {
while (1) {
delay(2000);
Serial.write("\nx = ");
Serial.write((counthigh/10) + 48);
Serial.write((counthigh%10) + 48);
asm volatile (
"inc %0 \n\t"
: "=r" (counthigh)
:
:
);
}
}
The output on the serial monitor is:
x=00
x=02
x=02
x=02
x=02
...