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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12<br />

Listing 12-2. Reads received data at the decoder.<br />

10 REM 8255 mode set: Ports A,C = output; Port B = input<br />

20 XBY(0FC03H)=82H<br />

30 REM A=decoder address (0-15)<br />

40 A=2<br />

50 REM Write address to Port C, turn TE (PC.7) off (high)<br />

60 XBY(0FC02H)=80H+A.OR.XBY(0FC02H)<br />

70 REM Use edge-triggered interrupt<br />

80 TCON=TCON.OR.4<br />

90 DO<br />

100 REM Wait for interrupt<br />

110 ONEX1 500<br />

120 WHILE 1=1<br />

130 END<br />

480 REM On interrupt 1, print received data<br />

490 REM Data is at Port B, bits 4-7<br />

500 PH0.(XBY(0FC01H).AND.0F0H)/10H<br />

510 RETI<br />

You can have more than one receiver in a link. If each has a unique address, it will accept<br />

only the transmissions meant for it.<br />

Increasing the Distance<br />

When you have your link up and running, one of the first challenges is to see how far you<br />

can reliably transmit. Two ways to increase the length of the link are by increasing the power<br />

of the transmitted signal, and by focusing the signal more precisely on the receiver.<br />

About Infrared Energy<br />

But first, some basics about infrared. Like visible light, infrared energy is a form of<br />

electromagnetic radiation. Infra means below, and infrared frequencies are just below those<br />

of red light. Infrared frequencies are invisible, or beyond the range detected by the human<br />

eye. Since wavelength is the inverse of frequency, infrared wavelengths are longer than those<br />

of visible light. Visible light covers the range 400-700 nm (nanometers), while infrared<br />

includes 700 nm through 1 million nm. (400 nanometers is 0.4 micron, or 4000 angstroms.)<br />

Infrared-emitting diodes, or IREDs, are low-cost, widely available sources of infrared<br />

energy. An IRED is a semiconductor diode that emits infrared energy when a forward current<br />

passes through it, much as an LED emits visible light.<br />

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

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

Saved successfully!

Ooh no, something went wrong!