SPLat Logo

InputM ii+

NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

InputM ii+

(T=Z; Z=Y; Y=X;) X = input(ii)...input(ii+7)

Pushes the on/off state of 8 input points ii through ii+7 to X in individual bits of X. An On input gives a '1', and Off input gives a '0'.

Note with this instruction the inputs are debounced.  This differs from InputFM which doesn't debounce the inputs so is faster but prone to glitches.

Here's an example of reading a bunch of consecutive switches and doing something with them:


iSwitch1 iEQU 2
iSwitch2 iEQU 3
iSwitch3 iEQU 4

InputM iSwitch1 ;read 8 inputs, starting at the "lowest" switch
LoadX %00000111 ;mask off inputs..
AndM ;..we don't want
;now X contains a value from %000 (0) thru %111 (7) representing the 3 inputs
Branch ;branch on X
Target _SW000
Target _SW001
Target _SW010
;..etc..
Target _SW111

_SW000
;do something
Goto _End
_SW001
;do something
Goto _End
_SW010
;do something
Goto _End
_SW111
;do something
Goto _End


_End

See also OutputM