Passing Port Pins as Arguments
JDOhio
Posts: 72
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
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
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
·