Game Development Reference
Figure 12.8 Pinout for a 4051 multiplexer.
drive the multiplexer. A simple multiplexer that provides all the facilities we
need is a 4051 IC.
By setting the appropriate inputs to this device, we can cause the inputs
to the A/D converter to be directed from one of eight different sources. For
an eight-channel device, this gives a potential 64 inputs, sufficient for a full
body suit if required.
An A/D converter card is often set to port 0x300 on a PC. Ports
0x300-0x31F are designated for prototype cards and this type of card fits
into this description. The base address of the card can be set using DIP
switches if this address is unsuitable. The card has the address registers
shown in Table 12.1.
By connecting each potentiometer as shown in Figure 12.8, we can
send a signal between -5 V and +5 V to one channel of the A/D converter.
Table 12.1 Registers on the CIO-DAS08/Jr-AO card
A/D bits 9-12 (LSB)
Base + 1
A/D bits 1 (MSB)-8
Start 12-bit A/D conversion
Base + 2
A/D status and MUX address
Set A/D channel
Base + 3
Digital input, 8 bits
Digital output, 8 bits
Base + 4
D/A 0 LSB
Base + 5
D/A 0 MSB
Base + 6
D/A 1 LSB
Base + 7
D/A 1 MSB