This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Coding standards: EQU vs DS

(1) Is there a coding standard for 8051 assembler regarding use of:

foo equ 80h   ; some idata

and

foo:  ds 1
?

(2) What is your opinion?

Parents
  • The two statements have different purposes, and are not interchangeable. "Equ" defines a symbolic constant to help make the code readable and maintainable. "Ds" reserves memory for a variable.

    Equ would be appropriate for addresses that never move, such as SFRs or well-known fixed memory locations. Ds would be better for declaring various variables where you do not really care exactly where the variable lives, so long as you can find the space you need.

Reply
  • The two statements have different purposes, and are not interchangeable. "Equ" defines a symbolic constant to help make the code readable and maintainable. "Ds" reserves memory for a variable.

    Equ would be appropriate for addresses that never move, such as SFRs or well-known fixed memory locations. Ds would be better for declaring various variables where you do not really care exactly where the variable lives, so long as you can find the space you need.

Children
No data