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.

Wireless Links<br />

Because there are three possible states, the information is trinary (as opposed to binary, with<br />

just two states). With five address inputs and three possible states for each, you can have as<br />

many as 243 receivers, each with its own address. Although data inputs D6-D9 also transmit<br />

in trinary form, the receiver decodes open inputs as logic 1’s, so in effect the data bits are<br />

binary. For testing, you can use jumpers or switches to +5V or ground, or leave the pins<br />

open, to set the data and address inputs.<br />

Transmit Enable (TE) has an internal pullup, which turns off the transmitter when pin 14 is<br />

not connected. To enable transmitting, TE must pulse low for at least 65 nanoseconds. For<br />

manual operation, you can use a jumper or switch (S1) to bring TE low.<br />

Components R1, R2, and C2 set the frequency of the on-chip oscillator. This in turn controls<br />

the width of the transmitted pulses. <strong>The</strong> figure shows the data sheet’s formulas and<br />

recommendations for selecting values for these components. For best performance, use<br />

components with 5% or tighter tolerance.<br />

With the values shown, the oscillator’s frequency is 1 kilohertz, which is at the low end of<br />

Motorola’s recommended range for the chip. With this frequency, the narrowest transmitted<br />

pulses are 500 microseconds wide. I chose this pulse width to be compatible with the<br />

requirements of the infrared module in the receiver circuit, which may not respond reliably<br />

at higher frequencies. If you have an oscilloscope or frequency counter, you can monitor<br />

the oscillator frequency at U1’s pin 12.<br />

For each transmission, the encoder sends all nine address and data bits in sequence, waits<br />

three data-bit times (24 milliseconds at 1 kHz), and then repeats the entire transmission. A<br />

complete transmission requires 182 milliseconds from the time that TE goes low. If you hold<br />

TE low, the encoder will transmit continuously. Otherwise, the transmission ends after<br />

sending the information twice.<br />

<strong>The</strong> encoder’s output drives infrared-emitting diode IRED1. Instead of directly driving the<br />

IRED with the encoder’s output (DATA OUT), NAND gate U2B combines DATA OUT with a<br />

40-kHz oscillator. <strong>The</strong> result is that the encoder’s pulses transmit as bursts of 40-kHz pulses.<br />

As we’ll see, the infrared receiver is designed to reject stray signals that don’t pulse at 40<br />

kilohertz. Pulsing the IRED also saves power, since the IRED is never on constantly.<br />

Oscillator alternatives. I’ve included a choice of two designs for the 40-kHz oscillator. One<br />

has a stable, accurate output but requires a special timing crystal, while the other uses more<br />

common components but requires a constant power-supply voltage and accurate resistor and<br />

capacitor values for best stability and accuracy. You can choose whichever you prefer, and<br />

connect the output to pin 5 of U2.<br />

<strong>The</strong> crystal-controlled oscillator uses a 40-kHz quartz crystal and an HCT132 Schmitt-trigger<br />

NAND gate (U2A) operated as an amplifier. If you substitute a different inverter, you<br />

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

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

Saved successfully!

Ooh no, something went wrong!