Interfacing the PD243X
Alphanumeric Programmable Display
TM
with the
SAB80515/SAB80535 Microcontroller
To Produce a Bidirectional, Speed Regulated
Moving Message Display by Using the SAB80515/SAB80535's Timer 2 & 8-Bit
Converter
Appnote 49
This application note introduces the user to one of the features
of Timer 2 and A/D converter of the SAB 80515/535. Included in
this application note is a description of both the software and
hardware implementations of the SAS 80515/535 to use its
Timer 2 and 8-bit A/D converter for the bidirectional, speed reg-
ulated moving message display. The program listing demon-
strates how the Timer 2 and the 8-bit A/D converter of the SAB
80515/535 can be combined to generate time delays controlled
by analog levels. The hardware circuitry shows an interface of
the SAP 80515/535 with a simulated analog input, a 2 kbyte
EPROM, and intelligent display chips of Siemens used in mem-
ory mapped 1/0 scheme.
The SAB 80515/535 microcontroller with on-chip A/D converter
and a 16-bit Timer (Timer 2) with reload capability offers a solution
which can be applied to a wide range of industrial applications.
These applications vary from analog controlled digital delays to
controlled frequency converters for pulse width modulation.
In the present application example, the above features of the
SAB 80515/535 are used in conjunction to generate the soft-
ware delays. The software delay results in varying the voltage
level of the analog signal applied to the A/D converter of the
SAB 80515/535.
A/D Converter
The SAB 80515/535 provides an 8-bit A/D converter with eight
multiplexed analog input channels on-chip. In addition, the A/D
converter has a sample and hold circuit and offers the feature
of software programmable reference voltages. For the conver-
sion, the method of successive approximation with a capacitor
network is used.
Figure 1 shows a block diagram of the A/D converter. There are
three user-accessible special function registers:
—ADCON (A/D converter control register)
—ADDAT (A/D converter data register)
—DAPR (D/A converter program register) for the programma-
ble reference voltages.
2000 Infineon Technologies Corp. • Optoelectronics Division • San Jose, CA
www.infineon.com/opto • 1-888-Infineon (1-888-463-4636)
OSRAM Opto Semiconductors GmbH & Co. OHG • Regensburg, Germany
www.osram-os.com • +49-941-202-7178
Special function register ADCON is used to sele
eight analog input channels to be converted, to s
or continuous conversion, and to check the statu
which signals whether a conversion is in progre
The special function register ADDAT holds the co
8-bit data result. The data remains in ADDAT unt
ten by the next converted data. The new conver
appear in ADDAT in the 15th machine cycle afte
has been started. ADDAT can be read and writte
ware control. If the A/D converter of the SAB 80
used, register ADDAT can be used as an additio
pose register.
The special function register DAPR is provided f
ming the internal reference voltages IVAREF and
the present application DAPR holds a value of 0
value of DAPR, IVAREF and IVAGND are the sam
and VAGND respectively.
A/D Conversion
A conversion is started by writing to the special
ter DAPR. A “Write-to-DAPR” will start a new co
if a conversion is currently in progress. The conv
with the next machine cycle. The busy flag BSY
the same machine cycle as the “write-to-DAPR”
occurs. If the value written to DAPR is 00H, me
adjustment of the internal reference voltages is
conversion needs 15 machine cycles to be com
the conversion time is 15 µs for 12 MHz oscillat
After a conversion has been started by writing in
function register DAPR, the analog voltage at the
channel is sampled for 5 machine cycles (5 µs a
lator frequency), which will then be held at the s
for the rest of the conversion time.
The external analog source must be strong enou
the current in order to load the sample & hold ca
being 25 pF, within those 5 machine cycles.
1
Figure 1. Block diagram of A/D converter
AN0 – AN7
MUX
S&H
ANALOG
I/P
8-BIT A/D
CONVERTER
8
8-BIT ADDAT
REF–
ANALOG VALUE
FOR IVAGND
8
timers or event counters. Timer 2 is the tim
programmable Timer/Counter Register Arra
In addition to the operational modes “Timer”
Timer 2, being the time base for the PTRA u
the features of:
—16-bit reload
—16-bit compare
REF+
ANALOG VALUE
FOR IVAREF
VAREF
4-BIT D/A
CONVERTER
4-BIT D/A
CONVERTER
I
N
T
E
R
N
A
L
B
U
S
—16-bit capture
The reload mode of Timer 2 is used in this a
generate software delays. For explanation o
modes please refer to the users’ manual.
Reload
VAGND
4
4
MSB
8-BIT
DAPR
7
6
5
4
3
2
1
LSB
8
0
DIGITAL VALUE
FOR IVAREF
DIGITAL VALUE
FOR IVAGND
The reload mode for Timer 2 is selected by
T2R1 in special function register T2CON as
Table 1. In mode 0, when Timer 2 rolls over
all 0s, it not only sets TF2 but also causes t
isters to be loaded with the 16-bit value in t
pare/reload/capture) register which is prese
The reload will happen in the same machine
TF2 is set, thus overwriting the count value
Table 1. Timer 2 reload mode selection
T2RI
0
1
T2R0
X
0
1
Mode
Reload Disabled
8-BIT
ADCON
BD CLK
–
7
6
5
Baud System
Rate Clock
Enable Enable
BSY ADM MX2 MX1 MX0
4
3
2
1
0
Busy Conver-
Flag sion
Analog Input
Mode
Select
8
Conversion of the sampled analog voltage takes place between the
6th and 15th machine cycle after sampling has been completed. In
the 15th machine cycle the converted result is moved to ADDAT.
Timer 2
The SAB 80515 has three 16-bit Timer/Counters: Timer 0, Timer 1
and Timer 2. These Timers can be configured to operate either as
Figure 2. Functional diagram of Timer 2 in reload mode
Input
clock
Mode 0: Auto-Reload u
Overflow (TF2)
1
Mode 1: Reload upon F
Pin T2EX/P1.5
PD2435
TL2
TH2
The PD2435 is a CMOS 4-character 5x7 dot
numeric programmable display with ROM t
ASCII alphanumeric characters and enough
the display’s complete four digit ASCII mes
ware programmable attributes. The CMOS I
special interface control circuitry to allow th
control the module as a fully supported mic
peripheral.
Microprocessor Interface
T2EX
P 1.5
Mode 1
Mode 0
Reload
CRCL
Low Byte
CRCH
High Byte
TF 2
≥
1
The interface to the microprocessor is throu
lines (A0-A2), the data bus (D0-D7), two chi
(CE0, CE1), and (RD) and (WR) lines. The CE
held low and CE1 held high when executing
to a specific PD243X device. The read and w
are both active low. A valid write will enable
input lines.
Programming the PD2435
Compare/Reload/Capture Register
EXF 2
EXEN 2
Timer 2
Interrupt
Request
There are five registers within the PD2435.
isters are used to hold the ASCII code of th
characters. The fifth register is the Control W
used to blink, blank, clear or dim the entire
change the presentation (attributes) of indiv
characters.
2000 Infineon Technologies Corp. • Optoelectronics Division • San Jose, CA
www.infineon.com/opto • 1-888-Infineon (1-888-463-4636)
OSRAM Opto Semiconductors GmbH & Co. OHG • Regensburg, Germany
www.osram-os.com • +49-941-202-7178
2
Figure 3. PD2435 block diagram showing the major blocks
and internal registers
14
8
D0 – D7
DISPLAY
MEMORY
(RAM)
4x8
CTL
REG
1x8
A push button is interfaced to port P3.2 of the S
provide an external interrupt to the microcontrol
Firmware Description
8
128 CHAR.
ROM
48 x 80
4
7
CE0, CE1
A0 – A2
RD, WR
DECODE
&
MIX
OUTPUT
CONTROL
LOGIC
1
15
OUTPUT
LATCH
5
1
20
3
CLK SEL
XCK
RST
OSC
LOGIC
3
DISPLAY
MULTI-
PLEXER
COLUMN
DRIVERS
Besides controlling speed of the moving messa
provision to interrupt the moving message and ro
to the beginning of the message. The microcont
code and the message to display from an EPRO
faced to the ports P0 and P2 of the SAB 80535.
of the message is created in the internal RAM o
80535. Four display chips PD2435 are interfaced
80535 in a memory-mapped scheme and can be
external memory to the SAB 80535. The virtual
message in internal RAM of the SAB 80535 is u
late data to be displayed on the display chips. Th
used for the display can be viewed as an area di
portions:
1. For active display
2. As a data buffer
3
20
7
DISPLAY
ROW
DRIVERS
Application
The speed regulated moving message display is an example
where a digitized value of the controlling analog signal is used
to compute a reload value for the Timer 2. The Timer 2 is oper-
ated in mode 0 where this reload value becomes a starting
point for the Timer to count up. On overflow the Timer automat-
ically takes the restart value for counting from reload register
CRC. While the Timer is counting up, a new reload value is
computed using the present A/D value.
Hardware
The circuit used in this application has the advantage of requir-
ing a minimum of components. The single chip microcomputer
SAB 80535 operates in conjunction with four alphanumeric
programmable display chips PD 2435 to form a 16-digit long
display.
The ASCll-coded data is transferred from the SAB 80535 to the
display ICs via the data port P0 and using the control signal WR
(P3.6) of the SAB 80535. The address pins from the ports P0
and P2 of the SAB 80535 are used to address the EPROM as
well as the display chips in a memory-mapped l/O scheme. The
display chips are addressed as memory locations with the fol-
lowing addresses.
Display
Chip
1
2
3
4
Control Register
Address
1000H
2000H
4000H
8000H
Digits Address
1004H-1007H
2004H-2007H
4004H-4007H
8004H-8007H
The active display area is the replica of the data b
on the display chips. In this case the 16-digit disp
16 RAM locations which correspond to 16 digits
displayed. The data buffer contains the rest of th
which is not being displayed. The message is sh
by character in the RAM area. When the messag
play moves from right to left, the RAM buffer ac
First Out” mode, and when the message on the
from left to right, the data to the display from the
ler RAM buffer is supplied in the “Last In First O
Between display of every character there is a so
which depends upon the level of the analog sign
the ANO pin of the SAB 80535. The external inte
P3.2) is used to interrupt the microcontroller to i
the message needs to be scrolled backwards. O
interrupt the software sets the flag bit 0 which re
the message is scrolled back to the beginning o
List of Components
Name
SAB 80535
271 6A
PD2435
12 MHz Crystal
74LS373
22 pF Capacitors
100 nF Capacitor
4.7
µ
f Capacitor
1 k Resistor
10 k Pot
Reference Material for ICs
Numbe
1
1
4
1
1
2
1
1
1
1
1. SAB 80515/80535 User’s Manual.
2. PD2435 Data-Sheet or Optoelectronic Data B
2000 Infineon Technologies Corp. • Optoelectronics Division • San Jose, CA
www.infineon.com/opto • 1-888-Infineon (1-888-463-4636)
OSRAM Opto Semiconductors GmbH & Co. OHG • Regensburg, Germany
www.osram-os.com • +49-941-202-7178
3
Figure 4. Interface circuit
27
P3.6
10
RESET
4.7
µF
1K
+
VCC
24
19 A10
22 A9
23 A8
2716A
19
16
15
12
9
6
5
2
17
16
15
14
13
11
10
9
C2
22 PF
C1
22 PF
P2.2
43
P2.1
42
P2.0
41
ALE 50
51
EA
VAREF 11
VAGND 12
80515/
80535
VBB 37
P0.7
P0.6
P0.5
P0.4
P0.3
P0.2
P0.1
P0.0
59
58
57
56
55
54
53
52
C1
100nF
W1
W2
11
18
17
14
13
8
7
4
3
VCC
20 10 1
74LS373
D7
Q7
D6
Q6
D5
Q5
D4
Q4
D3
Q3
D2
Q2
D1
Q1
D0
Q0
12
13
14
15
16
17
18
19
6
5
7
8
9
D7
D6
D5
RD
D4
CLKSEL
D3
D2 PD2435
D1 DISPLAY
D0
CEO
GND
CE1
A2
WR
A1
A0
VCC
1
3
20
10
11
P3.6
12
13
14
15
16
17
18
19
6
5
7
8
9
PROM
A7
A6
A5
A4
A3
A2
A1
A0
D7
D6
D5
D4
D3
D2
D1
D0
µC
D7
D6
D5
D4
CL
D3
D2 PD24
D1 DISP
D0
CEO
CE1
A2
A1
A0
PSEN 49
GND 38
39
12 MHz
40
VCC
68
20 OE
GND CE
12 18
P2.4 P2.6
P2.3 P2.5 P2.7
44 45 46 47 48
12
13
14
15
16
17
18
19
6
5
7
8
9
D7
D6
RD
D5
CLKSEL
D4
D3
D2 PD2435
D1 DISPLAY
D0
GND
CEO
CE1
WR
A2
A1
A0
VCC
1
3
20
10
11
P3.6
12
13
14
15
16
17
18
19
6
5
7
8
9
D7
D6
D5
CL
D4
D3
D2 PD2
D1 DISP
D0
CEO
CE1
A2
A1
A0
Figure 5. Program flow chart
YES
Shift character
in RAM buffer
from bottom
to top up.
Transfer
character to
the top of
NO
RAM buffer.
START
Start address of
message in
DPTR. Character
count in R5.
Start address
of RAM buffer
in R0.
Read next
character of
the message.
interrupt
flag set?
Shift character
character = 0?
to display from
NO RAM buffer.
Wa
the
va
A/
YES
2000 Infineon Technologies Corp. • Optoelectronics Division • San Jose, CA
www.infineon.com/opto • 1-888-Infineon (1-888-463-4636)
OSRAM Opto Semiconductors GmbH & Co. OHG • Regensburg, Germany
www.osram-os.com • +49-941-202-7178
4
Program listing
UDISP
’PD 2435 Display PROGRAM’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$TITLE (‘PD 2435 DISPLAY PROGRAM’)
$MOD515
$NOSYMBOLS
CSEG
$DEBUG
....
0000
0000 02000C
ORG
LJMP
;
;
;
;
;
00H
BEGIN
;Jump on reset
This is the interrupt subroutine for INTO. This is used to set a flag
which then indicates that the message needs to be rolled back.
0003
0003 C0E0
0005 D2D5
0007 D0E0
0009 C289
000B 32
ORG
PUSH
SETB
POP
CLR
RETI
;
;
;
BEGIN:
03H
ACC
F0
ACC
IE0
;Set flag for external interrupt
MAIN PROGRAM
000C D282
000E 758110
0011 75D800
0014 C2D5
0016 7800
0018 79FF
001A 90F000
001D 7403
001F F0
0020 9000C2
0023 7820
0025 7D65
0027 7420
0029 F6
002A 08
002B DDFC
002D 12006C
0030 20D501
0033 0B
0034 7D65
0036 7820
0038 20D506
003B C6
003C 08
003D DDFC
003F 0158
0041 7421
0043 2B
SETB
MOV
MOV
CLR
MOV
MOV
MOV
MOV
MOVX
MOV
MOV
MOV
MOV
MOV
INC
DJNZ
CALL
JB
INC
MOV
MOV
JB
XCH
INC
DJNZ
AJMP
MOV
ADD
P3.2
SP,#10H
ADCON, #00H
F0
R3,#00H
R1,#0FFH
DPTR,#0F000H
A,#03H
@DPTR,A
DPTR,#(TEXT-1)
R0,#20H
R5,#101
A,#20H
@R0,A
R0
R5, BLANK
NEXTC
F0,TEMP
R3
R5,#101
R0,#20H
F0,REV0
A,@R0
R0
R5,SHFT
CONT0
A,#21H
A,R3
;Set bit for INT0
;Select analog channel 0
;Clear flag 0
;Character pointer in the message
;R1 used as a flag
;Control register of all displays
;Control word for display
;Beginning of the text
;Internal RAM location
;A count for 101 characters
;ASCII for space
;Fill all locations with blank
OPTS:
BLANK:
SHIF:
TEMP:
;Read the next character
;Check if the interrupt was raised
;If no interrupt
;Character count in message
;RAM location 20H
;If no interrupt
;Add the character
;To the top of the RAM buffer
;If there is no interrupt
;Offset for the RAM buffer
SHFT:
REV0:
2000 Infineon Technologies Corp. • Optoelectronics Division • San Jose, CA
www.infineon.com/opto • 1-888-Infineon (1-888-463-4636)
OSRAM Opto Semiconductors GmbH & Co. OHG • Regensburg, Germany
www.osram-os.com • +49-941-202-7178
5