Shop OBEX P1 Docs P2 Docs Learn Events
Symbolic names for pins? — Parallax Forums

Symbolic names for pins?

ArchiverArchiver Posts: 46,084
edited 2003-03-25 21:51 in General Discussion
I'm trying to work out how to bind symbolic names to input pins. In
other words, I'd like to be able to refer to input pins using my own
name rather than IN1, IN2 etc.

Ideas?

_murat

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-03-25 19:06
    If this is a BS2 or variant, try:

    Myled var out9
    Switch var in2

    Etc.

    Of course, this doesn't work with things like HIGH and LOW that want
    numbers. So don't say:

    HIGH MyLed

    Since that will set 0 or 1 HIGH, not pin 9. However, you can do this:

    Myled var out9
    Myledp con 9

    HIGH Myledp

    Al Williams
    AWC
    * NEW: PAK-VIa - Read PS/2 keyboards or mice -- double the buffer, lower
    current consumption.
    http://www.al-williams.com/awce/pak6.htm




    >
    Original Message
    > From: m [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MAZVPlIOyWRJFjGp--NhIuwH9r5WcV5NnAW-9mcblqhuwOUnXJP5urS4D2uobTrCP6f1k8ER_3zVmun2IhmWu6s]murat_stamp@e...[/url
    > Sent: Tuesday, March 25, 2003 12:16 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Symbolic names for pins?
    >
    >
    > I'm trying to work out how to bind symbolic names to input pins. In
    > other words, I'd like to be able to refer to input pins using my own
    > name rather than IN1, IN2 etc.
    >
    > Ideas?
    >
    > _murat
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-25 19:23
    On Tuesday, March 25, 2003, at 07:06 PM, Al Williams wrote:

    > If this is a BS2 or variant, try:
    >
    > Myled var out9
    > Switch var in2

    Yes, this did the trick. Cheers!

    _murat
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-25 19:42
    Two ways:

    1. In PBASIC 2.0, you would alias them as variables, like this:

    AlarmLevel VAR In1

    This works because the Ins, Outs and Dirs registers (and their constituents)
    are part of the variables pool.

    2. In PBASIC 2.5 (you can download the beta compiler now), you can use the
    new PIN defintion:

    AlarmLevel PIN 1

    The advantage to PIN is that some PBASIC functions require a numeric value
    for the pin while others want the InX variable. Using the PIN declaration,
    the compiler handles handles the details.

    -- Jon Williams
    -- Parallax


    In a message dated 3/25/2003 12:16:39 PM Central Standard Time,
    murat_stamp@e... writes:

    > I'm trying to work out how to bind symbolic names to input pins. In
    > other words, I'd like to be able to refer to input pins using my own
    > name rather than IN1, IN2 etc.
    >
    > Ideas?
    >
    > _murat



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-25 21:51
    If you're using the new (Beta) compiler, the PIN definition deals with the
    issue that my buddy Al raises below.

    -- Jon Williams
    -- Parallax

    In a message dated 3/25/2003 1:50:38 PM Central Standard Time,
    alw@a... writes:

    > If this is a BS2 or variant, try:
    >
    > Myled var out9
    > Switch var in2
    >
    > Etc.
    >
    > Of course, this doesn't work with things like HIGH and LOW that want
    > numbers. So don't say:
    >
    > HIGH MyLed
    >
    > Since that will set 0 or 1 HIGH, not pin 9. However, you can do this:
    >
    > Myled var out9
    > Myledp con 9
    >
    > HIGH Myledp
    >
    > Al Williams



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.