Shop OBEX P1 Docs P2 Docs Learn Events
mapping a var to output/input? — Parallax Forums

mapping a var to output/input?

ArchiverArchiver Posts: 46,084
edited 2001-03-11 16:14 in General Discussion
How about:

OUTL = OUTL & %11100001 + (drive * 2)

If you'd change your wiring to I/O 0...I/O 3, it would simply be:

OUTA = drive


Steve

On 11 Mar 01 at 9:04, Mike Eggleston wrote:

> Is there a way to map a nibble to out1-4?
>
> drive var out1 .. out4
>
> Mike
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-03-11 15:04
    Is there a way to map a nibble to out1-4?

    drive var out1 .. out4

    Mike
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-11 15:08
    [font=arial,helvetica]In a message dated 3/11/01 9:06:09 AM Central Standard Time,
    mikee@mikee.myip.org writes:


    Is there a way to map a nibble to out1-4?

    drive var out1 .. out4



    Yes, you just need to alias each of the four bits:

    drive ·····VAR ····Nib
    drv1 ······VAR ····drive.Bit0
    drv2 ······VAR ····drive.Bit1
    drv3 ······VAR ····drive.Bit2
    drv4 ······VAR ····drive.Bit3


    [/font]
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-11 15:20
    [font=arial,helvetica]In a message dated 3/11/01 9:09:20 AM Central Standard Time, jonwms@aol.com
    writes:


    Is there a way to map a nibble to out1-4?

    drive var out1 .. out4



    Yes, you just need to alias each of the four bits:

    drive ·····VAR ····Nib
    drv1 ······VAR ····drive.Bit0
    drv2 ······VAR ····drive.Bit1
    drv3 ······VAR ····drive.Bit2
    drv4 ······VAR ····drive.Bit3



    Oops...it's early and I haven't had enough coffee...that idea won't work for
    what you want. ·This time I actually opened up the Stamp compiler. ·After
    playing a bit, I'm pretty sure that you can't solve your problem through
    definitions only.


    [/font]
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-11 15:49
    in the stamp II's there are standard variables which map to the output pins

    there are sixteen output pins which are identified in several ways.

    each pin can be refered to individually out1, out2, out3

    or in bytes outh, outl

    or in nibbles...

    outa, outb, outc, outd

    it in the latestes stamp manual from parallax or in the faq that on the al
    williams site

    http://www.parallaxin.com or http://www.alwilliams.com


    so for example try this

    outa=> out0,out1,out2,out3
    outb=> out4,out5,out6,out7

    etc...

    (a very poor example follows )

    dirs=%11111111

    outa=%1100
    outb=%0011


    (poor example is done)

    i'm pretty sure this is correct. (i don't have my typical resources here).

    something useful with this that you may or may not need is breaking down larger
    types.

    w var word
    b var byte
    dirs=%111111

    outa=w.lowbyte.lownib
    outb=b.highnib


    i have had a few troubles with getting a particular pin to output (14) using the
    dirs variable on the IIsx and had to set them individually

    dir0=1
    dir1=1
    dir2=1
    etc...


    hope this is what you wanted,

    -pete

    On Sun, 11 Mar 2001, Mike Eggleston wrote:

    > Is there a way to map a nibble to out1-4?
    >
    > drive var out1 .. out4
    >
    > Mike
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >

    --
    Peter Green
    111 IATL peter-w-green@u...
    The Department of Mechanical Engineering office: 319.335.3694
    The University of Iowa lab: 319.335.3585
    Iowa City, Iowa 52242 fax: 319.335.5669
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-11 16:14
    That simplified my program and was just what I had overlooked.

    Thanks

    Mike

    Peter William Green wrote:

    > in the stamp II's there are standard variables which map to the output pins
    >
    > there are sixteen output pins which are identified in several ways.
    >
    > each pin can be refered to individually out1, out2, out3
    >
    > or in bytes outh, outl
    >
    > or in nibbles...
    >
    > outa, outb, outc, outd
    >
    > it in the latestes stamp manual from parallax or in the faq that on the al
    williams site
    >
    > http://www.parallaxin.com or http://www.alwilliams.com
    >
    > so for example try this
    >
    > outa=> out0,out1,out2,out3
    > outb=> out4,out5,out6,out7
    >
    > etc...
    >
    > (a very poor example follows )
    >
    > dirs=%11111111
    >
    > outa=%1100
    > outb=%0011
    >
    > (poor example is done)
    >
    > i'm pretty sure this is correct. (i don't have my typical resources here).
    >
    > something useful with this that you may or may not need is breaking down
    larger types.
    >
    > w var word
    > b var byte
    > dirs=%111111
    >
    > outa=w.lowbyte.lownib
    > outb=b.highnib
    >
    > i have had a few troubles with getting a particular pin to output (14) using
    the dirs variable on the IIsx and had to set them individually
    >
    > dir0=1
    > dir1=1
    > dir2=1
    > etc...
    >
    > hope this is what you wanted,
    >
    > -pete
    >
    > On Sun, 11 Mar 2001, Mike Eggleston wrote:
    >
    > > Is there a way to map a nibble to out1-4?
    > >
    > > drive var out1 .. out4
    > >
    > > Mike
    > >
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    >
    > --
    > Peter Green
    > 111 IATL peter-w-green@u...
    > The Department of Mechanical Engineering office: 319.335.3694
    > The University of Iowa lab: 319.335.3585
    > Iowa City, Iowa 52242 fax: 319.335.5669
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.