Knowledge Base

Here is the I/O map in SPLat equate format for the DM16.

There’s some really good technical information about using digital pins as outputs.

;-- digital inputs --
iIn0 iEQU 0 ;quadrature A
iIn1 iEQU 1
iIn2 iEQU 2 ;quadrature B
iIn3 iEQU 3
iIn4 iEQU 4
iIn5 iEQU 5
iIn6 iEQU 6
iIn7 iEQU 7
iIn8 iEQU 8
iIn9 iEQU 9
iIn10 iEQU 10
iIn11 iEQU 11
iIn12 iEQU 12
iIn13 iEQU 13
iIn14 iEQU 14
iIn15 iEQU 15
iDipSw1 iEQU 16
iDipSw2 iEQU 17
iDipSw3 iEQU 18
iDipSw4 iEQU 19

;-- digital outputs --
oOut0 oEQU 0
oOut1 oEQU 1
oOut2 oEQU 2
oOut3 oEQU 3
oOut4 oEQU 4
oOut5 oEQU 5
oOut6 oEQU 6
oOut7 oEQU 7
oOut8 oEQU 8
oOut9 oEQU 9
oOut10 oEQU 10
oOut11 oEQU 11
oOut12 oEQU 12
oOut13 oEQU 13
oOut14 oEQU 14
oOut15 oEQU 15
oLedOn oEQU 16
oLedGreen oEQU 17

;-- analogue inputs --
aiIn0 EQU 0
aiIn1 EQU 1

;-- analogue outputs --
aoOut0 EQU 0
aoDOut7 EQU 1
aoDOut8 EQU 2
aoDOut9 EQU 3

;-- serial --
COMTTL EQU 251
COM485 EQU 252
COMUSB EQU 253

The 8 digital I/O terminals are all active low, inactive o/c (open circuit).  You do not need to specifically configure them as inputs or outputs, they are simply always inputs and always outputs.  Be aware that to use a pin as an input, be sure not to use an output instruction to turn it on, otherwise it will switch low and can’t be used as an input.

As a side note, separation of the LED into on/off and green/red pins allows for some cute effects.  For example:

 On      oLedOn
Blink oLedGreen

These two instruction will cause the LED to automatically start blinking between red & green.