We are often asked if it is possible to connect a large number of buttons to x10i the answer is yes, the x10i has a built in multiplexer for reading inputs over a 4ms time slice. and here is how we suggest doing it:
Code:
SuperStrict
Framework heber.x10i
Import brl.polledInput
Import brl.retro
Global x10iBoard:TX10iBoard = New TX10iBoard.Create( encryptedKeyGeneric )
x10iBoard.InputMultiplexing( inputMultiplexEnabled )
Global minputs:usbMultiplexedInput = New usbMultiplexedInput
Repeat
x10iBoard.GetMultiplexedInputs( minputs )
Print ""
For Local bits:Int=0 To 3-1
For Local channel:Int=0 To 4-1
Print "Byte" + channel + " = " + Bin$( minputs.byMuxInp[channel,bits] )
Next
Print ""
Next
Delay(100)
Until KeyDown(KEY_ESCAPE)
x10iBoard.Close()
x10iBoard = Null
GCCollect
End
Rem
4ms Multiplexer OP12 OP13 OP14 OP15
| | | |
___ | | | |
IP0 ----------o---o o-->|--------------o | | |
| ___ | | | |
o---o o-->|--------------)-----o | |
| ___ | | | |
o---o o-->|--------------)-----)-----o |
| ___ | | | |
o---o o-->|--------------)-----)-----)-----o
| | | |
___ | | | |
IP1 ----------o---o o-->|--------------o | | |
| ___ | | |
o---o o-->|--------------------o | |
| ___ | |
o---o o-->|--------------------------o |
| ___ |
o---o o-->|--------------------------------o
) = bridge
O = connection
___
-o o- = switch
-->|-- = diode 1N4148
Using this schematic you can achieve a 60 input capability using only 15 inputs and 4 outputs.
EndRem