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 Reply Children
  • ds a
    ds b
    ds c

    will automatically allocate separate spaces

    a equ 8
    b equ 9
    c equ 10

    works as well BUT if these get mixed up it EXTREMELY likely that some day some 'small program change' will result in two variables in same slot

    a equ 8
    b equ (a+1)
    c equ (b+1)

    does in some way remove the danger of the above.

    The one important thing here is to have ALL variables in the same place or you may end up with the stack in a place where you do not want it to be.

    Erik