Tekkzz
Tekkzz

Reputation: 638

avr assembler: #define vs .equ, is it the same?

Is the avr-c command

#define baudrate 9600

the same like the avr-asm command

.equ BAUD  = 9600 

??

Upvotes: 3

Views: 5788

Answers (1)

mblw
mblw

Reputation: 1798

According to official guide (see 4.5.9):

The EQU directive assigns a value to a label. This label can then be used in later expressions. A label assigned to a value by the EQU directive is a constant and can not be changed or redefined.

equ is very similar to C-language #define directive, but there is one difference: equ can't be redefined.

Upvotes: 5

Related Questions