Shop OBEX P1 Docs P2 Docs Learn Events
pin names for the stamp2 — Parallax Forums

pin names for the stamp2

ArchiverArchiver Posts: 46,084
edited 2000-08-22 01:29 in General Discussion
I usually use the stamp1, but in this project i am using the stamp2
and am having trouble figuring out how to assign the i/o pins
meaningful names.
say for example that I have three pins that I wan to assign names:
many CON 0
moe CON 1
jack CON 2
and I also want to give on and off states meaninful names
light CON 1
nolight CON 0

obviously, one can see that I am doing something wrong, but i can't
seem to find any reference in any of the books on the stamp that I
own.

how to I name the stamp2's pins?

thank you for any assistance
p_stout@j...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-08-22 01:26
    Hi P,

    The CON is just a compiler directive which means 'constant'. That means that
    when you use the symbol (jack for example), it will be replaced (at compile
    time) by the value you specified into the declaration of the constant.
    Example :

    light CON 1
    radio CON 2
    TV CON 3

    high light ' set pin 1 high : turn on the light
    low radio ' set pin 2 low : turn off the radio
    high TV ' set pin 3 high : tunr on the TV

    This can be useful to parametrize a program :

    MaxOpt CON 5 ' maximum value of an option
    Option VAR byte
    .
    .
    .
    if option>MaxOpt then ...

    If you use MaxOpt everywhere in your program, it will be easy to change the
    number of options (for this example) by changing only the value of the
    constant (instead of searching-replacing all lines containing '5'...)

    Hope this is understandable, I'm more used to french...

    Best regards,

    Philippe Derenne


    Original Message
    From: <P_STOUT@J...>
    To: <basicstamps@egroups.com>
    Sent: Tuesday, August 22, 2000 2:10 AM
    Subject: [noparse][[/noparse]basicstamps] pin names for the stamp2


    > I usually use the stamp1, but in this project i am using the stamp2
    > and am having trouble figuring out how to assign the i/o pins
    > meaningful names.
    > say for example that I have three pins that I wan to assign names:
    > many CON 0
    > moe CON 1
    > jack CON 2
    > and I also want to give on and off states meaninful names
    > light CON 1
    > nolight CON 0
    >
    > obviously, one can see that I am doing something wrong, but i can't
    > seem to find any reference in any of the books on the stamp that I
    > own.
    >
    > how to I name the stamp2's pins?
    >
    > thank you for any assistance
    > p_stout@j...
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-08-22 01:29
    In a message dated 8/21/00 7:12:26 PM Central Daylight Time, P_STOUT@J...
    writes:

    > how to I name the stamp2's pins?

    That depends on how you want to use them. For HIGH and LOW, you can use
    simple, numeric defintions:

    MyLight CON 0
    .
    .
    .
    HIGH MyLight ' light on
    LOW MyLight ' light off

    Most of the time, however, you'll want to do this:

    LightOn CON 1
    LightOff CON 0
    MyLight VAR Out0

    Then you can write your code like this:

    MyLight = LightOn

    Of course, you'll have to define you inputs and outputs as needed.

    -- Jon Williams
    -- Dallas, TX
Sign In or Register to comment.