Question

In AVR language, what's the difference between precompiler directives .def and .equ?

In AVR language, what's the difference between precompiler directives .def and .equ?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: .def and .equ both provide the same working feature but the main difference is one of them is constant another not. .DEF directive is not constant. It can be redefined in the rest of the sane program. But.EQU directive is constant. It can not be redefined or changed in the rest of the program.

The details of these two directives discussed below:

DEF - Set a symbolic name on a register

The DEF directive grants the registers to be mentioned by symbols. That defined symbol can be used in the rest of the program as a replacement of the register it is assigned to. A register can have various symbolic names attached to it. A symbol can be defined again next in the program. So it can be changed later in the program.

Syntax:

.DEF Symbol=Register

EQU - Set a symbol equal to an expression

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.

Syntax:

.EQU label = expression

Conclusion: EQU is constant DEF is not.

Add a comment
Know the answer?
Add Answer to:
In AVR language, what's the difference between precompiler directives .def and .equ?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT