#pragma GCC optimize "-Og"
#include "ArduinoTrace.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
PORTD=PORTD|(1<<PD4); //board pin 4 pull-up resistor
DDRB=DDRB|(1<<PB0); //led pin output
}
void loop() {
// put your main code here, to run repeatedly:
// if((PIND&0x10)==0) //si pulsador oprimido (bit 4 de PIND en 0)
// {
// PORTB=PORTB|(1<<PB0); //led on
// }
// else //sino:
// {
// PORTB=PORTB&~(1<<PB0); //led off
// }
// if((PIND&0x10)==0)
// {
// goto L10;
// }
// else
// {
// goto L20;
// }
asm goto
(
"sbis %0,4 \n"
"rjmp %l[L10] \n"
"rjmp %l[L20]"
:
:"I"(_SFR_IO_ADDR(PIND))
:
:L10,L20
);
L10:
//PORTB=PORTB|(1<<PB0);
asm volatile
(
"sbi %0,0"
:
:"I"(_SFR_IO_ADDR(PORTB))
:
);
//goto L30;
asm goto
(
"rjmp %l[L30]"
::::L30
);
L20:
//PORTB=PORTB&~(1<<PB0);
asm volatile
(
"cbi %0,0"
:
:"I"(_SFR_IO_ADDR(PORTB))
:
);
L30:
delay(100);
}