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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 12<br />
causes brief, random pulses to appear at VOUT even when an IRED isn’t transmitting to the<br />
module. But as we’ll see, these random pulses are rejected by the decoder chip, which looks<br />
for a specific pulse pattern to identify the transmissions intended for it.<br />
To reduce false triggers on ambient light, you can ground MOD1’s case by soldering a wire<br />
from pin 3 to the case. You can also add more optical filtering, though for this application,<br />
it shouldn’t be necessary. Photographic film is a good, inexpensive filter that passes infrared<br />
and blocks visible light. Cover the photodiode’s window with an exposed, developed scrap<br />
of color-print negative film, or an unexposed, developed scrap of (positive) color-slide film.<br />
<strong>The</strong> signal at pin 1 of MOD1 is essentially the same as U1’s DATA OUT in Figure 12-1, but<br />
inverted. U5A inverts MOD1’s output so that pin 9 of U4 matches U1’s DATA OUT. You can<br />
substitute just about any CMOS inverter.<br />
<strong>The</strong> decoder chip. U4 requires timing components to match U1’s oscillator frequency. R9<br />
and C7 set the timing that discriminates between narrow and wide received pulses. R10 and<br />
C8 set the timing that detects the end of an encoded word and the end of a transmission.<br />
Figure 12-2 shows Motorola’s formulas and recommendations for choosing these values.<br />
U4 has five address lines (A1-A5), which must match A1-A5 on U1. As with U1, the inputs<br />
are trinary, and may be logic high, logic low, or open. For testing, you can set these with<br />
jumpers or switches.<br />
When MOD1 transmits, U4 examines the incoming bits at its pin 9. If the five address bits<br />
received match U4’s address, U4 stores the next four bits and compares them to the previous<br />
four data bits received. If the data bits don’t match, D6-D9 don’t change. If the data bits do<br />
match, the receiver latches the new data to D6-D9 and brings VT (pin 11) high to indicate that<br />
a valid transmission was received.<br />
<strong>The</strong> receiver doesn’t latch D6-D9 until it receives the same data twice in a row. This<br />
complements the behavior of U1, which automatically sends each transmission twice.<br />
Requiring the receiver to see the same data twice prevents the receiver from accepting data<br />
that was garbled in transmitting. <strong>The</strong> only way that an error can slip through is if the address<br />
transmits correctly both times, and the data contains the same error twice in a row—if a<br />
transmitted 0 shows up as a 1 at the receiver, for example. <strong>The</strong> chances of this are small,<br />
especially since the 40-kHz modulation adds another layer of rejection of unwanted signals.<br />
<strong>The</strong> data at D6-D9 remains until it is replaced by new received data. VT remains high until<br />
an error is detected or until there is no input for four data-bit times (32 milliseconds at 1<br />
kHz).<br />
Figure 12-2 shows LEDs at D6-D9 and VT for monitoring these outputs during testing.<br />
Current-limiting resistors aren’t required, since U4 sources only about 5 milliamperes<br />
206 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>