Shop OBEX P1 Docs P2 Docs Learn Events
Passing Port Pins as Arguments — Parallax Forums

Passing Port Pins as Arguments

JDOhioJDOhio Posts: 72
edited 2006-06-17 02:35 in General Discussion
I was experimenting with the SEROUT command and found that the first argument, the port pin, must be the port pin directly:

SEROUT ra.0,T2400,"A"

I have an application for using multiple serial devices from the same SX machine so I would want to encapsulate SEROUT in such a manner that the port pin would be an argument to a wrapper:

'one serial device
MySEROUTFunction rb.0 'send a byte from rb.0
'another serial device
MySEROUTFunction rc.5 'send a byte from rc.5


MySEROUTFunction would be something like:

MySEROUTFunction:
temp1=__PARAM1
SEROUT temp1,T2400,"A"

Upon review of the SEROUT assembly, I though I could specify the port however I could not determine how to specify the pin.

Any ideas?

Joe

Comments

  • BeanBean Posts: 8,129
    edited 2006-06-17 02:35
    Joe,
    This was just asked a couple days ago.
    Pins cannot be passed as parameters because the assembly commands that set and clear a single bit are hard coded into the instruction.
    You could possibly do it if you made your own SEROUT command where you could specify the port and bit mask.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
Sign In or Register to comment.