EXAR Corporation, 48720 Kato Road, Fremont, CA 94538 · (510) 668-7000 · FAX (510) 668-7017
Visit Exar Web Site at www.exar.com
DA T A COMMUNICA TIONS APPLICA TION NOTE
DAN-102
Infrared Application with ST16C580, ST16C650A or XR16C850 UART
Description
This application note describes the application of using the infrared encoder and decoder (Endec)
inside the Exar ST16C580, ST16C650A or XR16C850 UART for wireless data communications.
Although this appnote describes itCongraduations with a single channel UART, it also applies to the
XR16C2850/2852 DUARTs and ST16C654, XR16C854 and XR16C864 QUARTs. The Endec complies
with Infrared Data Association (IrDA) version 1.0 pulse shaping. The encoder converts each “zero”
data bit that consists of 16 segments to a pulse that is just 3/16 segment wide. This is done to conserve
battery power in portable instruments. The decoder detects the light from the transmitting LED and
converts it to a full bit time of 16 segments and assembles the bit into a character (data byte) for the
controlling CPU. Figure 1 on next page illustrates the CPU connections and vary examples of using
infrared LED and detectors, and transceiver modules.
1.0 Hardware
Figure 1 shows the connection from the controlling CPU to the UART. The controlling CPU interface
consists of an 8-bit data bus, 3-bit address bus, input/output read and write, chips select, interrupt
request and reset. The UART outputs the infrared pulses on IRTX pin and drives the infrared LED.
Upon power up, the IRTX output pin is at logic 1 state. After initialization, when IR mode gets enabled,
IRTX pin goes to logic 0 state to its idle condition. The infrared pulses come out at logic 1 state and
turns on the transistor that drives the infrared LED, see figure 1B. The 33 ohms current limiting resistor
determines the intensity of the LED for the operating distances. Figure 1C illustrates the use of an
external LED diode with an IR receiver . Also, infrared transceiver module may be used. The IR TX
output and IRRX input would be connected to a transceiver as shown in figure 1D and 1E. The RTS#
output from the UART is used to keep the IR transceiver shut down during power up and serves as an
enable function. The inverter on the receiver signal path is required for the ST16C580 and ST16C650A
but can be deleted when using the XR16C850 series because it has a software bit to invert the receive
data signal polarity .
2.0 Software
An initialization sample routine for XRT16C580, ST16C650A or XR16C850 is shown below . While the
routine is applicable to all 3 UARTs mentioned above, each UART has few enhancement of its own with
the main difference in FIFO size. The XR16C850 series has the receive data input inversion software
bit that would eliminate the need for an external inverter as shown in Figure 1D and 1E. Please consult
with their respective data sheet. They can be found in Exar’s web site.
set LCR to 0x80 ; point to special registers and
set DLL to 0x01 ; set baud rate to 115.2Kbps (assume a 1.8432 MHz crystal is used)
set DLM to 0x00 ;
set LCR to 0xBF ; point to enhanced registers, in XR16C850 only .
set FCTR bit-2 = 1 ; invert receive input signal, in XR16C850 only .
set LCR to 0x12 ; return to general registers and set character to 7 data, even parity and 1 stop bit.
set MCR to 0x4D ; turn on IR mode and RTS# to enable the IR LED or transceiver
set FCR to 0x1F ; enable FIFO mode with DMA mode 1 operation and
; set RX and TX FIFOs to 8 bytes trigger level for INT
set IER to 0x03 ; enable TX and RX interrupts
; load transmit data upon a TX empty interrupt (ISR bit-1=1) or poll the THR empty flag in
; LSR bit-5 for logic 1.
; unload receive data upon a RX interrupt (ISR bit-2 or bit-3) and
; check LSR for any data error or poll receive data ready bit in LSR bit-0 for logic 1.
EXAR Corporation, 48720 Kato Road, Fremont, CA 94538 · (510) 668-7000 · FAX (510) 668-7017
May 1999
EXAR Corporation, 48720 Kato Road, Fremont, CA 94538 · (510) 668-7000 · FAX (510) 668-7017
Visit Exar Web Site at www.exar.com
DA T A COMMUNICA TIONS APPLICA TION NOTE
DAN-102
Figure 1. 1 15.2Kbps Infrared Applications Examples
D0
1
D1
2
D2
3
D3
4
D4
5
D5
6
D6
7
D7
8
CS1
13
CS2#
14
CS0
12
A0
28
A1
27
TX
11
DTR#
33
RTS#
32
RX
10
DSR#
37
CTS#
36
CD#
38
RI#
39
OP1#
34
OP2#
31
IOR#
21
IOW#
18
RCLK
9
BAUD#
15
RESET
35
INT
30
X2
17
X1
16
A2
26
IOR
22
IOW
19
DDIS#
23
AS#
25
TXRDY
24
RXRDY
29
ST16C580CP
ST16C650ACP
XR16C850CP
VCC
10K
VCC
VCC
IRTX
IRRX
RTS#
27pF 27pF
1.8432 MHz
1M
D7
D6
D5
D4
D3
D2
D1
D0
SA0
SA1
SA2
RESET
IOW*
IOR*
IRQ
CS*
VCC
GND
VCC
TX
9
RX#
8
MD1
5
MD0
4
IRRX
IRTX
RTS#
FIGURE 1D - TRANSCEIVER A
HP HSDL-3610
Module
(www.hp.com)
0.47uF
XR7 Cer.
* RTS# keeps it shutdown during power up and enable when ready
15
VCC
2N4403
33
Temic
TSHA 550
or Equiv.
VCC
1k
IRTX
FIGURE 1B - TRANSMITTER
RTS#
* RTS# keeps LED off until enabled
10uF
Temic BPV22NF or Equiv.
IRRX
DIODE-C
1
DIODE-A
2
+5SE
T
7
IRRX
5
VCC
FIGURE 1C - RECEIVER
Novalog SIR2
Receiver
(www.novalog.com)
10uF
TX
2
RX#
3
SD
4
LED
1
IRRX
IRTX
RTS#
8.2
VCC
FIGURE 1E - TRANSCEIVER B
MiniSIR2 Module
(www.novalog.com)
* RTS# keeps it shutdown during power up and enable when ready