SXB pin state read / write...
FORD
Posts: 221
Hi all,
I would like to read the state of an input·pin, and immediately put it inverted onto an output pin.
something like...
output <> input
what is the correct way to do this in sxb ?
i have tried a few methods, and get syntax type errors.
i dont want to have to resort to if/then statements etc.
any help appreciated.
cheers,
Chris Anderson
Western Australia
·
I would like to read the state of an input·pin, and immediately put it inverted onto an output pin.
something like...
output <> input
what is the correct way to do this in sxb ?
i have tried a few methods, and get syntax type errors.
i dont want to have to resort to if/then statements etc.
any help appreciated.
cheers,
Chris Anderson
Western Australia
·
Comments
I tried moving the inverted input directly to the output register but it doesn't compile as expected -- use a bit variable for temporary storage of the new state.
Post Edited (JonnyMac) : 4/29/2007 1:44:03 PM GMT
will try that tomorrow...
about top post another question if you wouldnt mind looking at it, i'm not at work, so cant check it myself (no tools here at home).
cheers, chris.
Is the input pin and the output pin the same pin ? Jon code makes that assumption.
If they are different pins then just use "OutPin = ~InPin"
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
And it turns out it will work fine in either case -- whether you're using the same pin or not. If using the same pin you'll need to deal with the output state after; if those pins (when using two) have previously been declared then you just need the one line.
Post Edited (JonnyMac) : 4/29/2007 7:33:02 PM GMT