Renaming a I/O port

Discussion in 'Embedded Systems and Microcontrollers' started by Eric007, Aug 26, 2011.

  1. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,127
    36
    Hi All

    Is it legal to give a I/O port 2 names?

    For example:

    LEDPORT equ PORTA
    SWPORT equ PORTA

    The reason I'm asking this is that I have defined some pins as input and some other pins as output in the same PORTA

    Any comments would be appreciated

    Eric007
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,928
    1,795
    Nope, that is not a problem at all for the assembler.

    If it makes more sense for the person writing the software then by all means do so. Symbol names are much better then magic numbers as they are self-documenting.
     
  3. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,127
    36
    Thanks alot ErnieM!!!
     
  4. nigelwright7557

    Distinguished Member

    May 10, 2008
    508
    72
    I use the define keyword for ports.
    #define ERRORLED PORTA,1

    I then dont care what port or pin it is on.
     
  5. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,127
    36
    @nigelwright7557: Ok!
     
Loading...