18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

the LSTTL part, and wire the desired bit to the relay’s + input, with the relay’s - input<br />

connected to GND.<br />

Look for a relay with a control voltage of 5 volts or less, and input control current of 15<br />

milliamperes or less. <strong>The</strong> relay’s rated output voltages and currents should be greater than<br />

those of the load you intend to switch.<br />

Take care to work safely when you’re wiring, testing, and using circuits that control<br />

high-current or high-voltage loads. For circuits that connect to 117V line voltage and have<br />

a metal chassis, you can ground the chassis by connecting it to the safety-ground wire in a<br />

3-wire power cord. Insulate any exposed wires and terminals with heat-shrinkable tubing.<br />

If in doubt about how to wire the power connections, get qualified help before you continue.<br />

You can control a relay from any output port bit. Just write a 1 or 0 to the corresponding bit<br />

to switch the load on or off. If you control a solid-state relay with a port bit on an 8255 or<br />

the 8052-BASIC, you may have to add an LSTTL or HCMOS buffer (such as a 74LS244)<br />

to supply enough current to the relay’s control inputs.<br />

Controlling a Switch Matrix<br />

Control Circuits<br />

Figure 11-2 shows how you can use 9 output bits to control an 8 x 8 array of electronic<br />

switches. You can connect any of eight X inputs to any of eight Y inputs, in any combination.<br />

Possible applications include switching audio or video signals to different monitors or<br />

recording instruments, selecting inputs for test equipment, or any situation that requires<br />

flexible, changeable routing of analog or digital signals.<br />

A Mitel MT8808 8 x 8 analog switch array simplifies the circuit design and programming.<br />

<strong>The</strong> chip contains an array of crosspoint switches, plus a decoder that translates a 6-bit<br />

address into a switch selection, and latches that control the opening and closing of the<br />

switches. Maxim is another source for switch arrays like this.<br />

Connecting an X and Y input requires the following steps: Write the X and Y addresses to<br />

AX0-AX2 and AY0-AY2. Bring STB high. Bring DATA high to close the switch. Bring STB low<br />

to latch the data. To open a connection between an X and Y input, you do the same but bring<br />

DATA low to open the switch.<br />

You can make and break as many connections as you want by writing the appropriate values<br />

to the chip. All previous switch settings remain until you change them by writing to the<br />

specific switch.<br />

You can connect the switches in any combination. For example, you can connect one X input<br />

to each of the eight Y inputs, to create eight distinct signal paths. Or, you can connect all<br />

eight Y inputs to a single X input, to route one signal along eight different paths.<br />

<strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong> 187

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!