Shop OBEX P1 Docs P2 Docs Learn Events
Pin redefinition — Parallax Forums

Pin redefinition

SpirosSpiros Posts: 2
edited 2006-11-18 19:06 in General Discussion
· Hallo to all. I'm in the early stages of learning to program the sx28·using assembly. I've made a few programs so far but I've reached a point where I have to find out how to perform a task which I was avoiding to tackle for some time.
· In order to make a pin easier to work with you can do this:
··· led1· EQU· RA.0
··· led2· EQU· RA.1
What I would like to be able to do is to redefine it some way. For example:
··· working_pin is led1
··· working_pin is led2
I know I don't have to explain to you how this could be helpfull.
Thank you very much.

Comments

  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-11-12 21:42
    Spiros,

    it is not fully clear to me if you want to re-define a port pin at run-time, or at assembly-time.

    SASM accepts "EQU" and "=" for defining constants, so at the first glance,

    led1 EQU RA.0 and led1 = RA.0

    seem to have the same effect.

    The difference is that a constant defined with an "=" can be re-assigned at another location in the source code. When you try the same with "EQU", SASM will flag an error.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • SpirosSpiros Posts: 2
    edited 2006-11-18 19:06
    Thank you very much for your reply. Also I'm trully sorry it's taken me this long to reply.My question was trully unclear since I myself hadn't understood what I was trying to do."Re-assignement at another location in the source code" was what I wanted to do and the use of = solved my problem.
    ·Again thank you very much.
Sign In or Register to comment.