1 year ago
#346510
Lyan Zepar
i'm getting a (expected unqualified-id before "." token, in my arduino IDE just for typing ".global". here's the assembly code
#define __SFR_OFFSET 0x00
#include "avr/io.h"
.global START
.global BTN_LED
START:
SBI DDRB, 2
SBI DDRB, 3
SBI DDRB, 4
CBI DDRD, 2
CBI DDRD, 3
CBI DDRD, 4
RET
BTN_LED:
SBIC PIND, 2
RJMP RED_LED_ON
SBIC PIND, 3
RJMP GREEN_LED_ON
SBIC PIND, 4;
RJMP BLUE_LED_ON
RJMP BTN_LED
RED_LED_ON:
LDI R21, 10 //CONTROLL FLASH TIMES
RED_AGAIN:
SBI PORTB, 2
RCALL XDELAY
CBI PORTB ,2
RCALL XDELAY
SUBI R21,1
BRNE RED_AGAIN
RJMP BTN_LED
GREEN_LED_ON:
LDI R21, 10 //CONTROLL FLASH TIMES
GREEN_AGAIN:
SBI PORTB, 3
RCALL XDELAY
CBI PORTB ,3
RCALL XDELAY
SUBI R21,1
BRNE GREEN_AGAIN
RJMP BTN_LED
BLUE_LED_ON:
LDI R21, 10 //CONTROLL FLASH TIMES
BLUE_AGAIN:
SBI PORTB, 4
RCALL XDELAY
CBI PORTB ,4
RCALL XDELAY
SUBI R21,1
BRNE BLUE_AGAIN
RJMP BTN_LED
.EQU DELAYVAL, 1000
XDELAY:
LDI R20, 90
OUTER:
LDI R30, lo8(DELAYVAL)
LDI R31, hi8(DELAYVAL)
INNER:
SBIW R30,1
BRNE INNER
SUBI R20, 1
BRNE OUTER
assembly
avr
0 Answers
Your Answer