IO operation

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
Post Reply
Posts: 946
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA

IO operation

Post by basicchip » Thu Sep 25, 2014 12:19 am

>this is not a bug as reported by a user

Code: Select all

Sub PulseOut (PinNumber as Integer, Length as Integer) 'Length in mS
 IO(PinNumber) = NOT(IO(PinNumber)) 'this reversal works
 IO(PinNumber) = NOT(IO(PinNumber)) 'this one does not.
End Sub

IO is more complex than just setting a pin.

IO (as the Help files state) sets the direction of the pin then sets the drive level.

so IO(x) = NOT(IO(x))

is converting a pin to an input reading it and then converting to an output and driving it

But during the conversion to an input you are no longer driving it. So you really want to do--

OUT(x) = NOT(IN(x))

As OUT just changes the drive level, and IN reads the pin value whether or not it is being driven (also in the Help files)

Post Reply