Worked DI-2008 slist example

Worked DI-2008 slist example

I figured out my problem in writing up a question. Here is the corrected write-up for posterity.

To understand the slist command, decode the example given for a DI-2008 (p. 40):

slist 0 2562
slist 1 2564
slist 2 3078
slist 3 9
slist 4 10
slist 5 8

Here is how to calculate slist 2 3078.

The slist command has form: slist <zero-offset> <16-bit config word>

The <zero-offset> determines the sampling order. The <16-bit config
word> defines the function (i.e. input/rate/count) and
scale/thermocouple.

For "slist 2 3078", the offset is 2. This means it will be sampled
third (b/c of zero-based indexing). 3078 is base-ten. This
is 0000 1010 0000 0010 in binary.

The <16-bit config word> parameter works as follows. The 16 bit
positions are grouped and each group has a different meaning. The
meaning of each group is provided by a protocol table. The position
numbering of bits goes right-to-left. For 3078 = 0000 1010 0000 0010
the positions are:

bit: ( 0 0 0 ) ( 0 1 ) ( 1 0 0 ) ( 0 0 0 0 ) ( 0 1 1 0 )
pos: ( 15 14 13 ) ( 12 11 ) (10 9 8 ) ( 7 6 5 4 ) ( 3 2 1 0 )

The meaning of each group is as follows. Group 3-2-1-0 represents the
four right-most columns of the DI-2008 Scan List Word Definitions
table (p. 42). Following the row to the left-most column gives the
corresponding function (Analog Channel/Digital In/Rate/Count). Group
7-6-5-4 is not used. The table only states that "unused bits = 0".
Group 10-9-8 gives the ROW to use in the DI-2008 Measurement table
(p. 43). Group 12-11 is the COLUMN to use in the DI-2008 Measurement
table. Position 12 is mode, position 11 is range. Group 15-14-13
also seems to be unused. Again, the table only says, "unused bits =
0".

Decoding goes as follows.

Group 3-2-1-0 is 0110. This is the 6th from last row on the far right
of the DI-2008 Scan List Word Definitions table (p. 42). The
left-most column of this row is "Analog channel 6".

Group 7-6-5-4 is all 0's, so unused. Ignore.

Group 10-9-8 is 100. So, use the fifth ROW of DI-2008
Measurement table (p. 43).

Group 12-11 is 01. The mode is 0 and range is 1. Use the second
column of the DI-2008 Measurement table (p. 43). Since Group 10-9-8
is 100, this corresponds to "+/-2.5V".

Group 15-14-13 is all 0's, so unused. Ignore.

Thus, 3078 = 0000 1010 0000 0010 => Analog Channel 6 +/-2.5V.