1988 Intel Embedded Controller Handbook Volume I 8-Bit
1988 Intel Embedded Controller Handbook Volume I 8-Bit
EMBEDDED CONTROLLER
HANDBOOK
1988
Intel Corporation makes .no warranty. for .the use of its products and assumes no responsibility for any errors
which may appear in this document nor does it make a commitment to update the information contained
herein. ' .
Intel retains the right to make changes to these specifications at any time, without notice.
Contact your local sales office to obtain the latest specifications before placing your order.
The following are trademarks of Intel Corporation and may only be used to identify Intel Products:
MDS is an ordering code only and is not used as a product name or trademark. MDS® is a registered
trademark of Mohawk Data Sciences Corporation.
Additional copies of this manual or other Intel literature may be obtained from:
Intel Corporation
Literature D.istribution
Mail Stop SC6-59
3065 Bowers Avenue
Santa Clara, CA 95051
v
Table of Contents (Continued)
AP-252 Designing with the 80C51 BH ........................................ 10-310
AP-281 UPITM-452 Accelerates iAPX 286 Bus Performance ........•............ 10-334
ARTICLE REPRINTS
AR-409 Increased Functions in Chip Result in Lighter, Less Costly Portable
Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-354
AR-517 Using the 8051 Microcontroller with Resonant Transducers ............. 10-359
DEVELOPMENT SUPPORT TOOLS
8051 Software Packages. . . . . . . . . . . . . . . . . . . . . . • . . . . . . . . . . . . . . . . . . . . . . . • . . . . 10-364
iDCX 51 Distributed Control Executive ....................................... 10-372
ICETM 5100/252 In-Circuit Emulator for the MCS@-51 Family ................... 10-380
MCS@-51 INDEX ................................................... ; ........ 10-390
80C152 INDEX .................................•............................ 10-392
THE RUPITM FAMILY
Chapter 11
The RUPITM-44 Family..................................................... 11-1
Chapter 12
8044 Architecture ........................................... , . . . . . . . . . . . . . 12-1
Chapter 13
8044 Serial Interface ...................................................... 13-1
Chapter 14
8044 Application Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
Chapter 15
DATA SHEET
8044AH/8344AH/8744H High Performance 8-Bit Microcontrollerwith On-Chip
Serial Communication Controller.......................................... 15-1
APPLICATION NOTE
AP-283 Flexibility in Frame Size with the 8044. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 15-27
ARTICLE REPRINT
AR-307 Microcontroller with Integrated High Performance Communications
Interface .........................'. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 15-57
DEVELOPMENT SUPPORT TOOLS .
ICETM51 00/044 In-Circuit Emulator for the RUPITM-44 Family. . . . . . . . . . . . . . . . . .. 15-66
MCS®-80/85 FAMILY
. Chapter 16
DATA SHEETS
8080A/8080A-1 /80BOA-2 8-Bit N-Channel Microprocessor. . . . . . . . . . . . .. . . . . . . . 16-1
8085AH/8085AH-2/8085AH-1 8-Bit HMOS Microprocessors. . . . . . . . . . . . . . . . . .. 16-11
8155H/8156H/8155H-2/8156H-2 2048-Bit Static HMOS RAM with I/O Ports and
Timer. .. . . . . .. .. .. . . . .. . . .. .. . .. . . . . .. . . . .. . . . . . .. . . . .• . . . . . . . . . . .. .... 16-31
8185/8185-21024 x 8-Bit Static RAM for MCS@-85. ... . .. . . . .. . . . . .•. .. . .. .... 16-45
8224 Clock Generator and Driver for 8080A CPU ........... ~ ............. '. . . .. 16-50
8228 System Controller and Bus Driver for 8080A CPU. . . . . . . . . . . . . . . . . . . . . . . .. 16-55
8755A 16,384-Bit EPROM with I/O.......................................... 16-59
16-BIT PRODUCTS
MCS®-96 FAMILY
Chapter 17
MCS@-96 Architectural Overview. . . . . . . . . . . . . . . . . • . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1
Chapter 18 ,
MCS@-96InstructionSet................................................... 18-1
Chapter 19
MCS@-96 Hardware Design Information. . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . 19-1
vi
Table of Contents (Continued)
Chapter 20
80C196KA Architectural Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-1
Chapter 21
DATA SHEETS
809XBH/839XBH/879XBH with 8 or 16-Bit External Bus....................... 21-1
809XBH-10 Advanced 16-Bit Microcontroller with 8 or 16-Bit External Bus . . . . . . .. 21-44
809X-90, 839X-90 . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . .. . . . . . . . . . . . . . . . . . . . . .. 21-59
809XBH/839XBH/879XBH Express......................................... 21-78
809X-90, 839X-90 Express. . . . . . . . . . . . . . . . . . . .. . . .. .. .. . ... . . . . . . . . . . . . . . .. 21-87
80C196KA 16-Bit High Performance.CHMOS Microcontroller ................... 21-92
APPLICATION NOTES .
AP-248 Using the 8096 .................................................... 21-119
AP-275 An FFT Algorithm for MCS®-96 Products Including Supporting Routines
and Examples· .......................................................... 21-222
DEVELOPMENT SUPPORT TOOLS
MCS®-96 Software Development Packages .................................. 21-297
iDCX 96 Distributed Control Executive ....................................... 21-307
iSBE-96 Development Kit Single Board Emulator and Assembler for MCS®-96 .... 21-315
VLSICETM-96 In-Circuit Emulator for the MCS®-96 ............................. 21-323
ICETM-196 Real-Time Transparent 80C196 In-Circuit Emulator .................. 21-333
!'v1CS®-96 INDEX ............................................................ 21-335
80C196 INDEX ............................................................... 21-341
80186 FAMILY
Chapter 22
DATA SHEETS
80186 High Integration 16-Bit Microprocessor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-1
80C186 High Integration 16TBit Microprocessor . . . . . . . .. . . . . . . . . . . . . . . . . . . . . .. 22-53
80188 High Integration 16-Bit Microprocessor ................................. 22-111
80C188 High Integration 16-Bit Microprocessor ............................... 22-165
82188 Integrated Bus Controller for 8086, 8088, 80186, 80188 Processors ....... 22-225
APPLICATION NOTES
AP-186 Introduction to the 80186 Microprocessor ............................. 22-241
AP-258 High Speed Numerics with the 80186,80188 and 8087 ................. 22-316
AP-286 80186/188 Interface to Intel Microcontrollers .......................... 22-332
DEVELOPMENT SUPPORT TOOLS
8086/80186 Software Packages ............................................ 22-362
VAXIVMS Resident 8086/8088/80186 Software Development Packages ........ 22-383
8087 Support Library ...................................................... 22-391
80287 Support Library ..................................................... 22-395
iPAT Performance Analysis Tool ............................................ 22-399
12 1CETM Integrated Instrumentation and In-Circuit Emulation System ............. 22-412
ICETM-186 In-Circuit Emulator .............................................. 22-424
vii
Alphanumeric Index
27C64/87C64 64K (8K x 8) CHMOS Production and UV Erasable PROMs ............... 10-133
80C152JAl83C152JAl80C152JB Universal Communications Controller ............ , ... 10-117
80C186 High Integration 16-Bit Microprocessor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 22-53
80C188 High Integration 16-Bit Microprocessor ...................................... 22-165
80C196KA Architectural Overview ................................................. 20-1
80C196KA 16-Bit High Performance CHMOS MiGrocontrolier . . . . . . . . . . . . . . . . . . . . . . . . .. 21-92
80C31 BH/80C51 BH Express ...................................................... 10-69
80C31 BH/80C51 BH 8-Bit CHMOS Microcontrollers . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . .. 10-57
80186 High Integration 16-Bit Microprocessor....................................... 22-1
80188 High Integration 16-Bit Microprocessor ....................................... 22-111
80287 Support Library ..................... '....................................... 22-395
8031/8051 /8031AH/8051AH/S032AH/8052AH/8751 H/8751 H-8 8-Bit HMOS and HMOS
EPROM Microcontrollers ...................................... '. . . . . . . .. . . . . . . . . . 1O~ 1
8031 AH/8051 AH/8032AH/8052AH/8751 H/8751 H-8 Express .... . . . . . . . . . . . . . . . . . . .. 10-25
8032BH/8052BH 8-Bit HMOS Microcontrollers ....................... : . . . . . . . . . . . . .. 10-38
8044 Application Examples ...................................... ,................ 14-1
8044 Architecture. ,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1
8044 Serial Interface ............................ ~ . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1
8044AH/8344AH/8744H High Performance 8-Bit Microcontroller with On-Chip Serial
Communication Controller ...................................................... 15-1
8051 Software Packages ............ '............................................. 10-364
8051 AHP 8-Bit Control-Oriented Microcontroller with Protected ROM. . . . . . . . . . . . . . . . . .. 10-15
8080Al8080A-1 /8080A-2 8-Bit N-Channel Microprocessor. . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1
8085AH/8085AH-2/8085AH-1 8-Bit HMOS Microprocessors. . . . . . . . . . . . . . . . . . . . . . . . .. 16-11
8086/80186 Software Packages .................................................. ; 22-362
8087 Support Library ................... '.......................................... 22-391
809X-90, 839X-90 ...................................... ;........................ 21-59
809X-90, 839X-90 Express ...... : ...... ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 21-87
809XBH-10 Advanced 16-Bit Microcontroller with 8 or 16-Bit External Bus. . . . . . . .. . . . ... 21-44
809XBH/839XBH/879XBH with 8 or 16-Bit External Bus.............................. 21-1
809XBH/839XBH/879XBH Express ................................................ 21-78
8155H/8156H/8155H-2/8156H-2 2048-Bit Static HMOS RAM with I/O Ports and Timer.. 16-31
8185/8185-2 1024 x 8-Bit Static RAM for MCS®-85 ........ . . . . . . . . . . . . . . . . . . . . . . . . .. 16-45
82188 Integrated Bus Controller for 8086,8088,80186,80188 Processors .............. 22-225
8224 Clock Generator and Driver for 8080A CPU. . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . ... 16-50
8228 System Controller and Bus Driver for 8080A CPU ............................... 16-55
8243 MCS®-48 Input/Output Expander. .. . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . 4-1
83C152A180C152A Universal Communications Controller ............................ 10-102
87C257 256K (32K x 8) CHMOS UV Erasable PROM ................................. 10-146
87C51 Express .. ; .....................................................'. . ..... . . . .. 10-84
87C51 8-Bit CHMOS EPROM Microcontroller ..................................... ,.. 10-71
87C51 FA (87C252) CHMOS Single-Chip 8-Bit Microcontroller ......................... 10-87
8751 BH 8-Bit HMOS EPROM Microc~mtroller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10-27
8752BH 8-Bit HMOS EPROM Microcontroller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 10-46
8755A 16,384-Bit EPROM with I/O. . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 16-59
AP-275 An FFT Algorithm for MCS®-96 Products Including Supporting Routines and
Examples ...................... -......' ................................ '......... 21-222
AP-125 Designing Microcontroller Systems for Electrically Noisy Environments .......... 10-256
AP-155 Oscillators for Microcontrollers .......................................... , .. 10-278
AP-186 Introduction to the 80186 Microprocessor ................................... 22-241
AP-248 Using the 8096 ........................................................... 21-119
AP-252 Designing with the 80C51 BH ............................................... 10-310
AP-258 High Speed Numerics with the 80186, 80188 and 8087 ........................ 22-316
AP-281 UPITM-452 Accelerates iAPX 286 Bus Performance ........................... 10-334
viii
Alphanumeric Index (Continued)
AP-283 Flexibility in Frame Size with the 8044 ....................................... 15-27
AP-286 80186/188 Interface to Intel Microcontrollers ................................. 22-332
AP-70 Using the Intel MCS®"51 Boolean Processing Capabilities ....................... 10-211
AR-409 Increased Functions in Chip Result in Lighter, Less Costly Portable Computer .... 10-354
AR-307 Microcontroller with Integrated High Performance Communications Interface. . . .. 15-57
AR-517 Using the 8051 Microcontroller with Resonant Transducers .................... 10-359
D8748H/8749H HMOS-E Single-Component 8-Bit Microcomputer. . . . . . . . . . . . . . . . . . . . . 4-21
Hardware Description of the 8051, 8052 and 80C51 .................................. 6-1
Hardware Description of the 83C152 ............................................... 8-1
Hardware Description of the 83C51 FA (83C252) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 7-1
12 1CETM Integrated Instrumentation and In-Circuit Emulation System .................... 22-412
iDCX 51 Distributed Control Executive .............................................. 10-372
iDCX 96 Distributed Control Executive .............................................. 21-307
iPAT Performance Analysis Tool ................................................... 22-399
iSBE-96 Development Kit Single Board Emulator and Assembler for MCS®-96 ........... 21-315
ICETM 5100/252 In-Circuit Emulator for the MCS®-51 Family .......................... 10-380
ICETM-186 In-Circuit Emulator ..................................................... 22-424
ICErM-196 Real-Time Transparent 80C196 In-Circuit Emulator ......................... 21-333
ICETM51 001044 In-Circuit Emulator for the RUPITM-44 Family ......................... 15-66
MCS®-48 Expanded System ...................................................... 2-1
MCS®-48 Express ........................ , ..... ,., .. , ........ , ............. ,..... 4-33
MCS®-48 Instruction Set",·,',.".,"", .. " .. " .. ,',.,",." .. ,',.".,.,',., ... ,. 3-1
MCS®-48 Single Component System .. , ........ , .. , .. , . , ... , ..... , , . , .. , , . . . . . . . . . . 1-1
MCS®-51 Architectural Overview"" ... " .. " .. ,' .. ",.,", ...... ,"',.,." .. ,..... 5-1
MCS®-96 Architectural Overview ., .. , ... " .. , .. , .... ,., .. "." .. " ... ,., .. "...... 17-1
MCS®-96 Hardware Design Information",.", .. ,"",., ..... ".,", .. ".,., ... , •. ,' 19-1
MCS®-96 Instruction Set. .... , ... ,.,.............................................. 18-1
MCS®-96 Software Development Packages, .... , ... , .... , ... , ... , ............ , ..... 21-297
P8748H/P87 49H/8048AH/8035AHL/8049AH/8039AHLl8050AH/8040AHL HMOS
Single-Component 8-Bit Production Microcontroller ,."', ... , ....... , ... ,, ...... ,.. 4-8
The RUPITM-44 Family , .... , .. " ... ,.,"""""',.,',.,.,',.,"',.,', .. ".,"'" 11-1
UPITM-452 CHMOS Programmable I/O Processor .. , ......... , .. , , •.. , ... , ........ , .. 10-157
VAXIVMS Resident 8086/8088/80186 Software Development Packages, ........... , , . 22-383
VLSICETM-96 In-Circuit Emulator for the MCS®-96 " " " " " , .. , , .. , . , , , . , . , ..... , ... 21-323
ix
CUSTOMER SUPPORT
CUSTOMER SUPPORT
Customer Support is Intel's complete support service that provides Intel customers with hardware support, software
support, customer training, and consulting services. For more information contact your local sales offices.·
After a customer purchases any system hardware or software product, service and support become major factors in
determining whether that product will continue to meet a customer's expectations. Such support requires an interna-
tional support organization and a breadth of programs to meet a variety of customer needs. As you might expect,
Intel's customer support is quite extensive. It includes factory repair services and worldwide field service offices
providing hardware repair services, software support services, customer training classes, and consulting services. .
Intel is committed to providing an international service support package through a wide variety of service offerings
available from Intel Hardware Support.
Intel's software support consists of two levels of contracts. Standard support includes TIPS (Technical Information
Phone Service), updates and subscription service (product-specific troubleshooting guides and COMMENTS Maga-
zine). Basic support includes updates and the subscription service. Contracts are sold in environments which repre-
sent product groupings (i.e., iRMX environment).
CONSULTING SERVICES
Intel provideS field systems engineering services for any phase of your development or support effort. You can use
our systems engineers in a variety of ways ranging from assistance in using a new product, developing an application,
personalizing training, and customizing or tailoring an Intel product to providing technical and management con-
sulting. Systems Engineers are well versed in technical areas such as microcommunications, real-time applications,
embedded microcontrollers, and network services. You know your application needs; we know our products. Work-
ingtogether we can help you get a successful product to market in the least possible time.
CUSTOMER TRAINING
,
Intel offers a wide rimge of instructional programs covering various aspects of system design and implementation. In
just three to ten days a limited number of individuals learn more in a single workshop than in weeks of self-study.
For optimum convenience, workshops are scheduled regularly at Training Centers worldwide or we can take our
.workshops to you for on-site instruction. Covering a wide variety of topics, Intel's major course categories include:
architecture and assembly language, programming and operating systems, bitbus and LAN applications.
x
Preface
PREFACE
Computer systems can be characterized as being. "re- data storage onboard. The maximum program size is
programmable" or "embedded". Reprogrammable sys- 4 Kbytes. .
tems are those that look and behave like computers to
the ultimate user. An obvious example is the personal MCS@-51: Designed for advanced 8-bit sequential con-
computer. These systems contain some form of mass trol applications. These parts are similar to the
storage device which stores a number o( different com- MCS@-48 family parts but operate from 2 to 5 times
puter programs that the user may call up and use as faster and include more on-board peripherals. A unique
required. The input and output devices attached to feature of the MCS@-51 family is a built in Boolean
these systems are there to communicate with the user. processor which performs calculations on Boolean (one
Embedded systems, as the name implies, are contained bit) variables. The maximum program size is
within a final product which inay not look or feel like a 64 Kbytes. .
computer to the end user. An example here is a com-
puter which controls the ubiquitous office copier ma- MCS@-96: Designed for advanced 16-bit closed loop
chine. These systems rarely contain mass storage; the control applications. These parts include a processor
programs are stored in ROM or EPROM devices. The capable of high performance integer arithmetic and 232
input and output devices attached are not limited to bytes of general purpose registers which can be used for
communication with the user (e.g. the control panel); byte, word, or double-word operands. A separate sub-
they also monitor and control mechanisms and process- system manages timer functions. Versions are available
es within the device (e.g. the paper feed mechanism). with on-board A/D conversion and 8 Kbytes of on-
board program memory. A unique feature of the newer
Embedded control applications can be broken into (BH) members of the family is dynamic bus sizing
three broad categories; sequential control, closed loop which allows the parts to operate on both 8-bit and 16-
control, and data control. Sequential control deals with bit busses. The maximum program size is 64 Kbytes.
the control and monitoring of a system as a sequence of
events; activate the paper feed roller, wait for the paper 80186/80188: These parts are highly integrated ver-
feed indicator then activate the drum mechanism. sions of the 8086 microprocessor intended for data con-
Closed loop control involves closely monitoring the trol applications. They combine 15 to 20 of the most
output of process or device and altering its inputs to common 8086.system components onto one device. In-
achieve the desired output; if the feed roller motor is cluded with the CPU is the clock generator, an inter-
turning too slowly or is decelerating then increase the rupt controller; timers, DMA channels and chip. select
drive to the motor to compensate. These two categories logic. The 80186 operates on a 16-bit bus and the 80188
involve fixed programs that interface directly with the operates on an 8-bit bus. Both parts operate on a 16-bit
,outside world. The data structures involved are normal- bus internally. . .
ly small and simple. The third category of embedded
control (data control) still runs fixed programs but the Part of the motivation for combining all of these prod-
interface to the outside word becomes more indirect ucts into one handbook was the realization that,
and the data structures become larger and more com- although the categorization of embedded control appli-
plex. A high end copier might digitize an image and cations into the three segments (sequential, closed loop,
then use image processing techniques to enhance con- and data control) is useful for conceptualizing applica-
trast and then scale and rotate the image to fit the pa- tion requirements, real applications of these parts
per being used. contain attributes from all three categories. Combining
these product lines into one handbook will make it easi-
Intel has consolidated four of its product families in- er for customers involved with embedded applications
tended for embedded control applications into the Em- to find the information they require.
bedded Control Operation.
The remainder of this chapter will give a very brief
MCS@-48: Designed for general purpose 8-bit sequen- overview of each of the four products discussed. The
tial control applications. Versions of these parts are remainder of this book is intended to provide detailed
available with program storage and up to 256 bytes of technical information on Intel's embedded control
product line.
xiii
intJ PREFACE
Features common to all members of this family are: Features common to all members of this family are:
• 8-bit CPU with 1.36 microsecond instruction cycle • 8-bit CPU optimized for control applications
• 27 I/O lines • ,Extensive Boolean processing (single-bit logic) capa-
• 8-bit bit timer/counter bilities
• 2 interrupts • 32 bidirectional and individually addressable I/O
lines -
• 4 Kbyte maximum program size
• Fuil-Duplex UART
• 256 byte maximum on-board RAM size
• 5 source interrupt structure with 2 priority levels (6
• 256 -byte maximum off-board RAM size sources on parts with 3 timer/counters)
Intel has over ten years of experience in manufacturing • 64 Kbyte maximum program size
both the EPROM and ROM versions of this chip. It • 256 byte maximum on-board RAM size
provides a low cost solution to applications such as key- • 64 Kbyte maximum off-board RAM size
boards, low end printers, and electronic carburator con-
trol. • Po~er gown/Idle modes forCHMOS parts
Table 1. MCS®·48 Microcontrollers
Device ROMless EPROM ROM RAM
Name Version Version Bytes Bytes
8048AH 8035AHL 8748H 1K _64
8049AH 8039AHL 8749H 2K 128
8050AH 8040AHL - 4K 256
270253-1
xiv
inter PREFACE
The MCS-51 family has found wide acceptance capability. The 80C51FA contains, in addition to the
throughout a wide range of applications, ranging from standard timer counters, a programmable counter array
those slightly more complex than a typical MCS-48 ap- (PCA) capable of measuring and generating pulse infor-
plication through medical instrumentation and anti- mation on five I/O pins.
skid braking modules for automobiles.
This year Intel added two new base products to the MSC®-51 FAMILY DEVELOPMENT
MCS-51 family, the 80C152 and the 80C51FA. The TOOLS
80C152 contains, in addition to a UART, a Global
Serial Channel capable of CSMA/CD and SDLC syn- ICETM-5100 emulators give design engineers full-
chronous communication. It also has two DMA chan- speed, real-time, nonintrusive control over 8051 family
nels, the first member of the MCS-51 to have such system debugging at clock speeds up to 16 MHz. Each
i -- -----.
,,, ,,
,, ,,
,,
,,
, ,,
EXTERNAL
8K ROM
IN 8052 ;--_ • • • • • , ,-------.
TIMER 2 I
' COUNTER
256 RAM
4K
IN 8052 INPUTS'
ROM
TXD RXD
PO P2 Pl P3
ADDRESS/DATA
270253-2
emulator lets the user view and modify system activity Features common to all members of this family are:
at a symbolic, high-level language' level, speeding and • 16-bit timer (Timerl)
simplifying the development and debug phases of mi-
crocontroller system design, All of the ICE-5100 emu- • 16-bit counter (Timer2)
lators can be hosted on IBM PC Ars or compatibles, • Full-Duplex UART with independent baud-rate
or Intellec® Series III/IV development systems. Three generator
versions of ICE-5tOO are available today. ICE-5100- • Watchdog timer
252 supports HMOS and CHMOS versions of the fol-
lowing components: 8031, 8051, 8751, 8032, 8052, • 8-bit resolution Pulse Width Modulator (PWM)
8752, 80C31, 80C51, 87C51, 83C51FA, 80C51FA, and • 48 I/O lines (33 for 48-pin parts)
87C51FA. ICE-5100/452 supports: 80C452, 83C452, '. HSIO unit
87C452. The ICE 5100/044 supports: 8344, 8044, 8744,
and BITBUSTM components. The HSIO (High Speed Input/Output) unit is an inde-
pendent timer subsystem which manages Timer1 and
Available for the 51 family, ASM-51 and PL/M-51 Timer2 for the programmer. Events (e.g. setting an I/O
both contain a relocation and linkage utility and are pin) can be scheduled to occur automatically when ei-
available for the IBM PC and Intel Microcomputer De- ther of the two timers reaches a preset value. External
velopment Systems running either iNDX or ISIS oper- events can be recorded in a FIFO along with the value
ating systems. of Timerl when the event occurred. The HSIO is con-
nected to eight pins on the 8096 and can generate and
This complete, integrated design-in solution for the monitor events with a 2 microsecond resolution (12
MCS-51 family of microcontrollers speeds product de- MHz crystal).
velopment, and improves design team productivity.
In addition to an EPROM version, the 8X9XBH offer
several improvements over the non BH parts:
MCS®-96 MICROCONTROLLERS
• Dynamic selection of 8-/16-bit bus operation (versus
The MCS-96 Family of microcontrollers was designed fixed 16-bit bus)
for applications which combine high performance 16- • Programmable READY logic
bit fixed-point arithmetic with an immediate interface
• Sample and Hold input to the AID converter
to real world devices and events. The architecture is
based on a single 64 Kbyte address space. In addition to During 1987 Intel added a new series to the MCS-96
. being accessable as memory, the first 256 bytes of this family, the 80C196KA. This part is implemented on a
space are also' directly addressable as registers. These high performance CMOS process and offers significant-
locations are on-chip for high performance and can be ly more performance and reduced power levels. The
treated as byte, word, or double-word, operands by the design also includes many detail improvements while
programme!'. Twenty-four bytes of these registers are sti11 retaining compatibility with the NMOS versions of
used to control the on-board peripherals; the remaining the MCS-96 family.
232 bytes are usuable by the programmer as general
purpose registers. The combination of a register file, on- The MCS-96 family is being used now in a wide variety
board I/O, and a high performance 16-bit CPU .makes of complex control tasks such as robotics, motor con-
the MCS-96 family well matched to closed loop control
applications.
xvi
intJ PREFACE
VREF ANGND
POWER
DOWN
m___ __ m~
FREQUENCY
REFERENCE
CLOCK
GEN
-t 8
Uu:_~- Uj
ROM OR EPROM I
(OPTIONAL):
....."T"--r...... :
I
I CONTROL
SIGNALS
trol, hard disk mechanisms, printers, modems, automo- cations. Six of the most often used functions of an 8086
tive engine control and high performance anti-skid system have been integrated <into a single chip. Along
braking applications. with higher integration, the 80186 offers higher per-
formance than the standard 8086 via detailed improve-
ments to the design. The 80186 family consists of two
MCS®-96 FAMILY DEVELOPMENT processors; the 80186 and the 80188. These processors
TOOLS have identical capabilities except that the 80186 oper-
ates on a 16-bit bus while the 80188 operates on an
Intel offers a variety of development tools to support 8-bit bus. The 80186 offers higher system performance
the MCS-96 family of microcontrollers. The iSBE-96, a with its 16-bit bus; the 80188 offers lower system cost
low-cost single board emulator, emulates the 8X9X mi- with its 8-bit bus. Both processors operate internally
crocontrollers. VLSiCE-96 provides complete in-Circuit with a 16-bit bus and generates a 20-bit address to give
emulation of the 80C196KC microcontroller. The a total address space of 1 Megabyte.
ICETM-196PCIn-Circuit emulator provides real-time,
transparent emulation of the 80C196KA microcontrol- Although these parts are object code compatible with
ler. All three emulators are efficient and versatile tools the 8086, most of the instructions complete in fewer
for developing, debugging and testing real-time MCS- clock cycles because of enhanced CPU and bus control
96 applications. logic. In addition, many new instructions have been in-
cluded to simplify assembly language programs and to
Software for the MCS-96 family includes macroassem- enhance operation with high level languages. These
bier (ASM-96) which is available along with PL/M-96 new instructions have been included in the 80286 and
and C-96 compilers: Each software package includes 80386 high performance microprocessors.
relocation/linkage utility, library creation utility, and
FPAL-96, a 32-bit floating-point utility. Software runs Besides the processor itself, the major features of the
on IBM PC and Intellec Series III/IV. 80186 and 80188 include:
• 2 Channel DMA (Direct Memory Access) unit
80186 HIGH INTEGRATION • 3 16-bit timer/counters
MICROPROCESSOR
The 80186 family of microprocessors was designed to
bring the 8086 architecture to embedded control appli-
xvii
inter PREFACE
The 80186 processors are used in high end printers, Software support for the 80186 family consists of Ii
data concentrators, robotics, and many other applica- macroassembler, which also includes linker, locator,
tions which require the high performance of a 16-bit mapper, numerics library, and librarian. High level lan-
microprocessor along with the cost-effectiveness of a guages include PL/M, C, Fortran, and Pascal compil-
highly integrated computer system. Because it has ob- ers with full source code display. Hosts include IBM
ject code compatibility with the industry standard 8086 PC, VAX/VMS', and Intel Development Systems. In-
processor, a wide variety of support is readily available. tel's software tools have been designed to provide opti-
These range from simple programs written to run under mal performance when used with an PICE or Intel's
MS-DOS' to complex operating systems such as ICE-186.
iRMX®-86 and XENIX·.
INT3IiIifAi
INT2IIIITllI
CLKOUT Vee GND
INT1
ExECUTION uNiiJ
I
1S-B1T I
.AW PROGRAMMABLE
I INtERRUPT
I CONTROLLER MAX COUNT
REGISTER ..
I
I CONTROL REGISTERS
I
L...-.,.--..l.-i
r----I-ORao
ORQ1
BHOY
AROV
2I).II1T
'!!IT DESTINATION
HOLD POINTERS
HLOA ,8·11T
lin TRANSFER COUNT
RESET
CONTROL
REOISTERS
270253-4
The arithmetic section of the processor contains the basic Resident program memory consists of 1024,2048, or 4096
data manipulation functions of the 8048AH and can be words eight bits wide which are addressed by the program
divided into the following blocks: counter. In the 8748H and the 8749H this memory is user
programmable and erasable EPROM; in the 8048AH/
• Arithmetic Logic Unit (ALU) 8049AHl8050AH the memory is ROM which is mask
programmable at the factory. The 8035AHL/8039AHL/
• Accumulator 8040AHL has no internal program memory and is used
with external memory devices. Program code is com-
• Carry Flag pletely interchangeable among the various versions. To
access the upper 2K of program memory in the 8050AH,
• Instruction Decoder , and other MCS-48 devices, a select memory bank and a
JUMP or CALL instruction must be executed to cross the'
,In a typical operation data stored in the accumulator is 2K boundary.
combined in the ALU with data from another source on
the internal bus (such as a register or 110 port) and the There are three' locations in Program Memory of special
result is stored in the accumulator or another register. importance as shown in Figure 2.
The ALU accepts 8-bit data words from one or two sources Therefore, the first instruction to be executed after ini-
and generates an 8-bit result under control cif the Instruc- tialization is stored in location 0, the first word of an
tion Decoder. The ALU can perform the following external interrupt service subroutine is stored in location
functions: 3, and the first word of a timer/counter service routines
EXPANSION TO
MORE 110 AND
MEMORY
RESIDENT
EPROM ROM
"11
cac
Cil ~
:- Z
CXI C)
~ r-
CXI m
:J:
CD o
o
PORT 1
BUS
o
~
CXI
BUFFER s::
:J:
AND "C
LATCH
o
~ Z
m
~ Z
~
'" CD
o
UI
REGISTER
REGISTER
REGISTER
-I
s::
o
~
U)
TEST 0 REGISTER ®
:J: I
REGISTER ~
ID TEST 1 CCI
g
t
REGISTER U)
INT
w
..:'
C
FLAG 0
c
c
0
REGISTER
~
vee .. PROGRAM SUPPLY w REGISTER -I
iii"
ea POWER V ,....._-'-_ _, FLAG 1 C m
iii
SUPPLY ~ +5V (LOW POWER STA.NDBY) i
TIMER
8 LEVEL STACK
(VARIABLE LENGTH) s::
~GND
FLAG
3 CARRY
OPTIONAL SECOND
REGISTER BANK
Ace
DATA STORE
ACCBIT
TEST
RESIDENT
RAM ARRAY
INTERRUPT I PROMI . CPU! OSCILLATOR ADDRESS PROGRAM SINGLE READ
EXPANDER MEMORY XTAL LATCH MEMORY STEP WRITE
STROBE SEPARATE STROBe ENABLE STROBES
CYCLE
INITIALIZE
CLOCK
SINGLE COMPONENT MCS®-48 SYSTEM
is stored in location 7. Program memory can be used to registers in place of locations 0--7 and are then directly
store constants as well as program instructions. Instruc- addressable. Th,is second bank of working registers may
tions such as MOVP and MOVP3 allow easy access to be used as an extension of the first bank or reserved for
data "lookup" tables. use during interrupt service subroutines allowing the reg-
isters of Bank 0 used in the main program to be instantly
"saved" by a Bank Switch. Note that if this second bank
-D
is not used, locations 24-31 are still addressable as general
purpose RAM. Since the two RAM pointer Registers RO
and RI are a part of the working register array, bank
switching effectively creates two more pointer registers
(ROland Rlf) which can be used with RO and Rl to easily
access up to four separate working areas in RAM at one
time. RAM locations (8-23) also serve a dual role in that
2 0 4 S L = : J . . l .SEL. MB1 they contain the program counter stack as explained in
2047~ j SELMBO Section 2.6. These locations are addressed by the Stack
Pointer during subroutine calls as well as by RAM Pointer
Registers RO and R i. If the level of subroutine nesting is
1024 ~ less than 8, all stack registers are not required and can be
1023
used as general purpose RAM locations. Each level of
subroutine nesting not used provides the user with two
additional RAM locations.
LOCATION 7-
8
7
6
- TIMER INTERRUPT
VECTORS
PROGRAM HERE
63_-----_
(127)
5 «255»
4 LOCATION 3- USER RAM
EXTERNAL 32 x 8
3 4f- INTERRUPT (96 x 8)
2 VECTORS
PROGRAM HERE «224 x 8»
1
r-
o 716151413121110 RESET VECTORS ~~~----B-A-N-K--1-----t I
ADDRESS PROGRAM HERE WORKING DIRECTLY
REGISTERS ADDRESSABLE
8 xS WHEN BANK 1
-----Rl'- - - - IS SELECTED
24 ----liO'---- I
. Figure 2. Program Memory Map 23
1-3
SINGLE COMPONENT MCS®-48 SYSTEM
VCC
VCC
Q
INTERNAL
BUS D
D 1/0
FLIP PIN
FLOP PORT 1
LOW AND 2
IMPEDANCE
PULLDOWN
CLK Q
WRITE
PULSE
-
IN
MAX
-500
-400
(~A) -200
OV 2V 4V
VOL
These graphs are lor inlormational purposes only and are not guaranteed minimums or maximums.
1-4
SINGLE COMPONENT MCS®-48 SYSTEM
It is important to note that the ORL and the ANL are read! 1~IAwl~I~I~I~I~I~I~I~I~I~1
, ,
write operations. When executed, the f.LC "reads" the i
port, modifies the data according to the instruction, then Conventional Program Counter
"writes" the data back to the port. The "writing" (es- • Counts OOOH to 7FFH
• Overflows 7FFH to OOOH
sentially an OUTL instruction) enables the low impedance
pull-up momentarily again even if the data was unchanged
from a "1." This specifically applies to configurations
that have inputs and outputs mixed together on the same Figure 5. Program Counter
port. See also section 8 in the Expanded MCS-48 System
chapter.
An interrupt or CALL to a subroutine causes the contents
BUS
of the program counter to be stored in one of the 8 register
Bus is also an 8-bit port which is a true bidirectional port pairs of -the Program Counter Stack as shown in Figure
with associated input and output strobes. If the bidirec- 6. The pair to be used is determined by a 3-bit Stack
tional feature is not needed, Bus can serve as either a Pointer which is part of the Program Status Word (PSW).
1-5
SINGLE COMPONENT MCS®-48 SYSTEM
22
written as a whole. The ability to write to PSW allows
for easy restoration of machine status, after a power down
sequence.
21
, 110
20 SAVED IN STACK STACK POINTER
101
· 19
I I
1S
17
100 --'L MSB LSB
: 16 CY
AC
CARRY
AUXILIARY CARRY
: 15 FO FLAG 0
··
011 BS REGISTER BANK SELECT
14
; 13
010
·: 12
11
Figure 7. Program Status Word (PSW)
1-6
SINGLE COMPONENT MCS®-48 SYSTEM
Table 1
abled by the users program. An interrupt request must be
Jump Conditions removed before the RETR instruction is executed upon
Device Testable (Jum On) return from the service routine otherwise the processor
will re-enter the service routine immediately. Many pe-
not all ripheral devices prevent this situation by resetting their
Accumulator All zeros zeros interrupt request line whenever the processor accesses
Accumulator Bit - I (Reads or Writes) the peripherals data buffer register. If
Carry Flag 0 1 the interrupting device does not require access by the
User Flags (FO, Fl) - 1 processor, one output line of the 8048AH may be des-
Timer Overflow Flag - 1 ignated as an "interrupt acknowledge" which is activated
Test Inputs (TO,-I.!) 0 1 by the service subroutine to reset the interrupt request.
Interrupt Input (INT) 0 - The INT pin may also be tested using the conditional jump
instruction IN!. This instruction may be used to detect the
2.9 Interrupt presence of a pending interrupt before interrupts are en-
abled. If interrupt is left disabled, INT may be used as
An interrupt sequence is initiated by applying a low "0" another test input like TO and Tl.
level input to the INT pin. Interrupt is level triggered and
active low to allow "WIRE ORing" of several interrupt 2.10 Timer/Counter
sources at the input pin. Figure 8 shows the interrupt
logic.of the 8048AH. The Interrupt line is sampled every The 8048AH contains a counter to aid the user in counting
instruction cycle and when detected causes a "call to external events and generating accurate time delays with-
subroutine" at location 3 in program memory as soon as out placing a burden on the processor for these functions.
all cycles of the current instruction are complete. On 2- In both modes the counter operation is the same, the only
cycle instructions the interrupt line is sampled on the 2nd difference being the source of the input to the counter.
cycle only. !NT must be held low for at least 3 machine The timer/event counter is shown in Figure 9.
-cycles to ensure proper interrupt operations. As in any
CALL to subroutine, the Program Counter and Program COUNTER
Status word are saved in the stack. For a description of
this operation see the previous section, Program Counter The 8-bit binary counter is presettable and readable with
and Stack. Program Memory location 3 usually contains two MOV instructions which transfer the contents of the
an unconditional jump to an interrupt service subroutine accumulator to the counter and vice versa. The counter
elsewhere in program memory. The end of an interrupt content may be affected by Reset and should be initialized
service subroutine is signalled by the execution of a Return by software. The counter is stopped by a Reset or STOP
and Restore Status instruction RETR. The interrupt system TCNT instruction and remains stopped until started as a
is single level in that once an interrupt is detected all timer by a START T instruction or as an event counter
further interrupt requests are ignored until execution of an by a START CNT instruction. Once started the counter
RETR reenables the interrupt input logic. This _occurs at will increment to this maximum count (FF) and overflow
the beginning of the second cycle of the RETR instruction. to zero continuing its count until stopped by a STOP TCNT
This sequence holds true also for an internal interrupt instruction or Reset.
generated by timer overflow. If an internal timer/counter
generated interrupt and an external interrupt are detected The increment from maximum count to zero (overflow)
at the same time, the external source will be recognized. results in the setting of an overflow flag flip-flop and in
See the following Timer/Counter section for a-description the generation of an interrupt request. The state of the
of timer interrupt. If needed, a second external interrupt overflow flag is testable with the conditional jump instruc-
can be created by enabling the timer/counter interrupt, tion JTF. The flag is reset by executing a JTF or by Reset.
loading FFH in the Counter (ones less than terminal The interrupt request is stored in a latch and then ORed
count), and enabling the event counter mode. A "I" to with the external interrupt input INT. The timer interrupt
"0" transition on the Tl input will then cause an interrupt may be enabled or disabled independently of external in-
vector to location 7. terrupt by the EN TCNTI and DIS TCNTI instructions.
If enabled, the counter overflow will cause a subroutine
INTERRUPT TIMING call to location 7 where the timer or counter service routine
may be stored.
The interrupt input may be enabled or disabled under
Program Control using the EN I and DIS I instructions. If timer and external interrupts occur simultaneolisly, the
Interrupts are disabled by Reset and remain so until en- external source will be recognized and the Call will be to
1-7
SINGLE COMPONENT MCS®-48 SYSTEM
CONDITIONAL
S
JUMP LOGIC
TIMER
FLAG INTERRUPT
JTF CALL
EXECUTED-~1r~~~~~R EXECUTED
RESET--"1L._
CLR EXTERNAL
...-------ID Q INTERRUPT
RECOGNIZED.
TIMER ------...--4S Q
OVERFLOW
TIMER·
OVERFLOW TIMER
FF INTERRUPT
TIMER INT
RECOGNIZED
RECOGNIZED'-;:::~-\-_ _~R
EXECUTED
RESET
>---4S
~-,~, INTERRUPT
IN '.
PROGRESS'
EN TCNTI
EXECUTED
-------4 S. Q FF
TIMER R
INT
ENABLE
DIS TCNT!' --lr"'\~~--I
EXECUTED R Q
RESET
INTcr-------4 D
PIN
INT RESET
FF
RETR
EXECUTED
CLK
·ALE.~~r-~___~:::]
, ~~~~;;CLE._-t._'
ENI ----Is
EXECUTED
1. WHEN INTERRUPT IN PROGRESS FLIP-FLOP IS SET
INT ALL FURTHER INTERRUPTS ARE LOCKED OUT
ENABLE INDEPENDENT OF STATE OF EITHER INTERRUPT
DISI
EXECUTED--l~~_-I R . ENABLE FLIP-FLOP.
RESET 2. WH!LE TI~ER INTERRUPTS ARE DISABLED TIMER
OVERFLOW III WILL NOT STORE ANY OVERFLOW
'THAT OCCURS. TIMER FLAG WILL BE SET, HOWEVER ..
1-8
SINGLE COMPONENT MCS®-48 SYSTEM
PRESCALER
XTAL + 15 - +32
LOAD OR READ
I
CLEARED ON START TIMER
JUMP ON
TIMER FLAG
r------..... START
COUNTER
EDGE 8BITTIMERI
DETECTOR EVENT COUNTER
o OVERFLOW
STOPT FLAG
INT
ENABLE--------~___ '
location 3. Since the timer interrupt is latched it will re- olution less than I count an external clock can be applied
main pending until the external device is serviced and to. the TI input and the counter operated in the event
immediately be recognized upon return from the service counter'mode. ALE divided by 3 or more can serve as
routine. The pending timer interrupt is reset by the Call this external clock. Very small delays or "fine tuning"
to location 7 or may be removed by executing a DIS of larger delays can be easily accomplished. by software
TCNT! instruction. delay loops. .
AS AN EVENT COUNTER Often a serial link is desirabl~ ill an MCSA8 family mem~
ber..Thble 2 lists the timer counts and cycles needed
Execution of a START CNT instruction connects the T! for a specific baud rate given a crystal frequency.
input pin to the counter input and enables the counter.
The T! input is sampled at the beginning of state 3 or in 2.11 Clock and Timing Circuits
later MCS-48 devices in state time 4. Subsequent high to
low transitions on TI will cause the counter to increment. Timing generation for the 8048AH is completely selfcon-
T! must be held low for at least I machine cycle to insure tained with the exeception of a frequency reference which
it won't be missed. The maximum rate at which the can be XTAL, ceramic resonator, or external clock source.
counter may be incremented is once per three instruction The Clock and Timing circuitry can be divided into the
cycles (every 5.7 f.Lsec when using an 8 MHz crystal)-- following functional blocks.
there is no minimum frequency. TI input must remain
high for at least 1/5 machine cycle after each transition. OSCILLATOR
The on-board oscillator is a high' gain piiU'aUel resonant
AS A TIMER circuit with a frequency range of I to 11 MHz .. The XI
external pin is the input to the amplifier stage \:yhile X2
Eexcution of a START T instruction connects an internal is the output. A crystal or ceramic resonator connected
clock to the counter input and enables the counter. The between XI and X2 provides the feedback and phase shift
internal clock is derived bypassing the basic machine cycle required for oscillation. If an accurate frequency reference
clock through a + 32 prescaler. The prescaler is reset is not required, ceramic resonator may be used in place
during the START T instruction. The resulting clock in- of the crystal. .
crements the counter every 32 machine cycles. Various
delays from I to 256 counts can be obtained by presetting For accurate clocking, a crystal should be used. An ex-
the counter and detecting overflow. Times longer than 256 ternally generated clock may also be applied to XI-X2
counts may be achieved by accumulating multiple over- as the frequency source. See the data sheet for more
flows in a register under software control. For time res- infermation.
1-9
SINGLE COMPONENT MCS®-48 SYSTEM
CLK is then divided by 5. in the Cycle Counter to pro- 3) Selects register bank O.
vide a clock which defines a machine cycle consisting
of 5 machine states as sho",on in Figure 10. Figure 11 4) Selects memory bank O.
shows the different internal operations as divided into
the machine states. This clock is called Address Latch ·5) Sets BUS to high impedance state (except when
Enable (ALE) because of its function in MCS-48. sys- EA = 5V).
tems with external memory. It is provided continuous-
lyon the ALE output pin. 6) Sets Ports 1 and 2 to input mode.
The reset input provides a means for initialization for the 8) Stops timer.
processor. This Schmitt-trigger input has an internal pull-
up device which in combination with an external 1 !J. fd 9) Clears timer flag.
capacitor provides an internal reset pulse of sufficient
length to guarantee all circuitry is reset, as shown in Figure 10) Clears FO and Fl.
12. If the reset pulse is generated externally the RESET
pin must be held low for at least 10 milliseconds after the 11) Disables clock output from TO.
1-10
SINGLE COMPONENT MCS®-48 SYSTEM
JUMP ON
TEST = 1 OR 0
XTAL2 . - - - - - . ,
11 +3
MHzCJ STATE .273 ~sec (3.67 MHz)
COUNTER
XTAL 1 L..._ _ _ _..I
EXECUTION INPUT
I NST.
OUTPUT
INC. PC
ADDRESS
I ~ I I I
INSTRUCTION CYCLE
PREVIOUS CYCLE-"'~'f-o.
__- - - 1 S T CYCLE----I.......,.... ~1
_ - - - 2 N D CYCLE----l...
STATE TIME:
52 I 53 I 54 I 55 I 51 I 52 I 53 I 54 55 I 51 55 I 51 I 52
(02)"TO
ALE ~~--------~~----------~~--------
PSEN' - _ _ _ __,
'EXTERNAL MODE
"IF ENABLED
8048AH/8049AH TIMING
2.13 Single-Step half of Port 2. The user can therefore follow the program
through each of the instruction steps. A timing diagram,
This feature,· as pictured in Figure 13, provides the showing the interaction between output ALE and input
user with a debug capability in that the processor can be SS, is shown. The BUS buffer contents are lost during
stepped through the program one instruction at a time. single step; however, a latch may be added to reestablish
While stopped, the address of the next instruction to be the lost I/O capability if needed. Data is valid at the leading
fetched is available concurrently on BUS and the lower edge of ALE.
1-11
CYCLE 1 CYCLE 2
INSTRUCTION S1 ~)2 S3 54 S5 S1 S2 S3 54 55 !
INA,P
FETCH INCREMENT
INSTRUCTION PROGRAM COUNTER
- 'INCREMENT
TIMER
- - READ
PORT - ·- -
OUTL P,A
-
FETCH INCRIEMENT
INSTRUCTION PROGRAM COUNTER
- 'INCREMENT
TIMER
OUTPUT
TO PORT
- - - ·- -
ANLP,=DATA
FETCH INCRleMENT
INSTRUCTION PROGRAM COUNTER
- 'INCREMENT
TIMER
READ PORT
FETCH
IMMEDIATE DATA - INCREMENT
PROGRAM COUNTER
'OUTPUT
TO PORT
-
"II
ORL P,= DATA
FETCH INCReMENT
INSTRUCTION PROGRAM COUNTER
- 'INCREMENT
TIMER
READ PORT
FETCH
IMMEDIATE DATA - INCREMENT
PROGRAM COUNTER
'OlirPUT
TO PORT
- UI
I£i
c INSA,BUS
FETCH INCReMENT
INSTRUCTION PROGRAM COUNTER
- INCREMENT
TIMER
- - READ
PORT - · - - Z
...:-"
iiJ
OUTL BUS, A
FETCH INCReMENT
INSTRUCTION PROGRAM COUNTER
- INCREMENT
TIMER
OUTPUT
TO PORT
- - - .. - -
C)
r-
m
o
CD
...
0 ANL BUS, = DATA
FETCH INCREMENT
INSTRUCTION PROGRAM COUNTER
- 'INCREMENT
TIMER
READ PORT
FETCH
IMMEDIATE. DATA - INCREMENT
PROGRAM COUNTER
'OUTPUT
TO PORT
-
I o
i:
~ ORL BUS, = DATA
FETCH INCREMENT
- 'INCREMENT READ PORT
FETCH
- INCREMENT 'OUTPUT
- "U
% INSTRUCTION PROGRA'. COUNTER TIMER IMMEDIATE DATA PROGRAM COUNTER TO PORT
oZ
....
CD
...
0 MOVX@R,A
FETCH INCREMENT
INSTRUCTION PROGRAII COUNTER
OUTPUT RAM
ADDRESS
INCREMENT
TIMER
OUTPUT·
DATA TO RAM
- - - ·- - m
Z
~ ~ MOVXA,@R
FETCH INCREMENT OUTPUT RAM INCREMENT
- - READ
- ·- - -t
% INSTRUCTION PROGRAII COUNTER ADDRESS TIMER DATA
i:
..
5'
!!I.
MOVDA,PI
FETCH INCREMENT
INSTRUCTION PROGRAM COUNTER
OUTPUT
OPCODE/ADDRESS
INCREMENT
TIMER
- - READP2
LOWER
- ·- - tl
·-
@
-....
c - - -
FETCH INCREMENT OUTPUT INCREMENT OUTPUT DATA
-
n .~
MOVDPI,A
INSTRUCTION PROGRAM COUNTER OPCODE/ADDRESS TIMER TOP2LOWER
0" FETCH INCREMENT OUTPUT INCREMENT OUTPUT
- - - ·- -
~
:::s ANLDP,A
INSTRUCTION PROGRAM COU·NTER OPCODE/ADDRESS TIMER DATA
3"
5'
ORLDP,A
FETCH INCR:EMENT
INSTRUCTION PROGRAM COUNTER
OUTPUT
OPCODEIADDRESS
INCREMENT
TIMER
. OUTPUT
DATA
- - - ·- -
m
ICI
C
J(CONDITIONAL) FETCH INCR:EMENT
INSTRUCTION PROGRAM COUNTER
SAMPLE
CONDITION
'INCREMENT
SAMPLE - FETCH
IMMEDIATE DATA - UPDATE
PROGRAM COUNTER · - - i:
iii"
ICI
iii
STRTT
STRTCNT
FETCH INCFIEMENT
INSTRUCTION PROGRAM COUNTER
- · - START
COUNTER
:I STOP TCNT
FETCH INCFIEMENT
INSTRUCTION PROGRAM COUNTER
- · - STOP
COUNTER
ENI
FETCH INCFIEMENT
INSTRUCTION PROGRA'M COUNTER
- • ENABLE
INTERRUPT
- ·VALID INSTRUCTION ADDRESSES ARE OUTPUT
AT THIS TIME IF EXTERNAL PROGRAM MEMORY IS
DISI
FETCH INCFlEMENT
INSTRUCTION PROGRAM COUNTER
- • DISABLE.
INTERRUPT - BEING ACCESSED.
(1) IN LATER MC5-48 DEVICES T1 IS SAMPLED IN S4.
FETCH INCIIEMENT • ENABLE
ENTOCLK
INSTRUCTION PROGRAM COUNTER CLOCK
-
L- ___ ------
SINGLE COMPONENT MCS®-4B SYSTEM
f all but the data RAM array for low power standby oper~
ation. In the power down mode the contents of data RAM
can be maintained while drawing typically 10% to 15%
of normal operating power requirements.
Figure 12. Vee serves as the 5V supply pin for the bulk of circuitry
while the VDD pin supplies only the RAM array. In normal
operation both pins are a 5V while in standby, Vee is at
TIMING ground and VDD is maintained at its standby value. Ap-
plying Reset to the processor through the RESET pin
The 8048AH operates in a single-step mode as follows: inhibits any access to the RAM by the processor and
guarantees that RAM cannot be inadvertently altered as
I) The processor is requested to stop by applying a low power is removed from Vcc.
level on SS.
A typical power down sequence (Figure 14) occurs as
2) The processor responds by stopping during the address follows:
fetch portion of the next instruction. -If a double cycle
instruction is in' progress when the single step com- 1) Imminent power supply failure is detected by user de-
mand is received, both cycles will be completed before fined circuitry. Signal must be early enough to allow
stopping. 8048AH to save all necessary data before Vee falls
3) The proc~ssor acknowledges it has entered the stopped below normal operating limits.
state by raising ALE high. In this state (which can be
maintained indefinitely) the address of the next instruc- 2) Power fail signal is used to interrupt processor and
tion to be fetched is present on BUS and the lower vector it to a power fail service routine.
half of port 2.
4) ss is then raised high to bring the processor out of the 3) Power fail routine saves all important data and machine
stopped mode allowing it to fetch the next instruction. status in the internal data RAM array. Routine may
The exit from stop is indicated by the processor bring- also initiate transfer of backup supply to the VDD pin
ing ALE low. and indicate to external circuitry that power fail routine
is complete.
5) To stop the processor at the next instruction SS must
be brought low again soon after ALE goes low. If SS 4) Reset is applied to. guarantee data will not be altered
is left high the processor remains in a "Run" mode, as the power supply falls out of limits. Reset must be
A. diagram for implementing the single-step function of held low until Vee is at ground level.
the 8748H is shown in Figure 13. D.:!}'pe flip-flop with
preset and clear is used to generate SS. In the run mode Recovery from the Power Down mode can occur as any
SS is held high by keeping the flip-flop preset (preset has other power-on sequence with an external capacitor on
precedence over the clear input). To enter single step, the Reset input providing the necessary delay. See the
preset is removed allowing ALE to bring SS low via the previous section on Reset.
1-13
SINGLE COMPONENT MCS®-48 SYSTEM
+5V
MOMENTARY
PUSHBUTTON 10K
~u~PN--~-----------'
PRESET
+5V D Q
+5V
,..--------(> CLOCK
10K
DEBOUNCE
LATCH
1/27400
ALE
SINGLE STEP CIRCUIT
1 S3 1 54 1 S5 I S1 1 S2 1 S3 1 • • ·IS3154IS51 1 S2 1
ALE~
SS
n
BUS PCD-7
: : C
P2D-23 1/0 PC 8-11
1·14
SINGLE COMPONENT MCS®-48 SYSTEM
1-15
SINGLE COMPONENT MCS®-48 SYSTEM
X1
PHASE 1- - - - - -- - - --"'-:""
PHASE 2- - - - - - - - - - - - -
TIME STATE 2 3 4
SS 1~~----.J
OV
5V
TO OV--------------------~
5V
5V
ALE OV--------------------------------------------------~
RESET OV--------------------------------------------~------~---------------
1-16
SINGLE COMPONENT MCS®-48 SYSTEM
Pin
Designation Number* Function
Vee 40 Main power supply; +5V during operation and during 8748H and 8749H pro-
gramming.
PROG 25 Program pulse; + 18V input pin during 8748H /8749H programming. Output strobe
for 8243 I/O expander.
PIO-PI7 27-34 8-bit quasi-bidirection,aI port. (Inte~nal Pullup= 50KH)
(Port I)
P20-P27 21-24 8-bit quasi-bidirectional port. (Internal Pullup = 50KH)
(Port 2) 35-38
P20-P23 contain the four high order program counter bits during an external pro-
gram memory fetch and serve as a 4-bit I/O expander bus for 8243.
DO-D7 12-19 True bidirectional port which can be, written or read synchronously using the RD.
(BUS) WR strobes. The port can also be statically latched.
Contains the 810w 'order program counter bits during an external program mem-
ory fetch. and receives the addressed instruction under the control of PSEN. Also
, contains the address and data during, an external RAM data store instruction.
, under ,control of ALE, RD, and WR.
TO I Input pin testable using the conditional transfer instructions JTO and JNTO. TO
can be designated as a clock output using ENTO CLK instruction. TO is also used
during programming and sync mode.
TI 39 Input pin testable using the JT I, and JNTI 'instructions. Can be design~ted the
event counter input using the STRT CNT instruction., (See Section 2.10).
IN'f 6 Interrupt input. Initiates an in'terrupt' if interrupt is enabled. Interrupt is disabled
after a reset. (Active low)
Interrupt must remain low for at least 3 machine cycles to ensure proper operation.
--
RD 8 Output strobe activated during a BUS read. Can be used to enable data onto the
BUS from an external device. (Active low)
Used as a Read Strobe to External Data Memory.
RESET 4 Input which is used, to initialize the processor. Also used during EPROM programming
and verification. (Active low) (Internal pullup =80K fi)
WR 10 Output strobe during a BUS write. (Active low) Used llS write strobe to external
data memory.
ALE II Address 'Latch Enable. This signal occurs once during each cycle and is useful as
a clock output.
The negative edge of A LE strobes address into external data and program memory.
1-17
SINGLE COMPONENT MCS®-48 SYSTEM'
Pin
Designation Number· Function
- -
PSEN 9 Program Store Enable. This output 'occurs only during a fetch to external program
memory. (A~tive low)
SS 5 Single step input cari be used i~ c~njunction with ALE to "single step" the processor
=
through each instruCiion. (Active low) (Internal imllup 300Kn) +12V for sync
modes (See 2.16).
EA 7 External Access input which forces all program memory fetches to reference ex-
ternal memory. Useful for emulation and debug; and essential for testing and pro-
gram verification. (Active high) +12V for8048AH/8049AH/8050AH program
xerification and +18V for 8748H/8749H program verification (Internal pullup =
IOMn on 8048AH/8049AH/8035AHL/8039AHL/8050AH/8040AHL)
XTALI 2 , One side of cryst~1 input for internal oscillator. Also input for external source.
XTAL2 3 Other side of crystal/external source input. ;
'Unless otherwise stated, inputs dO,not have internal pullup resistors. 8048AH, 8748H, 8049AH, 8050AH, 8040AHL
The internal Pmliram Memory of the 8748H and the The erasure characteristics of the 8748H and 8749H are
8749H may be erased and reprogrammed by the user as such that erasure begl.ns'to occur when exposed to light
explained in the following sections. See also the 8748H with wavelengths shorter than approximately 4000 Angs"
and 8749H data sheets. troms (A). It should be noted that sunlight and certain
types of fluorescent lamps have wavelengths in the
4.1 ProgrammlngNerlflcatlon 3000-4000A range. Data show that constant exposure to
room level fluorescent: lighting could erase the typical
In brief, the programming process consists of: activating 8748H'and 8749H in approximately 3 years while it would
the program mode, applying an address, latching the ad- take approxima1l1ly I week to cause erasure when exposed
dress, applying data, and applying a programming pulse. to direct sunlight. If the 8748H or 8749H is to be exposed
This programming algorithm applies to both the 8748H to these types, of lighting conditions for extended periods
and 8749H. Each word is programmed completely before of time,' opaque labels should be placed over the 8748H
mOv1-!!g on to the next and is followed by a verificatiQn windo,: to prevent unintentional erasure.
step. The following is a list of the pins used for program~
ming and a descsription of their functions: When erased, bits of the 8748H and 8749H Program Mem-
ory are in the logic "0" state.
Pin Function
XTAL 1 Clock Input (3 to 4 MHz) , ,The 'recommended erasure procedure for the 8748H and
Reset Initialization and Address Latching 8749H is exposure to shortwave ultraviolet light which
Test 0 Selection of Program (OV) or Verify has a wavelength of 2537 Angstroms (A). The integrated
(5V) Mode ' dose (i.e., UV intensitY X exposure time) for erasure
EA Activation of Program/Verify Modes should be, a minimum of 15W-sec/cm2 • The erasure time
BUS Address and Data Input Data' Output with this dosage is approximately IS to 20 minutes'using
During Verify an ultraviolet lamp with a 12000p'w/cm2 power rating.
P20-1 Address Input for 8748H The 8748H ,and 8749H should be placed within one inch
P20-2 Address Input for 8749H from the lamp tubes during erasure. Some lamps have a
Voo Programming Power Supply filter in their tubes ,and this filter should be removed before
PROG Program Pulse Input erasure.
PIO-Pll Tied to ground (8749H only)
1·18
SINGLE COMPONENT MCS-48 SYSTEM
lav /
EA 5V _ _ _ _- J
I--------PROGRAM--------!---VERIFY---!-----PROGRAM-
ITW--
TO
tww-----,---
RESET
tAW+---t-~+- tWA
~ r-~D~AT~A~T~O~BE~~
DBO-DB7 --F - - PROGRAMMED VALID
LAST NEXT
P20-P22 ADDRESS ADDRESS
tVDDWffttvD?H
+21 _ WT
vDD
+5-------------- ------------------------------
PROG+:: ____________ ~:£V____\tt~W: __
+0 -- - - - - - =--,.:-"'. . _---
EA
_-oJ/
*TO,
RESET ~'-____________---.JI \ . . . ._ _---JI
DBO-DB7 J-- ADDRESS
(0-7) VALID
__ -< NEXT X
~,__.;..A;;;;D.;;;D.;..R.;;;E,;;,SS;;......J.
I\IEXT DATA)- __ _
. OUT VALID.
NOTES:
1. PROG MUST FLOAT IF EA IS LOW (I.E., "" leV).
1·19
MCS®,.48 Expanded System 2
EXPANDED MCS®-48 SYSTEM
1'.0 INTRODUCTION 1) The contents of the 12-bit program counter will be
output on BUS and the lower half of port 2.
If the capabilities resident on the single-chip S04SAHI
2) Address Latch Enable (ALE) will indicate the time at
S74SH/S035AHUS049AH/S749H/S039AHL are not suf- which address is valid. The' trailing edge of ALE is
ficieflt for your system requirements, special on-board cir- used to latch the address externally.
cuitry allows the addition of a wide variety of external
memory, 110, or special peripherals you may require. The 3) Program Store Enable (PSEN) indicates that an exter-
processors can be directly and simply expanded in the nal instruction fetch is in progress and serves to enable
foilowing areas: the external memory device.
• Program Memory to 4K words 4) BUS reverts to input (floating) mode and the processor
accepts its 8-bit contents as im instruction word.
• Data Memory to 320 words (3S4 words with
S049AH)
• 110' by unlimited amount
• Special Functions uSingSOSO/SOS5AH peripherals ALE J L
By using bank switching techniques, maximum capability
is essentially unlimited. Bank switching is discussed later PSEN
in the chapter. Expansion is accomplished in two ways:
FLOATING
~FLOATINGO FLOATING
1) Expander 110 - A special 110 Expander circuit, the
BUS
S243 , provides for the addition of four 4-bit Input!
Output ports with the sacrifice of only the lower half ADDRESS INSTRUCTION
(4-bits) of port 2 for inter-device communication. Mul-
tiple S243's may be added to this 4-bit bus by gen-
erating the required .. chip select" lines. Figure 1. Instruction Fetch from
2) Standard SOS5 Bus - One port of the S04SAHI External Program Memory
S049AH is like the S-bit bidirectional data bus of the
: SOS5 microcomputer system allowing interface to the All inStruction fetches, including internal addresses, caD. be
numerous standard memories and peripherals of the forced to be external by activating the EA pin of the 8048AH1
MCS@-SO/S5 microcomputer family. 8049AH18050AH. The 8035AHU8039AHUS04OAHL pro-
cessors without program memory always operate in the ex-
MCS-4S systems can be configured using either or both ternal program memory mode (EA = 5V).
of these expansion features to optimize system capabilities
to the application. 2.2 Extended. Program Memory
AddreSSing (Beyond 21<)
Both expander devices and standard memories and pe-
ripherals can be added in virtually any number and com- For programs of 2K words or less, the 8048AH/8049AH
bmation required. addresses program memory in the conventional manner.
, . Addresses beyond 2047 can be reached by executing a
'. 2.0 EXPANSION OF PROGRAM MEMORY program memory bank switch instruction (SEL MBO, SEL
MBI) followed by a branch instruction (JMP or CALL).
Program Memory is expanded beyond the resident IK or The bank switch feature extends the range of branch in-
2K words by using the SOS5 BUS feature of the MCS@- structions beyond their normal 2K range and at the same
48. All program memory fetches from the addresses less time prevents the user from inadvertently crossing the 2K
. than 1024 on the S04SAH and less than 204S on the boundary ..
. S049AH occur internally with no external signals being
generated (except ALE which is always present). At ad- PROGRAM MEMORY BANK SWITCH
dress 1024 on the S04SAH, the processor automatically
initiates external program memory fetches. The switching of 2K program memory banks is accom-
plished by directly setting or resetting the most significant
2.1 Instruction Fetch Cycle (External) bit 'of the program counter (bit 11); see Figure 2. Bit
II is not altered by nQrmal incrementing of the program
As shown in Figure 1, for all insinicti~n fetches from counter but is loaded with the contents of a special flip-
addresses of 1024 (2048) or greater, the following will flop each time a JMP or CALL instruction is executed.
occur: This special flip-flop is set by executing an SEL MBI
2-1
EXPANDED MCS®-48 SYSTEM
instruction and reset by SEL MBO. Therefore, the SEL counter is held at "0" during the interrupt service routine.
MB instruction may be executed at any time prior to the The end of the service routine is signalled by the execution
actiJal bank switch which occurs during the next branch of an RETR instruction. Interrupt service routines should
instruction encountered. Since all twelve bits of the pro- therefore be contained entirely in the lower 2K words of
gram counter; including bit 11, are stored in the. stack, program memory. The execution of a SEL MBO or SEL
when a Call is executed, the user may jump·to subroutines MB I instruction within an interrupt routine is nOt rec-
across the 2K boundary and the proper bank will be re- ommended since it will not alter PCII while in the routine,
stored upon return. However, the bank switch flip-flop but will change the internal flip-flop~
will not' be altered on return.
II
~.,
8048AH ALE
,74LS373
"
n) ADDRESS
v
A
BUS r'--8
,irV LATCH
DATA
OUT
2718
EPROM
PSEN CiS
.'
USING 2K x 8 EPROM
2-2
EXPANDED MCS®-48 SYSTEM
ALE J. L
I
BUS FLOATING XADDRESSX 7' ~___FL_O_A_TI_N_G_ __
FLOATING
ALE J L
I
BUS FLOATING FLOATING
2-3
EXPANDED MCS®-48 SYSTEM
Busk'------;;8,-----~
v
ADO_7
ALE
"
ALE 8155
22 1/0
256x8
··2-4
EXPANDED MCS®-48 SYSTEM
fl
-=- CHIP SELECT CONNECTIO NIFMORE
THAN ONE EXPANDER IS USED
~I/O CS
P4 4 1/0
" V or
PROG PROG
A
P5 4 1/0
2
8050AH J i::JTS 8243
v
8049AH
8048AH
" t-.
P6 4 1/0
"- v
P20-P23 4. DATA IN
v P2
" P7 4
v
1/0
EXPANDER INTERFACE
BITS 0, 1 BITS 2, 3
PROG \ ' - . _ _ _- - I/
00}
01 PORT 01
OO} READ
WRITE
10 ADDRESS 10 OR
2-5
EXPANDED MCS®-48 SYSTEM
8 KEYBOARD
INPUTS
INT INT
P20 c/o
8279
KEYBOARD SCAN
8048AH DISPLAY OUTPUTS
RD RD
(A) DISPLAY
WR WR OUTPUT
-
Figure 8. Keyboard/Display Interface
8355/8755: These two parts of ROM and EPROM equiv- port. These three registers and aControllStatus register
alents and therefore contain the same 110 structure. 110 are accessible as external data memory with the MOVX
eonsists of two 8-bit ports which nonnally reside in the instructions. The contents of the control register deter-
external data memory address space and are accessed with mines the mode of the three ports. The ports can be pro-
MOVX instructions. Associated with each port is an 8- grammed as input or output with or without associated
"it Data Direction Register which defines each bit in the handshake communication lines. In the handshake mode,
port as either an input or an output. The data direction lines of the six-bit port become input and output strobes
registers are directly addressable, thereby allowing the' for the two 8-bit ports. Also included in the 8155 is a
user to define under software control each individual bit 14-bit programmable timer. The clock input to the timer
of the ports as either input or output. All outputs. are and the timer overflow output are available on external
statiCally latched and double buffered. Inputs are not pins. The timer can be programmed to stop on tenninal
latched. count or to continuously reload itself. A square wave or
8155/8156: 110 on the 815518156 is configured 'as two pulse output on terminal count can also be specified.
8-bit programmable 1/0 ports and one 6-bit programmable
2-6
EXPANDED MCS®-48 SYSTEM
OPTION #1 -= OPTION #2 -=
Interconnection to the 8048AH is very straightforward addressing of the various memories and 110 ports. Note
with BUS, RD, and WR connecting directly to the cor- that in this configuration address lines A 10 and A 11 have
responding pins on the 8255. The only design consider- been ORed to chip select the 8355. This ensures that the
ation is the way in which the internal registers of the 8255 chip is active for all external program memory fetches in
are to be addressed. If the registers are to be addressed the lK to 3K range and is disabled for all other addresses.
as external data memory using the MOVX instructions, This gating has been added to allow the 110 port of the
the appropriate number of address bits (in this case, 2) 8355 to be used. If the chip was left selected all the time,
must be latched on BUS using ALE as described in the there would be conflict between these ports and the RAM
section on external data memories. If only a single device and I/O of the 8156. The NOR gate could be eliminated
is connected to BUS, the 8255 may be continuously se- and Al1 connected directly to the CE (instead of CE) input
lected by grounding CS. If multiple 8255's are used, ad- ofthe 8355; however, this would create a lK word "hole"
ditional address bits can be latched and used as chip' in the program memory by causing the 8355 to be active
selects. in the 2K and 4K range instead of the normal lK to 3K
range.
A second addressing method eliminates external latches
and chip select decoders by using output port lines as ad- In this system the various locations are addressed as
dress and chip select lines dircctly.r'his method. of follows:'
course, requires the setting oran output port with address • Data RAM - Addresses 0 to 255 when Port 2 Bit
information prior to executing a MOVX instruction. o has been previously set = 1 and Bit I' set = 0
• RAM 110 - Addresses 0 to 3 when Port 2 Bit 0 =
5.0 MULTI-CHIP MCS®-48 SYSTEMS 1 and Bit 1 = 1
Figure 11 shows the addition of two memory expanders • ROM I/O - Addresses 0 to 3 when Port 2 Bit 2 or
Bit 3 = 1
to the 8048AH, one 8355/8755 ROM and one 8156 RAM.
The mirin consideration in designing such a system is the See the memory map in Figure 12.
2-7
EXPANDED MCS®-48 SYSTEM
8156/8355
A8-10
PORT
83551
8755
ROM
EPROM
PORT
ALE 8 ADO-7
PSEN 101M
8048AH RD
WR -=-
8 PORT
BUS A
PORT
8156 B
RAM
A9 PORT
101M
c
6.0 MEMORY BANK SWITCHING Jumping to subroutines across the boundary should be
avoided when possible since the programmer must keep
Certain systems may require more than the 4K words of track of which bank to return to after completion of the
program memory which are directly addressable by the subroutine. If these subroutines are to be nested and ac-
program counter or more than the 256 data memory and cessed from either bank, a software "stack" should be
110 locations directly addressable by the pointer registers implemented to save the bank switch bit just as if it were
RO and Rl. These systems can be achieved using "bank another bit of the program counter.
switching" techniques. Bank switching is merely the se-
lection of vari()US blocks of "banks" of memory using From a hardware standpoint bank switching is very
dedicated output port lines from the processor. In the case straightforward and involves only the connection of an
of the 8048AH, program memory is selected in blocks of 110 line or lines as bank enable signals. These enables are
4K words at a time, while data memory and 110 are en- ANDed with normal memory and 110 chip select signals
. abled 256 words at a time. to activate the proper bank.
2-8
EXPANDED MCS®·48 SYSTEM
PROGRAM MEMORY
SPACE
.-----'BFFH
I
I
MB1
:
I
8355 :
(2K) I
I
I
I
I EXTERNAL DATA
: MEMORY SPACE
MBO I - - - - - j 400H I I ~~5
RESIDENT
I
- - - - - - - - 300H
I
I8155
I 10
--(1K)-- 200H I -______---i RESIDENT DATA
MEMORY
- - - - - - - - 100H ~--'-"":""-! (64)
' - - - - - - ' OOOH 1--:-------1
2-9
EXPANDED MCSIiil-48 SYSTEM
In all c,ases' outputs are driven low by an active device viously latched will be automatically removed temporarily
and,driven high momentarily by a low impedance device 'while address is present, then retored when the fetch is
and held high bY a high impedan~ device to vee. complete. However, if lower Port 2 is used to commu-
nicate with ,iIIi 8243, previously latched 110 information
The port may contain latched 110 data prjor to its use in , will be removed and not restored. After an input from th~
another mode without affecting operation of either:, If 8243~ P20-3 will be left in the input mode (ftoating).After
lower, ,Port 2 (P20-3) is IIsed ,to output address for an an output to the 8243, P20-3 will contain the value written,
external program memory fetch. the 110 information pre- AN~, or ORed' to the 8243 port.
1/0 1/0
8749H
8049AH'
8048AH
8748H
8035AHL
8039AHL
D
D
2·10
MCS®..,48 Instruction Set 3
MCS®-48 INSTRUCTION SET
1.0 INTRODUCTION 1.1 Data Transfers
The MCS®-48 instruction set is extensive for a machine As can be seen in Figure I the 8-bit accumulator is
of its size and has been tailored to be straightforward and the central point for all data transfers within the 8048.
very efficient in its use of program memory. All instruc- Data can be transferred between the 8 registers of each .
tions are either one or two bytes in length and over 80% working register bank and the accumulator directly, Le.,
are only one byte long. Also, all instructions execute in the source or destination register is specified by the in-
either one or two cycles and over 50% of all instructions struction. The remaining locations of the internal RAM
execute in a single cycle. Double cycle instructions in- array are referred to as Data Memory and are addressed
clude all immediate instructions, and all 110 instructions. indirectly via an address stored in either RO or R I of the
active register bank. RO and RI are also used to indirecly
The MCS-48 microcomputers have been designed to han- address external data memory when it is present. Transfers
dle arithmetic operations efficiently in both binary and to and from internal RAM require one cycle; while trans-
BCD as well as handle the single-bit operations required fers to external RAM require two. Constants stored in
in control applications. Special instructions have also been Program Memory can be loaded directly to the accumu-
included to simplify loop counters, table look-up routines, lator and to the 8 working registers. Data can also be
and N-way branch routines. transferred directly between the accumulator and the on-
r----------l
I PROGRAM
MEMORY
DATA
MEMORY
I
I (#DI\.TA) MOV
WORKING REG
I
I ADD
MOV
MOV
ADD
I
MOVP ANL
I MOVP3
ANL
ORL
XRL
I
ORL XCH
XRL
EXPANDER /111-_=---'-', ,....:>"-''----------....:..'-----....:..'-, EXTERNAL
1/0 PORTS /,:=:-=,.-1-"" MEMORY
4-7 ~_ _ _~~_ _~~---~---~~cr-~~r</ ~;~PHERALS
8749H
ANL
ORL 8048AH
8049AH
8748H
8035AHL'
I'NO PROGRAM
8039AHL' I MEMORY
~ _ _ _ _ _ _ --.J
3-1
MCS®-48 INSTRUCTION SET
board timer counter or the accumulator and the Program 1.4 Flags
Status word (PSW). Writing to the PSW alters machine
status accordingly and provides a means of restoring status There are four user-accessible flags in the 8048AH: Carry,
after an interrupt or of altering the stack pointer if Auxiliary Carry, FO and F 1. Carry indicates overflow of
necessary. the accumulator, and Auxiliary Carry is used to indiate
overflow between BCD digits and is used during decimal-
1.2 Accumulator Operations adjust operation. Both Carry and Auxiliary Carry are ac-
cessible as part Of the program status word and are stored
Immediate data,. data memory, or the working registers on the stack during subroutines. FO and FI are undedicated
can be added with or without carry to the accumulator. general-purpose flags to be used as tire programmer de-
These sources can also be ANDed, ORed, or Exclusive sires. Both flags can be cleared or complemented and
ORed to the accumulator. Data may be moved to or from tested by conditional jump instructions. FO is also acces-
the accumulator and working registers or data memory. sible via the Program Status word and is stored on the
The two values can also be exchanged in a single stack' with the carry flags.
operation.
1.5 Branch Instructions
In addition, the lower 4 bits of the accumulator can be
exchanged with the lower 4-bits of any of the internal The unconditional jump instruction is two bytes and allows
RAM locations. This instruction, along with an instruction jumps anywhere in the firs! 2K words of program memory.
which swaps the upper and lower 4-bit halves of the ac- Jumps to the second 2K of memory (4K words are directly
cumulator, provides for easy handling of 4-bit quantities, addressable) are made first by executing a select memory
including BCD numbers. To facilitate BCD arithmetic, a bank instruction, then executing the jump instruction. The
Decimal Adjust instruction is included. This instruction 2K boundary can only be crossed via a jump or subroutine
is used to correct the result of the binary addition of two call instruction, i.e., the bank switch does not occur until
2-digit BCD numbers. Performing a decimal adjust on the a jump is executed. Once a memory bank has been selected
result in the accumulator produces the required BCD all subsequent jumps will be to the selected bank until
result. another select memory bank instruction is executed. A
subroutine in the opposite bank can be accessed by a select
Finally, the accumulator can be incremented, decre- memory bank instruction followed by a call instruction.
mented, cleared, or complemented and can be rotated left Upon completion of the subroutine, execution will auto-
or right I bit at a time with or without carry. matically return to the original bank; however, unless the
original bank is reselected, the next jump instruction en-
Although there is no subtract instruction in the 8048AH, countered will again transfer execution to the opposite
this operation can be easily implemented with three single- bank.
byte single-cycle instructions.
Conditional jumps can test the following inputs and ma-
A value may be subtracted from the accumulator with the chine status:
result in the accumulator by:
• TO Input Pin
• Complementing the accumulator • TI Input Pin
• Adding ine vaiue io ine accumuiaior e INT Input Pin
3-2
MCS®-48 INSTRUCTION SET
The decrement register and jump if not zero instruction The working register bank switch instructions allow the
combines a decrement and a branch instruction to create programmer to immediately substitute a second 8-register
an instruction very useful in implementing a loop counter. working register bank for the one in use. This effectively
This instruction can designate anyone of the 8 working provides 16 working registers or it can be used as a means
registers as a counter and can effect a branch to any address of quickly saving the contents of the registers in response
within the current page of execution. to an interrupt. The user has the option to switch or not
to switch banks on interrupt. However, if the banks are
A single-byte indirect jump instruction allows the program switched, the original bank will be automatically restored
to be vectored to anyone of several different locations upon execution of a return and restore status instruction
based on the contents of the accumulator. The contents at the end of the interrupt service routine.
of the accumulator points to a location in program memory
which contains the jump address. The 8-bit jump address A special instruction enables an internal clock, which is
refers to the current page of execution. This instruction the XTAL frequency divided by three to be output on pin
could be used, for instance, to vector to anyone of several TO. This clock can be used as a general-purpose clock in
routines based on an ASCII character which has been the user's system. This instruction should be used only to
loaded in the accumulator. In this way ASCII key inputs initialize the system since the clock output can be disabled
can be used to initiate various routines. only by application of system reset.
Subroutines are entered by executing a call instruction. Ports 1 and 2 are 8-bit static I/O ports which can be loaded
Calls can be made like unconditional jumps to any address to and from the accumulator. Outputs are statically latched
in a 2K word bank, and jumps across the 2K boundary but inputs are not latched and must be read while inputs
are executed in the same manner. Two separate return are present. In addition, immediate data from program
instructions determine whether or not status (upper 4-bits memory can be ANDed or ORed directly to Port 1 and
of PSW) is restored upon return from the subroutine. Port 2 with the result remaining on the port. This allows
"masks" stored in program memory to selectively set or
The return and restore status instruction also signals the reset individual bits of the I/O ports. Ports 1 and 2 are
end of an interrupt service routine if one has been in configured to allow input on a given pin by first writing
progress. a "1" out to the pin.
1.7 Timer Instructions An 8-bit port called BUS can also be accessed via the
accumulator and can have statically latched outputs as
The 8-bit on board timer/counter can be loaded or read well. It too can have immediate data ANDed or ORed
via the accumulator while the counter is stopped or while directly to its outputs, however, unlike ports I and 2, all
counting. The counter can be started as a timer with an eight lines of BUS must be treated as either input or output
internal clock source or an event counter or timer with an at anyone time. In addition to being a static port, BUS
external clock applied to the Tl input pin. The instruction can be used as a true synchronous bi-directional port using
executed determines which clock source is used. A single the Move External instructions used to access external
instruction stops the counter whether it is operating with data memory. When these instructions are executed, a
an internal or an external clock source. In addition, two corresponding READ or WRITE pulse is generated and
instructions allow the timer interrupt to be enabled or data is valid only at that time. When data is not being
disabled. transferred, BUS is in a high impedance state. Note that
the OUTL, ANL, and the ORL instructions for the BUS
1.8 Control Instructions are for use with internal program memory only.
Two instructions allow the external interrupt source to be. The basic three on-board I/O ports can be expanded via
enabled or disabled. Interrupts are initially disabled and a 4-bit expander bus using half of port 2. I/O expander
are automatically disabled while an interrupt service rou- devices on this bus consist of four 4-bit ports which are
tines is in progress and re-enabled afterward. addressed as ports 4 through 7. These ports have their
own AND and OR instructions like the on-board ports as
There are four memory bank select instructions, two to well as move instructions to transfer data in or out. The
designate the active working register bank and two to expander AND and OR instructions, however, combine
control program memory banks. The operation of the pro- the contents of accumulator with the selected port rather
gram memory bank switch is explained in Section 2.2 than immediate data as is done with the on-board ports.
in the Expandeq MCS-48 System chapter..
3-3
MCS®-48 INSTRUCTION SET
liD devices can also be added externally using the BUS The alphabetical listing includes the following
port as the expansion bus. In .this case the liD ports become information.
"memory mapped", i.e., they are addressed in the same
• Mnemonic
way as external data memory and exist in the external
data memory address space addressed by pointer register • Machine Code
RO or Rl. • Verbal Description
• Symbolic Description
• Assembly Language Example
3-4
MCS®-48 INSTRUCTION SeT
S04SAH/S74SH/S049AH/S050AH/S749H
Instruction Set Summary
Accumulator Registers
ADD A, R Add register to A 1 1 INCR Increment register 1 1
ADDA,@R Add data memory to A 1 1 INC@R Increment data memory 1 1
ADD A, # data Add immediate to A 2' 2 DECR Decrement register 1 1
AD DC A, R Add register with carry 1 1
Branch
ADDC":-, Add data memory 1 1
@R with carry JMP addr Jump unconditional 2 2
AD DC A, Add immediate 2 2 JMPP@A Jump indirect 1 2
# data with carry DJNZ R, addr Decrement register 2 2
ANLA, R And register to A 1 1 and jump
ANLA,@R And data memory to A 1 1 JC addr Jump on carry = 1 2 2
ANLA, # data And immediate to A 2 2 JNC addr Jump on carry = 0 2 2
ORL A, R Or register to A 1 1 JZ addr Jump on A Zero 2 2
ORLA@R Or data memory to A 1 1 JNZ addr Jump on A not Zero 2 2
ORL A, # data Or immediate to A 2 2 JTO addr Jump on TO =1 2 2
XRL A, R ExClusive Or register 1 1 JNTO addr Jump on TO =0 2 2
toA JT1 addr Jump on T1 =1 2 2
XRLA,@R Exclusive or data 1 1 JNT1 addr Jump on T1 =0 2 2
memory to A JFO addr Jump on FO =1 2 2
XRL, A, # data Exclusive or 2 2 JF1 addr Jump on F1 = 1 2 2
immediate to A
JTF addr Jump on timer flag =1 2 2
INCA Increment A 1 1
JNI addr Jump on INT = 0 2 2
DEC A Decrement A 1 1
JBb addr Jump on Accumulator 2 2
CLRA Clear A 1 1 Bit
CPLA Complement A 1 1
DAA Decimal adjust A 1 1 Subroutine
SWAP A Swap nibbles of A 1 1 CALL addr Jump to subroutine 2 2
RLA Rotate A left 1 1 RET Return 1 2
RLCA Rotate A left 1 1 RETR Return and restore 1 2
through carry status
RRA Rotate A right 1 1
Flags
RRCA Rotate A right 1 1
through carry CLR C Clear Carry 1 1
CPLC Complement Carry 1 1
Input/Output
CLR FO Clear Flag 0 1 1
INA, P Input port to A 1 2 CPL FO Complement Flag 0 1 1
OUTL P, A Output A to port 1 2 CLR F1 Clear Flag 1 1 1
ANL P, # data And immediate to port 2 2 CPL F1 Complement Flag 1 1 1
ORL P, # data Or immediate to port 2 2
"INS A, BUS Input BUS to A 1 2 Data Moves
"OUTL BUS, A Output A to BUS 1 2 MOVA, R Move register to A 1 1
"ANL BUS, And immediate to BUS 2 2 MOVA,@R Move data memory 1 1
# data toA
"ORL BUS, Or immediate to BUS 2 2 MOVA, # data Move immediate to A 2 2
# data MOVR,A Move A to register 1 1
MOVDA, P Input Expander port 1 2 MOV@R,A Move A to data 1 1
toA memory
MOVD P, A Output A to Expander 1 2 MOV R, # data Move immediate 2 2
port to register
ANLD P,A And A to Expander port 1 2 MOV@R, Move immediate to 2 2
ORLD P, A Or A to Expander port 1 2 # data data memory
MOVA, PSW Move PSWtoA 1 1
MOVPSW,A MoveAtoPSW 1 1
Mnemonics copyright Intel Corporation 1983.
"For use with internal memory only.
3-5
MCS®-48 INSTRUCTION SET
804IAH/8741H/1049AH/105OAH/8749H
Instruction Set Summary (Con't)
Timer/Counter
'MOVA, T Read Timer/Counter 1 1
MOVT,A Load Timer/Counter 1 1'
STRTT Start Timer "
1 1
STRTCNT Start Counter 1 1
STOP TCNT Stop Timer/Counter 1 ,1
EN TCNTI Enable Timer/Counter 1 1
Interrupt
DIS TCNTI Disable Timer/Couriter 1 1
Interrupt
Mnemonics copyright Intel Corporation 1983.
3-6
MCS®-48 INSTRUCTION SET
Symbols and Abbreviations Used
A Accumulator
AC Auxiliary Carry
addr 12-Bit Program Memory Address
Bb Bit Designator(b = 0-7)
BS Bank Switch
BUS BUS Port"
C Carry
ClK Clock
, CNT EventCounter
CRR Conversion Result Register
D Mnemonic for 4-Bit Digit (Nibble)
data 8-Bit Number or Expression
DBF Memory Bank Flip-Flop
Fa, F1 Flag 0, Flag 1
I Interrupt
P Mnemonic for "in-page" Operation'
PC Program Counter
Pp Port Designator (p = 1, 2 or' 4-7)
PSW Program Status Word
Ri Data memory Pointer (i = 0, or 1)
Rr Register Designator (r = 0-7)
SP Stack Pointer '
T Timer
TF Timer Flag
TO, T1 Test 0, Test 1
X Mnemonic for External RAM
# Immediate Data Prefix
@ Indirect Address Prefix
$ Currerit Value of Program Counter
(X) Contents of X
((X)) Contents of location Addre~sed QY X
- Is Replaced by ,
3-7
MCS@)-48 INSTRUCTION SET
Encoding: I0 1 1 0 I 1 r r r I .,:
Description: The content~ of r~gister 'r' ,are added to the accllmulator. Carry is
affected.' ' "
Operation: (A) - (A) + (Rr) r =0-7
Example: ADDREG: ADD A,RS ;ADD REG S CONTENTS
;TOACC
Encoding; I0 1 I
1 0 0 0 0 i I SOH-S1H '
Description: The contents of the resident data memory location addressed by register 'i' bits
0-5.... are added to the accumulator. Carry is affected.
Operation: (A) - (A) + ((Ri)) i =0-1 ,
Example: ADDM: MOV RO, #01 FH";MOVE ',1 F' HEX TO REG 0
ADD A, @R~;ADD VALUE OF LOCATION
;3,1,TOACC
Encoding: I0 1 1 1 I 1 r r r I 78H-7FH
Descripiion: The content of the cBiry bit is a~ded to a~cumulator location 0 arid the carry
bit cleared. The contents of register 'r' are then added to the accumulator.
Carry is affected. '
Operation: (A) - (A) + (Rr) + (C) r = 0-7
Example: ADDRGC: ADDC A,'R4; ,;ADD CARRY AND REG 4
;CONTENTS TO ACC
··0-5 iii 8048AHl8748H
0-6 in 8049AH/8749H
0-7 in 8050AH
3-8
MCS®-48 INSTRUCTION SET
Encoding: I0 1 1 1 I0 0 0 i I 70H-71H
Description: The content of the carry bit is added to accumulator location a and the carry bit
cleared. Then the contents of the resident data memory location addressed by
register 'i' bits 0-5** are added to the accumulator. Carry is affected.
I
Encoding: 10 0 0 1 0 0 1 1 I Id7 d6 dS d4 Id3 d2 d1 dO I 13H
Description: This is a 2-cycle instruction. The content of the carry bit is added to·
accumulator location 0 and the carry bit cle~red. Then the specified data is
added to the accumulator. Carry is affected.
Operation: (A) - (A) + data + (C)
Example: AD DC A,#22S ;ADD CAAAY AND '22S' DEC
;TO ACC
Encoding: 10 1 0 1 11 r r r I S8H-SFH
Description: Data in the accumulator is logically ANDed with the mask contained in
working register 'r'.
Operation: (A) - (A) AND (Rr) r = 0-7
Example: ANDAEG: ANL A,A3 ;'AND' ACC CONTENTS WITH MASK
;IN REG 3
Encoding: I0 1 0 1 I0 0 0 i I SOH-S1H
Description: Data in the accumulator is logically ANDed with the mask contained in the
data memory location referenced by register 'i' bits O-S**.
Operation: (A) - (A) AND ((Ai)) i = 0-1
Example: ANDDM: MOV AO,#03FH ;MOVE '3F' HEX TO AEG 0
ANL A,@AO ;'AND' ACC CONTENTS WITH
;MASK IN LOCATION 63
··0-5 in 8048AH/8748H
0-6 in 8049AH/8749H
0-7 in 8050AH
3-9
MCS®-48 INSTRUCTION SET
Encoding: [0 1 0 1 1 0 0 1 1 1 53H
Description: This is a 2-cycle instruction. Data in the accumulator is logically ANDed
with an immediately-specified mask.
Operation: (A) - (A) AND data
Examples: ANDID: ANL A,#OAFH ;'AND' ACC CONTENTS
;WITH MASK 10101111
ANL A,#3 + X/Y ;'AND' ACC CONTENTS
;WITH VALUE OF EXP
;'3 + Xy/y'
Encoding: 11 0 0 1 11 0 0 0 1 98H
Description: This is a 2~cycle instruction. Data on the BUS port is logically ANDed .
with an immediately-specified mask. This instruction assumes prior
specification of an 'OUTL BUS, A' instruction.
Operation: (BUS) - (BUS) AND data
Example: ANDBUS: ANL BUS,#MASK ;'AND' BUS CONTENTS
;WITH MASK EQUAL VALUE
;OF SYMBOL 'MASK'
Encoding: 11 0 0 1 11 0 P P 1 99H-9AH
Description: This is a 2-cycle instruction. Data on port 'p' is logically ANDed with an
immediately-specified mask. .
Operation: (Pp) - (Pp) AND DATA p = 1-2
C_~ __ I ... IIl\lnO?· AI\II O? Hnl=nl-l
. . A . . . . . . ..., . . . . " I ........ ~. "''1_ I _,"""I VI I ;'AND' PORT 2 CONTENTS
;WITH MASK 'FO' HEX
;(CLEAR P20-23)
• For use with internal program memory ONLY.
MCS®-48 INSTRUCTION SET
Encoding: 11 0 0 1 11 1 P P I 9CH-9FH
Description: This is a 2-cycle instruction. Data on port 'p' is logically ANDed with the
digit mask contained in accumulator bits 0-3.
Operation: (Pp) - (Pp) AND (AO-3) P = 4-7
Note: The mapping of port 'p' to opcode bits 0-1 is as follows:
1 0 Port
00 4
01 5
10 6
11 7
Example: ANDP4: ANLD P4,A ;'AND' PORT 4 CONTENTS
;WITH ACC BITS 0-3
3-11
MCS®·48 INSTRUCTION SET
Example: Add three groups of two numbers. Put subtotals in locations 50,51 and
total in location 52.
MOV RO,#50 ;MOVE '50' DEC TO ADDRESS
;REGO
BEGADD: MOV A,R1 ;MOVE CONTENTS OF REG 1
;TO ACC
. ADD A,R2 ;ADD REG 2 TO ACC
CALL SUBTOT ;CALL SUBROUTINE'SUBTOr
AD DC A R3 ;ADD REG 3 TO ACC
ADDCA,R4 ;ADD REG 4 TO ACC
CALL SUBTOT ;CALL SUBROUTINE 'SUBTOr
ADDC A,R5 ;ADD .REG 5 TO ACC
ADDCA,R6 ;ADD REG 6 TO ACC
CALL SUBTOT ;CALL SUBROUTINE 'SUBTOr
SUBTOT: MOV @RO,A ;MOVE CONTENTS OF ACC TO
;LOCATION ADDRESSED BY
;REGO
INCRO ;INCREMENT REG 0
RET ;RETURN TO MAIN PROGRAM
Encoding: I0 0 1 0 I 0 1 1 1 I 27H
Description: The contents of the accumulator are cleared to zero.
Operation: A - 0
Encoding: 11 0 0 1 1 0 1 11 97H
Description: During normal program execution, the carry bit can be set to one by the
ADD, ADDC, RLC, CPL C, RRC, and DAA insructions. This instruction
resets the carry bit to zero.
Operation: C - 0
Encoding: 11 0 1 0 I 0 1 0 1 I . ASH
Description: Flag 1 is cleared, to zero.
Operation: (F1) - 0
3-12
MCS®-48 INSTRUCTION SET
Encoding: 11 0 0 0 10 1 0 1 1 85H
Description: Flag 0 is cleared to zero.
Operation: (FO) - 0
Encoding: 10 0 1 1 10 1 1 1 1 37H
Description: The contents of the accumulator are cort:1plemented. This is strictly a one's
complement. Each one is changed to zero and vice-versa.
Operation: (A) - NOT (A)
Example: Assume accumulator contains 01101010.
CPLA: CPL A ;ACCCONTENTS ARE COMPLE-
;MENTED TO 10010101
Encoding: 11 0 1 0 1 0 1 1 1 1 A 7H
Description: The setting of the carry bit is complemented; one is changed to zero, and
zero is changed to one.
Operation: (C) - NOT (C)
Example: Set C to one; current setting is unknown.
CT01: CLR C ;C IS CLEARED TO ZERO
CPL C ;C IS SET TO ONE
Encoding: 11 0 0 1 1 0 1 0 11 95H
Description: The setting of flag 0 is complemented; one is changed to zero, and zero is
changed to one. .
Operation: FO - NOT (FO)
Encoding: 11 0 1 1 10 1 0 11 85H
Description: The setting of flag 1 is complemented; one is changed to zero, and zero is
changed to one.
Operation: (F1) - NOT (F1)
3·13
MCS®~48 INSTRUCTION SET
Encoding: I0 1 0 1 I0 1 1 1 I 57H
Description: The 8-bit accumulator value is adjusted to form two 4-bit Binary Coded
Decimal (BCD) digits following the binary addition of eCD numbers.
The carry bit C is affected. If the contents of bits 0-3 are greater than nine,
or if AC is one, the accumulator is incremented by six.
The four high-order bits are then checked. If bits 4-7 exceed nine, or if
C is one, these bits are increased by six. If an overflow occurs, C is set
to one.
Example: Assume accumulator contains 10011011.
DA A ;ACC Adjusted to 00000001
;WITH CSET
C AC 7 4 3 0
o 0 100 1 1 011
00000 1 1 0 ADD SIX TO BITS 0-7
o 10100001
o1 1 0 ADD SIX TO BITS 4-7
o 0000000 OVERFLOW TO C
Encoding: \ 0 0 0 0 I0 1 1 1 I 07H
Description: The contents of the accumulator are decremented by one. The carry flag
is not affected.
Operation: (A) - (A) -1
Example: Decrement contents of external data memory location 63.
MOV RO,#3FH ;MOVE '3F' HEX TO REG,O
MOVX A, @RO ;MOVE CONTENTS OF;
;LOCATION 63 TO ACC
DEC A ;DECREMENT ACC
MOVX @RO,A ;MOVE CONTENTS OF ACC TO
;LOCATION 63 IN EXPANDED
;MEMORY
Encoding: 11 1 0 0 \1 r r r 1 C8H-CFH
Description: The contents of working register 'r' are decremented by one.
Operation: (Rr) - (Rr) -1 r = 0-7
Example: DECR1: DEC Rl ;DECREMENT CONTENTS OF REG 1
3-14
MCS®-48 INSTRUCTION SET
Encoding: I 0 0 0 1 10 1 0 1 1 15H
Description: . External interrupts are disabled. A low signal on the interrupt input pin has
no effect.
I
Encoding: 10 0 1 1 0 1 0 1 1 35H
Description: Timer/counter interrupts are disabled. Any pending timer interrupt request
is cleared. The interrupt sequence is not initiated by an overflow, but the
timer flag is set and time accumulation continues.
Encoding: 11 1 1 0 11 r r r 1 E8H-EFH
Description: This is a 2-cycle instruction. Register 'r' is decremented, then tested for
zero. If the register contains all zeros, program control falls through to the
next instruction. If the register contents are not zero, control jumps to the
specified 'address'.
The address in this case must evaluate to 8-bits, that is, the jump must be
to a location within the current 256-location page.
Example: (Rr) - (Rr) -1 .. r =0-7
IfRrnotO
(PCO-7) - addr
Note: A 12-bit address specification does not cause an error if the
DJNZ instruction and the jump target are on the same page. If the DJNZ
instruction begins in location 255 of a page, it must jump to a target
address on the following page.
Example: Increment values in data memory locations 50-54.
MOV RO,#50 ;MOVE '50' DEC TO ADDRESS
;REGO
MOV R3,#5 ;MOVE '5' DEC TO COUNTER
;REG3
INCRT: INC @RO ;INCREMENT CONTENTS OF
;LOCATION ADDRESSED BY
;REGO
INC RO ;INCREMENT ADDRESS IN REG 0
DJNZ R3, INCRT ;DECREMENT REG 3 - JUMP TO
;'INCRT' IF REG 3 NONZERO
NEXT - ;'NEXT' ROUTINE EXECUTED
;IF R3 IS ZERO
3-15
MCS®-48 INSTRUCTION SET
I
Encoding: 10 0 1 0 0 1 0 1 I 25H
Description: Timer/counter interrupts are enabled. An overflow of thetimer/counter
initiates the interrupt sequence.
I
Encoding: 10 1 1 1 0 1 0 1 I 75H
Description: The test 0 pin is enabled to act as the clock output. This function is
disabled by a system reset.
Example: EMTSTO: ENTO ClK ;ENABlE TO AS CLOCK OUTPUT
Encoding: 10 0 0 0 11 0 P pi 09H-OAH
Description: This is a 2-cycle instruction; Data present on port 'p' is
transferred (read) to the accumulator.
Encoding: 10 0 0 1 1 0 1 1 11 1.7H
Description: The contents of the accumulator are incremented by one. Carry is not
affected.
Operation. (A) -,.. (A) +1
3-16
MCS®-48 INSTRUCTION SET
Encoding: I0 0 0 1 / 0 0 0 i / 10H-11H
Description: The contents of the resident data memory location addressed by register 'i' bits
0-5** are incremented by one.
Operation: ((Ri)) - ((Ri)) + 1 i = 0-1
Example: INCDM: MOV R1,#03FH ;MOVE ONES TO REG 1
/ INC @R1 ;INCREMENT LOCATION 63
Encoding: 10 0 0 0 /1 0 0 0 I 08H
Description: This is a 2-cycle instruction. Data present on the BUS port is transferred
(read) to the accumulator when the RD pulse is'dropped. (Refer to section
on programming memory expansion for details.)
Operation: (A) - (BUS)
Example: INPBUS: INS A,BUS ;INPUT BUS CONTENTS TO ACC
. • For use with internal program memory ONLY.
•• 0-5 in 8048AH/8748H
0-6 in 8049AH/8749H
0-7 in 8050AH
3-17
MCS®-48 INSTRUCTION SET
3-18
MCS®-48 INSTRUCTION SET
Encoding: 1a10 a9 a8 01 0 1 0 01
Encoding: 11 0 1 1 10 0 1 1 I B3H
Description: This is a 2-cyc!e insruction. The contents of the program memory location
pointed to by the accumulator are substituted for the 'page' portion of the
program counter (PC bits 0-7).
3-19
MCS®-48 INSTRUCTION SET
Encoding: I0 0 1 0 I0 1 1 0 I Ia7
I '
at::U a"
...,
aA
---y
I a<t
I """
a?
-
a1. an- I
I
2SH
Description: This is a 2.,.cycle instruction. Control passes to the specified address, if the
test O' signal is low.
Operation: (PC O- 7) - addr IfTO = 0
(PC) = (PC) + 2 If TO = 1
Example: JTOLOW: JNTO SO ;JUMP TO LOCATION SO DEC
;IF TO = 0
3-20
MCS®-48 INSTRUCTION SET
I
Encoding: 10 0 1 1 0 1 1 01 1a7 a6 a5 a41 a3 a2 a1 aO 1 36H
Description: This is a 2-cycle instruction. Control passes to t~e specified address if
the test 0 signal is high (= 1).
Operation: (PCO-7) - addr If TO = 1
(PC) = (PC) + 2 If TO =0
Example: JTOHI: JTO 53 ;JUMP TO LOCATION 53 DEC
;IF TO = 1
3-21
MCS®-48 INSTRUCTION SET
Encoding: 1 0 1 0 1 1 0 1 1 0 1 56H
Description: This is a 2-cycle instruction. Control passes to the specified address if the
test 1 signal is high (= 1).
Operation: (PC O- 7) - addr IfT1 = 1
(PC) = (PC) + 2 IfT1 = 0
Example: JT1 HI: JT1 COUNT ;JUMP TO 'COUNT' ROUTINE
;IF T1 = 1
, Encoding: 1 0 0 1 0 I0 0 1 1 I 23H
Description: This is a 2-cycle instruction. The 8-bit value specified by 'data' is loaded
in the accumulator.
Operation: (A) - data
Example: MOV A,#OA3H ;MOVE 'A3' HEX TO ACe
Encoding: 11 1 0 0 I0 1 1 1 I C7H
Description: The contents of the program status word are moved tothe accumulator.
Operation: (A) - (PSW)
Example: Jump to 'RB1SET' routine if PSW bank switch, bit 4, is set .
. BSCHK: MOV A,PSW ;MOVE PSW CONTENTS TO ACC
JB4 RB1SET ;JUMP TO 'RB1SET' IF Acc BIT 4 = 1
3-22
MCS®-48 INSTRUCTION SET
Encoding: 11 1 1 1 11 r r r 1 F8H-FFH
Description: 8-bits of data are removed from working register 'r' into the accumulator.
Operation: (A) - (Rr) r = 0-7
Example: MAR: MOV A,R3 ;MOVE CONTENTS OF REG 3 TO ACC
Encoding 11 1 1 1 10 0 0 i I FOH-F1H
Description: The contents of the resident data memory location addressed by bits 0-5** of
register 'i' are moved to the accumulator. Register 'i' contents are unaffected.
Encoding: I0 1 0 0 1 0 0 1 0 I 42H
Description: The contents of the timer/event-counter register are moved to the
accumulator.
Operation: (A) - (T)
Example: Jump to "EXIT" routine when timer reaches '64', that is, when bit 6 set-
assuming initialization 64,
TIMCHK: MOV A,T ;MOVE TIMER CONTENTS TO ACC
JB6 EXIT ;JUMP TO 'EXIT' IF ACC BIT 6 = 1
I
Encoding: 11 1 0 1 0 1 1 1 I D7H
Description: The contents of the accumulator are moved into the progam status word.
All condition bits and the stack.pointer are affected by this move.
Operation: (PSW) - (A)
Example: Move up stack pointer by two memory locations, that is, increment the
pointer by one.
INCPTR: MOV A,PSW ;MOVE PSW CONTENTS TO ACC
INC A ;INCREMENT ACC BY ONE
MOV PSW,A ;MOVE ACC CONTENTS TO PSW
··0-5 in B04BAH/B74BH
0-6 in B049AH/B749H
0-7 in B050AH
3-23
MCS®~48 INSTRUCTION SET
B8H-BFH
Description: This is a 2-cycle instruction. The 8-bit value specified by 'data' is moved to
register'r'.
Operation: (Rr) - data r = 0-7
Examples: MIR4: MOV R4,#HEXTEN ;THE VALUE OF THE SYMBOL
;'HEXTEN' IS MOVED INTO REG 4
MIR 5: MOV R5,#PI*(R*R) ;THE VALUE OF THE EXPRESSION
;'PI*(R*R)' IS MOVED INTO REG 5
MIR 6: MOV R6, #OADH ;'AD' HEX IS MOVED INTO REG 6
Encoding: 11 0 1 0 10 0 0 i 1 AOH-A1H
Description: The contents of the accumulator are moved to the resident data memory
location whose address is specified by bits 0-5** of register 'i'. Register 'i'
contents are unaffected.
Operation: ((Ri)) - (A) i = 0-1
Example: Assume RO.contains 00000111.
MDMA: MOV @RO,A ;MOVE CONTENTS OF ACC TO
;LOCATION 7 (REG 7)
Encoding: 11 0 1 1 1 0 0 0 i l l d7 d6 d5 d4 1 d3 d2 d1 dO 1 BOH-B1H
Description: This is a 2-cycle instruction. The 8-bit value specifi~d by 'data' is moved
to the resident data memory location addressed by register 'i', bits 0-5**.
Operation: ((Ri)) - data i = 0-1
Examples: Move the hexadecimal value AC3F to locations 62-63.
MIDM: MOV RO,#62 ;MOVE '62' DEC TO AD DR REG 0
MOV @RO,#OACH ;MOVE 'AC' HEX TO LOCATION 62
INC.RO ;INCREMENT REG 0 to '63'
MOV @RO,#3FH ;MOVE '3F' HEKTO LOCATION 63
•• 0-5 in 8048AH/8748H
0-6 in 8049AH/8749H
0-7 in 8050AH
3-24
MCS®-48 INSTRUCTION SET
Encoding: I 0 1 1 0 10 0 10 1 62H
Description: The contents of the accumulator are moved to the timer/event-counter
register.
Operation: (T) - (A)
Example: Initialize and start event counter.
INITEC: CLR A ;CLEAR ACC TO ZEROS
MOVT,A ;MOVE ZEROS TO EVENT COUNTER
START CNT ;START COUNTER
Encoding: 10 0 0 0 11 1 P P 1 OCH-OFH
Description: This is a 2-cycle instruction. Data on 8243 port 'p' is moved (read) to
accumulator bits 0-3. Accumulator bits 4-7 are zeroed.
Operation: (0-3) - (Pp) p = 4-7
(4-7) - 0
Note: Bits 0-7 of the opcode are used to represent ports 4-7. If you are
coding in binary rather than assembly language, the mapping is as
follows:
Bits 1 0 Port
00 4
01 S
106
11 7
Encoding: I0 0 1 1 11 1 P p 1 3CH-3FH
Descripiion: This is a 2-cycle instruction. Data in accumulator bits 0-3 is moved
(written) to 8243 port 'p'.. Accumulator bits 4-7 are unaffected. (See NOTE
above regarding port mapping.)
Operation: (Pp) - (AO-3) P =4-7
Example: Move data in accumulator to ports 4 and S.
OUTP4S: MOVD P4,A ;MOVE ACC BITS 0-3 TO PORT 4
SWAP A ;EXCHANGE ACC BITS 0-3 and 4-7
MOVD PS,A ;MOVE ACC BITS 0-3 TO PORT S
3-25
MCS®-48 INSTRUCTION SET
Encoding: 11 a 1 a 1a a 1 11 A3H
Description: The contents of the program memory location addressed by the
accumulator are moved to the accumulator. Only bits 0-7 of the program
counter are affected, limiting the program memory reference to the
current page. The program counter is restored following this operation.
Operation: (PCO.-7) - (A)
(A) - ((PC))
Note:· This is a 1-byte, 2-cycle instruction. If it appears in location 255 of a
program memory page, @A addresses a location in the following page.
Example: MOV12S: MOV A,#12S ;MOVE '12S' DEC TO ACC
MOVPA,@A ;CONTENTS OF 129th LOCATION IN
;CURRENT PAGE ARE MOVED TO ACC
Encoding: 11 1 1 a 1a a 1 11 E3H
Description: This is a 2-cycle instruction. The contents of the· program memory location
(within page 3) addressed by the accumulator are moved to the
accumulator. The program counter is restored following this operation.
Operation: (PCO-7) - (A)
(PCS-11) - 0011
(A) - ((PC))
Example: Look up ASCII equivalent of hexadecimal code in table contained at the
beginning of page 3. Note that ASCII characters are designated by a
7-bit code; the eighth bit is always reset.
TABSCH: MOV A,#OBSH ;MOVE 'BS' HEX TO ACC (10111000)
ANL A,#7FH ;LOGICAL AND ACC TO MASK BIT
;7 (00111000)
MOVP3 A,@A ;MOVE CONTENTS OF LOCATION '3S'
;HEX IN PAGE 3 TO ACC (ASCII'S')
Access contents of location in page 3 labelled TAB1.
Assume current program location is not in page 3.
TABSCH: MOV A,#LOW TAB 1 ;ISOLATE BITS 0-7 OF LABEL
;ADDRESS VALUE
MOVP3 A,@A ;MOVE CONTENTS OF PAGE 3
;LOCATION LABELED 'TAB1' TO ACC
3-26
MCS®-48 INSTRUCTION SET
Encoding: 11 0 0 0 1 0 0 0 i 1 80H-81H
Description: This is a 2-cycle instruction. The contents of the external data memory
location addressed by register 'i' are moved to the accumulator. Register 'i'
contents are unaffected. A read pulse is generated.
Operation: (A) +- ((Ri)) i = 0-1
Example: Assume R1 contains 01110110.
MAXDM: MOVX A,@R1 ;MOVE CONTENTS OF LOCATION
;118 TO ACC
Encoding: 10 0 0 0 1 0 0 0 0 1 OOH
Description: No operation is performed. Execution continues with the following
instruction.
Encoding: 10 1 0 0 11 r r r 1 48H-4FH
Description: Data in the accumulator is logically ORed with the mask contained in
working register 'r'.
Operation: (A) +- (A) OR (Rr) r = 0-7
Example: ORREG: ORL A,R4 ;'OR' ACC CONTENTS WITH
;MASK IN REG 4
3-27
MCS®-48 INSTRUCTION SET
Encoding: 10 1 0 0 10 0 0 i I 40H-41H
Description: Data in the accumulator is logically ORed with the mask contained in the
. resident data memory location referenced by register "i", bits 0-:-5**,
Operation: (A) - (A) OR ((Ri)) i = 0-1
Example: ORDM: MOV RO,#3FH ;MOVE '3F' HEX TO REG 0
ORL A,@RO ;'OR' AC CONTENTS WITH MASK
;IN LOCATION 63
3-28
MCS®-48 INSTRUCTION SET
Encoding: 11 0 0 0 11 1 P P 1 8CH-8FH
Description: This is a 2-cycle instruction. Data on port 'p' is logically ORed with the
digit mask contained in accumulator bits 0-3. .
Operation: (Pp) - (Pp) OR (AO-3) p = 4-7
Example: ORP7: ORlD P7,A ;'OR' PORT 7 CONTENTS WITH ACC
;BITS 0-3
Encoding: 10 0 0 0 1 0 0 1 0 1 02H
Description: This is a 2-cycle instruction. Data residing in the
accumulator is transferred (written) to the BUS port and
latched. The latched data remains valid until altered by
another OUTl instruction. Any other instructiol'] requiring
use of the BUS port (except INS) destroys the contents of
the BUS latch. This includes expanded memory operations
(such as the MOVX instruction). logical operations on
BUS data (AND, OR) assume the OUTl BUS,A instruction
has been issued previously.
Operation: (BUS) - (A)
Example: OUTlBP: OUTl BUS, A ;OUTPUT ACC CONTENTS TO BUS
Encoding: I0 0 1 1 11 0 P pi 39H-3AH
Description: This is a 2-cycle instruction. Data residing in the accumulator is transferred
(written) to port 'p' and latched.
Operation: (Pp) - (A) p = 1-2
Example: OUTlP: MOV A,R7 ;MOVE REG 7 CONTENTS TO ACC
OUTl P2,A ;OUTPUT ACC CONTENTS TO PORT 2
MOVA, R6 ;MOV REG 6 CONTENTS TO ACC
OUTl P1,A ;OUTPUT ACC CONTENTS TO PORT 1
• For use with internal program memory ONLY.
3-29
MCS®-48 INSTRUCTION SET
Encoding: 11 0 0 0 1 0 0 1 1/ 83H
Description: This is a.2-cycle instruction. The .stack pointer (pSW bits 0-2) is
decremented. The program counter is. then restored from the stack. PSW
bits 4-7 are not restored. .
Operation: (SP) - (SP)-1
(PC) -((SP»
Encoding: 11 0 0 1 1 0 0 1 11 93H
Description: This is a 2-cycle instruction. The stack pointer is decremented. The
program counter .and bits 4-7 of the PSW are then restored from the stack.
Note that RETR should be used to return from an interrupt, .but should
not be used within the interrupt service routine as it signals the end of an
interrupt routine by resetting the Interrupt in Progress flip-flop.
Operation: (SP) - (SP)-1
(PC) - ((SP»
(PSW 4,..7) - .((SP})
3-30
MCS®-48 INSTRUCTION SET
Encoding: 11 1 1 0 1 0 1 1 1 1 E7H
Description: The contents of the accumulator are rotated left one bit. Bit 7 is rotated
into the bit 0 position.
Operation: (An + 1) - (An)
(AO) - (A7) n = 0-6
Example: Assume accumulator contains 10110001.
RLNC: RL A ;NEW ACC CONTENTS ARE 01100011
Encoding: 11 1 1 1 1 0 1 1 1 1 F7H
Description: The contents of the accumulator are rotated left one bit. Bit 7 replaces the
carry bit; the carry bit is rotated into the bit 0 position.
Operation: (An + 1) - (An)
n = 0-6
(AO)- (C)
(C)-(A7)
Example: Assume accumulator contains a 'signed' number; isolate sign without
changing value
RL TC: CLR C ;CLEAR CARRY TO ZERO
RLC A ;ROTATE ACC LEFT, SIGN
;BIT(7) IS PLACED IN CARRY
RR A ;ROTATE ACC RIGHT - VALUE
;(BITS 0-6) IS RESTORED,
;CARRY UNCHANGED, BIT 7
;ISZERO
Encoding: 10 1 1 1 1 0 1 1 1 1 77H
Description: The contents of the accumulator are rotated right one bit. Bit 0 is rotated
into the bit 7 position.
Operation: (An) - (An + 1) n =0-6
(A7) - (AO)
Example: Assume accumulator contains 10110001.
RRNC: RR A ;NEW ACC CONTENTS ARE 11011000
3-31
MCS®-48 INSTRUCTION SET
Encoding: 10 1 1 0 10 1 1 1 1 67H
Description: The contents of the accumulator are rotated right one bit. Bit 0 replaces the
carry bit; the carry bit is rotated into the bit 7 position.
Operation: (An) +- (An + 1) n = 0~6
(A7) +- (C)
(C) +- (AO)
Example: Assume carry is not set and accumulator contains 10110001.
RRTC: RRC A ;CARRY IS SET AND ACC
;CONTAINS 01011000
Encoding: 11 1 1 0 1 0 1 0 1 1 E5H
Description: PC bit 11 is set to zero on next JMP or CALL instruction. All references to
program memory addresses fall within the range 0-2047.
Operation: (OBF) +- 0
Example: Assume program counter contains 834 Hex.
SEL MBO ;SELECT MEMORY BANK 0
JMP $+20 ;JUMP TO LOCATION 58 HEX
Encoding: 11 1 1 1 1 0 1 0 1 1 F5H
Description: PC bit 11 is set to one on next JMP or CALL instruction. All references to
program memory addresses fall within the range 2048-4095.
Operation: (OBF) - 1
3-32
MCS®-48 INSTRUCTION SET
Encoding: 11 1 0 0 10 1 0 1 I C5H
Description: PSW bit 4 is set to zero. References to working registers 0-7 address data
memory locations 0-7. This is the recommended setting for normal
program execution.
Operation: (BS) - 0
Encoding: 11 1 0 1 I0 1 0 1 I D5H
Description: PSW bit 4 is set to one. References to working registers 0-7 address data
memory locations 24-31. This is the recommended setting for interrupt service
routines, since locations 0-7 are left intact. The setting of PSW bit 4 in
effect at the time of an interrupt is restored by the RETR instruction when
the interrupt service routine is completed.
Operation: (BS) - 1
Example: Assume an external interrupt has occurred, control has passed to program
memory location 3, and PSW bit 4 was zero before the interrupt.
Operation: LOC3: JNI INIT ;JUMP TO ROUTINE 'INIT' IF
;INTERRUPT INPUT IS ZERO
INIT: MOV R7,A ;MOVE ACC CONTENTS TO
;LOCATION 7
SEL RB1 ;SELECT REG BANK 1
MOV R7,#OFAH ;MOVE 'FA' HEX TO LOCATION 31
Encoding: I0 1 1 0 I O. 1 0 1 I 65H
Description: This instruction is used to stop both time accumulation and event counting.
3-33
MCS®-48 INSTRUCTION SET
Example: Disable interrupt, but jump to interrupt routine after eight overflows and
stop timer. Count overflows in register 7.
START: DIS TCNTI ;DISABLE TIMJ;:R INTERRUPT'
CLRA ;CLEAR ACC TO ZEROS
MOVT,A ;MOVE ZEROS TO TIMER
MOV R7,A ;MOVE ZEROS TO REG 7
STRTT ;START TIMER
MAIN: JTF COUNT ;JUMP TO ROUTINE 'COUNT'
;IF TF = 1 AND CLEAR TIMER FLAG
JMP MAIN ;CLOSE LOOP
COUNT: INC R7 ;INCREMENT REG 7
MOVA,R7 ;MOVE REG 7 CONTENTS TO ACC
JB31NT ;JUMP TO ROUTINE 'INT' IF ACC
;BIT 3 IS SET (REG 7 = 8)
JMP MAIN ;OTHERWISE RETURN TO ROUTINE
;MAIN
Encoding: 10 1 0 0 I0 1 0 1 I 45H
Description: The test 1 (T1) pin is enabled as the event-counter input and the counter
is started. The event-counter register is incremented with each high-to-Iow
transition on the Ti pin.
Example: Initialize and start event counter. Assume overflow is desired with first T1
input.
STARTC: EN TCNTI .;ENABLE COUNTER INTERRUPT
MOV A,#OFFH ;MOVE 'FF'HEX (ONES) TO ACC
MOV T,A ;MOVES ONES TO COUNTER
STRTCNT ~ENABLET1ASCOUNTER
;INPUT AND START
3-34
MCS®-48 INSTRUCTION SET
Encoding: Ia 1 a 1 I a 1 a 1 I 55H
Description: Timer accumulation is initiated in the timer register. The register is
incremented every 32 instruction cycles. The prescaler which counts the
32 cycles is cleared but the timer register is not.
Example: Initialize and start timer.
STARTT: CLR A ;CLEAR ACC TO ZEROS
MOVT,A ;MOVE ZEROS TO TIMER
EN TCNTI ;ENABLE TIMER INTERRUPT
STRTT ;START TIMER
Encoding: 10 1 a a 1a 1 1 11 47H
Description: Bits 0-3 of the accumulator are swapped with bits 4-7 of the accumulator.
Operation: (A4-7)!:; (AO-3)
Example: Pack bits 0-3 of locations 50-51 into location 50.
PCKDIG: MOV RO, #50 :MOVE '50' DEC TO REG a
MOV R1, #51 ;MOVE '51' DEC TO REG 1
XCHD A,@RO ;EXCHANGE BITS 0-3 OF ACC
;AND LOCATION 50
SWAP A ;SWAP BITS 0-3 AND 4-7 OF ACC
XCHD A,@R1 ;EXCHANGE BITS 0-3 OF ACC AND
;LOCATION 51
MOV @RO,A ;MOVE CONTENTS OF ACC TO
;LOCATION 50
Encoding: 1a a 1 0 11 r r r J 28H-2FH
Description: The contents of the accumulator and the contents of working register 'r'
are exchanged.
Operation: (A)!:; (Rr) r = 0-7
Example: Move PSW contents to Reg 7 withol:Jt losing accumulator contents.
XCHAR7: XCH A,R7 ;EXCHANGE CONTENTS OF REG 7
;AND ACC
MOV A, PSW ;MOVE PSW CONTENTS TO ACC
XCH A,R7 ;EXCHANGE CONTENTS OF REG 7
'AND ACC AGAIN
3·35
MCS~-48 INSTRUCTION SET
Encoding: 10 0 1 0 10 0 0 i 1 20H-21H
Descripti.on: The contents of the accumulator and the contents of the resident data
memory location addressed by bits 0-5** of register 'i' are exchanged.
Register 'i' contents are unaffected. '
Operation: (A) ~ ((Ri)) i = 0-1
Example: Decrement contents of location 52.
DEC52: MOV RO,#52 ;MOVE '52' DEC TO ADDRESS REG 0
XCH A,@RO ;EXCHANGE CONTENTS OF ACC
;AND LOCATION 52
DECA ;DECREMENT ACC CONTENTS
XCH A,@RO ;EXCHANGE CONTENTS OF ACC
;AND LOCATION 52 AGAIN
Encoding: 10 0 1 1 1 0 0 0 i 1 30H-31H
Description: This instruction exchanges bits 0-3 oUhe accumulator with bits 0-3 of
the data memory location addressed by bits 0-5** of register 'i'. Bits 4-7 of
the accumulator, bits 4-7 of the data memory location, and the contents of
register 'i' are unaffected. -
Operation: (AO-3) ~ ((RiO-3)) i = 0-1
Example: Assume program counter contents have been stacked in locations 22-23.
, .
XCHNIB: MOV RO,#23 ;MOVE '23' DEC TO REG 0
CLR A ;CLEAR ACC TO ZEROS
XCHDA,@RO ;EXCHANGE BITS 0-3 OF ACC AND
;LOCATION 23 (BTS 8-11 OF PC ARE
;ZEROED, ADDRESS REFERS
:TO PAGE 0)
Encoding: 11 1 0 1 11 r r r 1 D8H-DFH
Description: Data in the accumulator is EXCLUSIVE ORed with the mask contained in
working register 'r'..
Operation: (A) - (A) XOR (Rr) r =0-7
_Example: XORREG:. XRL A,R5 ;'XOR' ACC CONTENTS WITH
;MASK IN REG 5
•• 0-5 in S04SAH/S74SH
0-6 in S049AH/S749H
0-7 in S050AH
3-36
MCS®-48 INSTRUCTION SET
Encoding: 11 1 0 1 1 0 0 0 i 1 DOH-D1H
Description: Data'in the accumulator is EXCLUSIVE ORed with the mask contained in the
data memory location addressed by register 'i', bits 0-5,*"
Operation: (A) - (A) XOR ((Ri)) i =0-1
Example: XORDM: MOV R1,#20H ;MOVE '20' HEX TO REG 1
XRL A,@R1 ;'XOR' ACC CONTENTS WITH MASK
;IN LOCATION 32
3-37
MCS® . .48 Data Sheets
and Index
4
8243
MCS®-48 INPUTIOUTPUT EXPANDER
• O°C TO 70°C Operation
PORTO
P50 vee
PolO P51
PORT5
,..1 P52
Pt2 P53
PORT Z Pt3 P60
CS Pll
·PROG P62
P23 Pl3
PORT6 P22 P73
P21 P72
P20 P71
GND P70
270161-2
PORT 7
Figure 2. 8243 Pin
Configuration
270161-1
Figure 1.8243 Block Diagram
October 1986
4-1 Order Number: 270161-001
8243
Vee 24 +5Vsupply.
fUNCTIONAL DESCRIPTION either high or low when power is applied. The first
high to low transition of PROG causes the device to
exit power on mode. The power on sequence is ini-
General Operation tiated if Vee drops below W.
The 8243 contains four 4-bit I/O ports which serve P21 P20 Address P23 P22 Instruction
as an extension of the on-chip I/O and are ad- Code Code
dressed as Ports 4-7. The following operations may o o Port 4 o o Read
be performed on these ports: o 1 Port 5 o 1 Write
• Transfer Accumula.tor to Port. 1 o Port 6 1 o ORLD
• Transfer Port to Accumulator. 1 1 Port 7 1 1 ANLD
• AND Accumulator to Port.
• OR Accumulator to Port. Write Modes
All communication between the 8048 and the 8243 The device has three write modes. MOVD Pi, A di-
occurs over Port 2 (P20-P23) with timing provided rectly writes new data into the selected port and old
by an output pulse on the FROG pin of the piOces- data is lost. ORlD Pi, A takes nety data, OR's it with
sor. Each transfer consists of two 4-bit nibbles: the old data and then writes it to the port. ANLD Pi,
A takes new data, AND's it with the old data and
The first containing the "op code" and port address then writes it to the port. Operation code and port
and the second containing the actual 4-bits of data. address are latched from the input Port 2 on the high
A high to low transition of the PROG line indicates to low transition of the PROG pin. On the low to high
that address is present while a low to high transition transition of PROG data on PQrt 2 is transferred to
indicates the presence of data. Additional 8243's the logic block of the specified output port.
may be added to the 4-bit bus and chip selected
using additional output lines from the After the logic manipulation is performed, the data is
8048/8748/8035. latched and outputed. The old data remains latched
until new valid outputs are entered. .
Power On Initialization
Read Mode
Initial application of power to the device forces in-
put/output Ports 4, 5, 6, and 7 to the tri-state and The device has one read mode. The operation code
Port 2 to the input mode. The PROG pin may be and port address are latched from the input Port 2
4-2
intJ 8243
on the high to low transition of the PROG pin. As Normally, a port will be in an output (write mode) or
soon as the read operation and port address are· input (read mode). If modes are changed during op-
decoded, the appropriate outputs are tri-stated, and eration, the first read following a write should be ig-
the input buffers switched on. The read operation is nored; all following reads are valid. This is to allow
terminated by a low to high transition of the PROG the external driver on the port to settle after the first
pin. The port (4, 5, 6 or 7) that was selected is read instruction removes the low impedance drive
switched to the tri-stated mode while Port 2 is re- from the 8243 output. A read of any port will leave
turned to the input mode. that port in a high impedance state.
4-3
inter 8243
NOTE:
1. Icc (-40·C to 85·C EXPRESS options) 15 mA typical/25 mA maximum.
4·4
inter 8243
WAVEFORMS
PROG
~~ ______________ IK ________________ ~
PORT 2
IpO
lIP
ICS ICS
270161-4
4-5
inter 8243
125
100
C
!
:;
5}
~ 75
...Z
III
"'.
'"'" GUARANTEED WORST CASE
..
U
Z
50
CURRENT SINKING CAPABILITIES
OF ANY 1/0 PORT PIN YO. TOTAL
~
...0
25
4 10 11 12 13
MAXIMUM SINK CURRENT ON ANY PIN @ .45V
MAXIMUM 101. WORST CASE PIN (mA)
270161-5
4-6
inter 8243
-=-
CS
liD
P4 110
PROG PROG
TEST P5 110
INPUTS
8048 8243
P6 4 110
P20-P23 DATA IN
P2
P7 110
270161-6
PORT 1
0048
PORT2
PROG~--------------+---------------~--------~------~--------------~
270161-8.
4-7
P8748H/P8749H
8048AH/8035AHL/8049AH/8039AHL/8050AH/8040AHL
HMOS SINGLE-COMPONENT 8-BIT
PRODUCTION MICROCONTROLLER
• High Performance HMOS II
• Easily
Programmable ROMs Using 21V
• Interval Time/Event Counter
• Up to 1Expandable Memory and I/O
• Two Single Level Interrupts
• Instructions 1 or 2 Cycles
~36
IJ-s Instruction Cycle All
• Single 5-Volt Supply
• Over 96 Instructions; 90% Single Byte
The Intel MCS®-48 family are totally self-sufficient, 8-bit parallel computers fabricated on single silicon chips
using Intel's advanced N-channel silicon gate HMOS process.
The family contains 27 I/O lines, an 8-bit timer/counter, and on-board oscillator/clock circuits. For systems
that require extra capability, the family can be expanded using MCS®-80/MCS®-85 peripherals.
These microcontrollers are available in both masked ROM and ROMless versions as well as a neW version,
The Programmable ROM. The Programmable ROM provides the user with the capability of a masked ROM
while providing the flexibility of a device that can be programmed at the time of-requirement and to the desired
data. Programmable ROM's allow the user to lower inventory levels while at the same time decreasing delay
,times and code risks. '
These microcomputers are d,esigned to be efficient controllers as well as arithmetic processors. They have
extensive bit handling capability as well as facilities for both binary and BCD arithmetic. Efficient use of
program memory results from an instruction set consisting of mostly, single byte instructions and no instruc-
tions over 2 bytes in length. '
Device Internal Memory RAM STANDBY
B050AH 4KxBROM 256xBRAM yes
B049AH 2KxBROM 12BxBRAM yes
B04BAH 1KxBROM 64xBRAM yes
B040AHL None 256xBRAM yes
B039AHL None 12BxBRAM yes
B035AHL None 64xBRAM yes
PB749H 2K x B Programmable ROM 12BxBRAM no
PB74BH 1K x B Programmable ROM 64xBRAM no
270053-1
Figure 1. Block Diagram
270053-2
November 1987
4-8 Order Number: 270053-002
intJ MCS®-48
I~ ~ ~
I~ wee
en a:: 0 0z u
....
0
- ~
> ~
r--
~ a..
~ D-~
CD II)
TO , Vee
XTAL 1 T1
XTAL2
RESET'
P27
P26 iNT • P2.4
SS P2S EA PL7
INT P2' Rii B049AH/B039AHL
PI.6
EA PI7 PSEN B050AH/B040AHl PI.S
AD P'6
PSEN p,s WR 44- PIN PI.4
Plee
WR Ne Ne
ALE
DBO ALE PI.3
DB, 090 PI.2
DB2 091 PI.I
Top View
DB3 looking down on PC Boord
092 PCO
DB.
DBS 093 VOO
DB6
DB7
VSS " - _ - - - ' ' ' '
270053-3
270053-14
4-10
MCS®-48
4-11
MCS®-48
4-12
MCS®·48
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Case Temperature Under Bias ...•..• O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .•.•..•... - 65°C to + 150·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on any Pin with Respect
tional sections of this specification is not implied. Ex-
to Ground ...................... - 0.5V to + 7V posure to absolute maximum rating conditions for
Power Dissipation .............•.....•...... 1.5W extended periods may affect device reliability.
4-13
inter MCS®-48
IUl Input Leakage Current -500 p.A Vss + 0.45 s VIN s Vee All
(P10-P17, P20-P27,
EA, SS) ,
IU2 Input Leakage Current -10 -SOO p.A Vss s VIN s S.B All
RESET
ILO Leakage Current ±10 p.A Vsss VIN sVee All
(BUS, TO) (High
Impedance State)
100 Voo Supply Current S 5 ,mA' B04BAH
(RAM Standby) BOS5AHL
4 7 mA 8049AH
BOS9AHL
5 10 mA .,;
8050AH
B040AHL
100 + Total Supply Current" SO 65 mA B048AH
lee BOS5AHL
35 70 mA B049AH
BOS9AHL
40 BO mA B050AH
B040AHL
SO 100 mA PB74BH
50 110 mA PB749H
Voo RAM Standby Voltage , ,2.2 5.5 V Standby Mode Reset B04BAH
sVILl 8035AH
2.2 5.5 V B049AH
BOS9AH
\I
2.2 5.5 v 8050AH
I I B040AHL I
'Icc + 100 are measured with all outputs in their high impedance state; RESET low; 11 MHz crystal applied; INT, 55, and EA floating.
intJ MCS®-48
NOTES:
1. Control outputs: CL = 80 pF. BUS Outputs: CL = 150 pF.
2. BUS High Impedance Load 20 pF
3. f(t) assumes 50% duty cycle on X1, X2. Max clock period is for a 1 MHz crYstal input.
4-15
inter MCS®·48
WAVEFORMS
-..j .LAFC1r-
ALE
RD
'DR
FLOAT.NG
270053-5
WRITE TO EXTERNAL DATA MEMORY INPUT AND OUTPUT FOR A.C. TESTS
270053-7
A.C. testing inputs are driven at 2.4V lor a logic "1" and 0,45V lor
a logic "0". Output timing measurements are made at 2.0V lor a
logic "1" and 0.8V lor a logic "0".
270053-6
ALE
PSEN
I
I
P2~-23 r-----P-~~R-T-~-~--i-O-A--'A--~\lr-h-·E-W-·F-.U----~-O-A-~~--
OUTPUT
P24-21
~ __ PCH
~----------J
OUTPUT
,..----'------->.1 r------;,
PCH
;--------
I OUTPUT DATA
I
' -_ _ _ _ _ _...J
I i---
I~'
'PF
EXPANDER
PORT
~--PC-H--~I
I "
r-~-~
'PR~
'NPUT
j-.cp+.PC.j ' - - _ . J I I
PROG ---.,.--------------....,~r-.PP_r_
270053-8
4-16
MCS®-48
Cl Cl
~,-C_2_--,-
L, ,- -"-_~_~_!- -:2:-1
f------""""""f"---=2'-l
~(
XTALl
1-11
-:b
__ XTALl
XTAL2
J- C""""~ ~ XTAL2
C3 C3
270053-9 270053-10
Cl = 5 pF ±% pF + (STRAY < 5 pF)
C2 = (CRYSTAL + STAY) < 8 pF
C3 = 20 pF ±1 pF + (STRAY < 5 pF)
Crystal series resistance should be less than 3011 at 11 MHz; less
than 7511 at 6 MHz; less than 18011 at 3.6 MHz.
+SV
47011
»-.----'=-1 XTAL1
+5V
TTL OPEN
COLLECTOR
GATES 47011
'----..L---;;1 XTAL2
270053-11
For XTALl and XTAL2 define "high" as voltages above 1.6V and
"low" as vOltages below 1.6V. The duty cycle requirements for
externally driving XTAL 1 and XTAL2 using the circuits shown
above are as follows: XTAL1 must be high 35-65% of the period
and XTAL2 must be high 35-65% of the period. Rise and fall times
must be faster than 20 ns.
4-17
inter MCS®-48
NOTE:
Once programmed the P8749H/48H cannot be
erased.
4-18
MCS®-48
NOTE:
II Test 0 is high, too can be triggered by RESET.
4-19
MCS®·48
ALE
(NOTE 1)
E« ....:J.
I
: (INPUT)
I
I
I ,,
DB----i ADDRESS H
.....-(~IN:-::P::-U':':T::-)---'
ROM DATA
(OUTPUT)
H
I
ADDRESS
~----------------
, (INPUT) (OUTPUT)'
I
RESET _ _ _ _ _ _....
,
~,
I
(INPUT) .
. ! - - i-
,,
- -
270053-12
50H Vee = Veo = +5V
Al0 ADDR Vss = OV
All ADDR
NOTE:
ALE is function of X1, X2 inputs.
VEAH
EA
Vee ---+---'
I_ _ _ _ _ _ _ PROGRAM--------II--~VERIFY-~~---PROGRAM-
Vee
TO
VIL1
Vee
RESET
VIL1
iAw-+i--t--i-1 twA - -tcc~
LAST NEXT
ADDRESS ADDRESS
VDDH - - - - - - - - - - - -
VDD
.Vee------------
lOw
VPH -----------------+-t-i--_\.
PROG
VPL--------------- ------,-- --.------------
270053-13
4-20
inter D8748H/D8749H
HMOS-E SINGLE-COMPONENT 8-BIT MICROCOMPUTER
• High Performance HMOS-E
• Compatible with 8080/8085 Peripherals
The family contains 27 I/O lines, an 8-bit timer/counter, on-chip RAM and on-board oscillator/clock circuits.
For systems that require extra capability, the family can be expanded using MCS®-80/MCS®-85 peripherals.
These microcomputers are designed to be efficient controllers as well as arithmetic processors. They have
extensive bit handling capability as well as facilities for both binary and BCD arithmetic. Efficient use of
program memory results from an instruction set consisting mostly of single byte instructions and no instruc-
tions over 2 bytes in length.
PORT
I
D8748H PORT
2
D87-49H
READ
WRITE
PROGRALi
STORE
ENABLE
ADDRESS
LATCH
. ENABLE
PORT
EXPANDER
210983-1 STROBE
Figure 1. 210983-2
Block Diagram
Figure 2.
Logic Symbol
October 1987
4-21 Order Number: 210983-003
D8748H/D8749H
Vee
Tl
P27
RESET P26
55 P25
P2.
P17
Ro P16
PSEN P15
Wi! P14
P13
08. P12
DB, P11
08 2 Pl.
DB. VOO
PROG
P23
P22
DB7 P21
VSS
210983-3
4-23
inter D8748H/D8749H ~OOjgILOIMIOOO£OOW
4-24
inter 087 48H/087 49H
ABSOLUTE MAXIMUM RATINGS* 'Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O°C to + 70°C age to the device. This is a stress rating only and
Storage Temperature .......... - 65°C to + 150°C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage On Any Pin With Respect
tional sections of this specification is not implied Ex-
to Ground ...................... - 0.5V to + 7V
posure to absolute maximum rating conditions for
Power Dissipation ....................... 1.0 Watt extended periods may affect device reliability.
NOTE:
'Icc + IDD is measured with all outputs disconnected; ss, RESET, and INT equal '0 Vee; EA equal to Vss.
4-25
intJ D8748H/D8749H
NOTES:
1. Control outputs CL = 80 pF; BUS outputs CL = 150 pF.
2. BUS High Impedance Load 20 pF.
3. f(t) assumes 50% duty cycle on X1, X2. Max clock period is for a 1 MHz crystal input.
4-26
inter D8748H/D8749H
WAVEFORMS
210983-6
210983-4
READ FROM EXTERNAL DATA MEMORY INPUT AND OUTPUT FOR A.C. TESTS
--/tLAFC1L
ALE Jr-----,IL...----:1_ _ _ _-' l 2.4V - - - - - . . , - -_ _
A.C. testing inputs are driven at 2.4V for a Logic "I" and 0.45V
for a Logic "0". Output timing measurements are made at 2.0V
for a Logic "I" and 0.8V for a Logic "0."
210983-5
4-27
D8748H/D8749H
ALE
1
PSEN
P20-23 I
OUTPUT PCH P,?RT 20-23 DATA NEW P20-23 DATA I PCH
'-------~I
P24-27 -t--'------'--'------------7----.-!.--____
P10-17 PORT 24-27, PORT 10-17 DATA NEW PORT DATA
OUTPUT. -t---~-----------~-------f~-------~I---
ILP
--1 I-ICA1
~ . IIPD
~IDP
EXPANDER "-IPL~
- 1 - - - - I L A - - - " + '..
PORT
OUTPUT
~ _ _ _ _ _ _ _- J
PCH 1 rp-O-R-T-20--2-3-D-A-TA-;'1 I PORT CONTROL OUTPUT DATA I
"'" "'
I
I I, I;)
EXPANDER , IPR -----I"~I Fl
PORT
INPUT PCH
r------,. 'I I"
PROG
210983-8
C1
~_-r-_----1_ _---j2 XTAL1
~
. I 11-11
C2 :::;o~-::,:: c!:3HZ
=- L--.jl
II T I 31 XTA!..:!
C3
210983-9
4-28
inter D8748H/D8749H
4-29
D8748H/D8749H
4-30
intJ D8748H/D8749H
WAVEFORMS
VEAH
EA
Vee __+_J
I-------PROGRAM-------t--VERIFY--t----PROGRAM-
Vee
TO
VIL1
Vee
RESET
VIL1
IAW+----r~+IWA
LAST NEXT
ADDRESS ADDRESS
V;:'DH tyDDW~r~~
VDDL----------~~ I I ~--------------------------------
PRoi:: _ _ _ - _______ :~EV__TI~: __________________. 210983-12
VERIFY MODE
\~ __--J/ \~-
DBO-DB7 ==>--- ADDRESS
(0-7) VALID - - -< ,-_ _
NI:XT X
A_DD_R...;.E",;S;,;;S_J
NEXT DATA)-
OUT VALID
4·31
intJ D8748H/D8749H
(OUTPUT)
H,
ADDRESS
(INPUT)
~-~-------
(OUTPUT):
I
210983-14
48H 49B Vee = Vee = +5V
Vss = OV
A10 o ADDR
A11 o o
NOTE:
ALE is function of X1. X2 inputs.
4-32
MCS®-48
EXPRESS
The new Intel EXPRESS family of single-component 8-bit microcomputers offers enhanced processing options
to the familiar 8048AH/8035AHL. 8748H. 8049AH/8039AHL. 8749H. 8050AH/8040AHL Intel components.
These EXPRESS products are designed to meet the needs of those applications whose operating require-
ments exceed commercial standards. but fall short of military conditions.
The EXPRESS options include the commercial standard and -40·C to + 85°C operation with or without 168
±8 hours of dynamic burn-in at 125·C per MIL-STD-883. method 1015. Figure 1 summarizes the option
marking designators and package selections.
For a complete description of 8048AH/8035AHL. 8748H. 8049AH/8309AHL. 8749H. 8040AHL and 8050AH
features and operating characteristics, refer to the respective standard commercial grade data sheet. This
document highlights only the electrical specifications which differ from the respective commercial part.
September 1987
4-33 Order Number: 270225-002
MCS@·48 EXPRESS
TP8048AH/TP8035AHL/LP8048AH/LP8035AHL
TD8048AH/TDB035AHL/LD8048AH/LD8035AHL
TP8049AH/TP8039AHL/LP8049AH/LP8039AHL
TD8049AH/TD8039AHL/LD8049AH/LD8039AHL
. TP8050AH/TP8040AHL/LP8050AHL/LP8040AHL
TD8050AH/TD8040AHL/LD8050AH/LD8040AHL
4-34
MCS®-48 EXPRESS
TD8748H/LD8748H
TD8749H/LD8749H·
TP8743/TD8243/LD8243
4-35
MCS®-48 INDEX
8
8243 Expander, 2-4 I/O Expander Device (8243), 2-4
8243 Port Characteristics, 2-5 I/O Expansion, 2-4; 2-5
I/O Port Characteristics,.2-5
I/O Port Restore, 2-2
A Instruction Decoder, 1-1
Instruction Fetch (External), 2-1
Accumulator, 1-1 INT, 1-17
Addressing Beyond 2K, 2-1 Interrupt, 1-5, 1-7
Addressing External Data Memory, 2-4 Interrupt Routines, 2-2
ALE, 1-17,2-9 'Interrupt Timing, 1-7
ALU, 1-1
Arithmetic Logic Unit, 1-1
M
c
o
Clock Circuits, 1-9
Conditional Branches, .1-6 Oscillator, 1-9
Control Signals, 2-8
Counter, 1-7
Cycle Counter, 1-10 p
4-36
s v
Single Step, 1-11, 1-14 Vee, 1-17
Stack, 1-5 VDD,I-17
State Counter, 1-10 Verifying EPROM, 1-18
Sync Mode, 1-15 VSS, 1-17
T W
TO, 1-5, 1-17 WR, 1-17,2-9
TI, 1-5, 1-17 Write Cycle, 2-3
Test Inputs, 1-5
Timer, 1-7, 1-9
Timing, 1-13
Timing Circuits, 1-9
4-37
MCS® . . 51 Architectural
Overview
5
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
ARCHITECTURAL OVERVIEW
OF THE MCS®-S1 FAMILY OF MICROCONTROLLERS
i-------.
I I
I I
I I
I I
I I
I I
I I
I I
EXTERNAL
8K ROM
IN 8052 j-·------I 1-------·
INTERRUPTS I
I I (8052)
TIMER2 ~~----l
I
I
256 BYTES COUNTER
4K RAM IN 8052 TIMER 1 INPUTS
ROM
128 BYTES
RAM TIMER 0
TXD RXD
ADDRESS/DATA
270251-1
5-1
intJ MCS®·51 ARCHITECTURAL OVERVIEW
8051 80C51BH
The 8051 is the original member of the MCS-51 Fami- The 80C51BH is the CHMOS verSion of the 8051.
ly, and has been in production since 1981. Among the Functionally, it is fully compatible with the 8051, but
features of the 8051 are: being CMOS it draws less current than its HMOS
• 8-bit CPU optimized for control applications counterpart. To further exploit the power savings avail-
able in CMOS circuitry, two reduced power modes are
• Extensive Boolean processing (single-bit logic) added:
capabilities
• Software-invoked Idle Mode, during which the CPU
• 32 bidirectional and individually addressable I/O is turned off while the RAM and other. on-chip
lines peripherals continue operating. In this mode, cur-
• 128 bytes of on-chip Data RAM rent draw is reduced to about 15% of the current
• Two 16-bit timer/counters drawn when the device is fully active.-
• Full duplex UART • Software-invoked Power Down Mode, during which
all on-chip activities are suspended. The on-chip
• 5-source interrupt structure with 2 priority levels RAM continues to hold its data. In this mode the
• On-chip clock oscillator device typically draws less than 10 p.A.
• 4K bytes of on-chip Program Memory
Although the 80C51BH is functionally compatible with
• 64K Program Memory address space its HMOS counterpart, specific differences between the
• 64K Data Memory address space two types of devices must be considered in the design of
an application circuit if one wishes to ensure complete
The 8031 differs from the 8051 in not having the on- interchangeability between the HMOS and .CHMOS
chip Program ROM. Instead, the 8031 fetches all in- devices. These considerations are discussed in the Ap-
structions from external memory. plication Note AP-252, "Designing with the
8OC51BH".
The EPROM version of the 8051, the 8751, is no longer
in production. It has been superseded by the 8751H. The ROMIess version of the 80C5IBH is the
80C3IBH. The EPROM version is the 87C51.
8051AH
83C51FA
The 8051AH is identical to the 8051, but is fabricated
The 83C51FA is an enhanced version of the 80C51BH
with HMOS II technology. It is pin-for-pin compatible
with the 8051. and is backwards compatible with the 80C51BH. The
new features which have been incorporated are as fol-
The ROMless version of the 8051AH is the 8031AH. lows:
The EPROM version is the 8751H. • Programmable Counter Array with
Compare/Capture
High Speed Output
8052AH Pulse Width Modulator
Watchdog Timer
~ The 8052AH is an enhanced 8051. It is fabricated with • Programmable Serial Channel
HMOS II technology, and is backwards compatible Automatic Address Recognition
with the 8051. Its enhancements over the 8051 are as Framing Error Detection
follows:
• Enhanced Power Down Mode
• 256 bytes of on-chip Data RAM
• Up/down timer/counter
• Three timer/counters
• 8 Kbytes of on-chip Program ROM
• 6-source interrupt structure
• 256 bytes of on-chip Data RAM
• 8K bytes of on-chip Program ROM
• 7-source interrupt structure
The ROMless version of the 8052AH is the 8032AH.
The EPROM version is the 8752BH. For further information on these new features, refer to
the "Hardware Description of the 83C51FA" chapter.
A separate product, the 8052AH-BASIC, is an
8052AH with a full BASIC interpreter in the on-chip The ROMless version of the 83C51FA is the80c51FA.
ROM. . The EPROM version is the 87C51FA.
5-2
inter MCS®-51 ARCHITECTURAL OVERVIEW
PROGRAM MEMORY
(READ ONLY) ________ _ DATA MEMORY __ ______ _
'<~~2~~~T:t
.------------------------
FFFFH: ...---., FFFFH:
EXTERNAL
EXTERNAL
INTERNAL
FFH.tp------
,,
"
EA=O
EXTERNAL
EA=1
INTERNAL
,,
.--.--~-------------------
270251-2
5-3
MCS®-51 ARCHITECTURAL OVERVIEW
ROMless versions all Program Memory is' external. The lowest 4K (or 8K, in the 8052AH, 83C51FA and
The read strobe for external Program Memory is the 83CI5~) bytes of Program Memory can be either in the
signal PSEN (Program Store Enable). on-chip ROM or in an external ROM. This selection is
made by strapping the EA (External Access) pin to
Data Memory occupies a separate address space from either Vee or Vss.
Program Memory. Up to 64K bytes of external RAM
can be addressed in the external Data Memo~ace. In the 8051 and its derivatives, if the EA pin is strapped
The CPU generates read and write signals, RD and to Vco then program fetches' to addresses OOOOH
WR, as needed during external Data Memory accesses. through OFFFH are directed to the internal ROM. Pro-
gram fetches to addresses l000H through FFFFH are
External Program Memory and external Data Memory directed to external ROM.
may be combined if desired by applying the RD and
PSEN signals to the inputs of an AND gate and using In the 8052AH and the other 8K ROM parts, EA =
the output of the gate as the read strobe to the external Vee selects addresses OOOOH through lFFFH to be in-
Program/Data memory. ternal, and addresses 2000H through FFFFH to be ex-
ternai.
As shown in Figure 3, each interrupt is assigned a fixed The read strobe to external ROM, PSEN, is used for all
location in Program Memory. The interrupt causes the, external program fetches. PSEN is not activated for in-
CPU to jump to that location, where it commences exe- ternal program fetches.
cution of the service routine. External Interrupt 0, for
example, is assigned to location 0003H. If External In-
terrupt 0 is going to be used, its service routine must
begin at location 0003H. If the interrupt is not going to EPROM
be used, its service location is available as general pur-
pose Program Memory.
LATCH
(0033H) P2~=====:;)f
002BH
iJ
270251-4
0023H
LOCATIONS [ :::::=t 8
BYTES
Program Memory
5-4
MCS®-51 ARCHITECTURAL OVERVIEW
Program Memory addresses are always 16 bits wide, Internal Data Memory is mapped in Figure 6. The
even though the actual amount of Program Memory memory space is shown divided into three blocks,
used may be less than 64K bytes. External program which are generally referred to as the Lower 128, the
execution sacrifices two of the 8-bit ports, PO and P2, to Upper 128, and SFR space.
the function of addressing the Program Memory.
Internal Data Memory addresses are always one byte
wide, which implies an address space of only 256 bytes.
Data Memory However, the addressing modes for internal RAM can
in fact accommodate 384 bytes, using a simple trick.
The right half of Figure 2 shows the internal and exter- Direct addresses higher than 7FH access one memory
nal Data Memory spaces available to the MCS-51 user. space, and indirect addresses higher than 7FH access a
different memory space. Thus Figure 6 shows the Up-
Figure 5 shows a hardware configuration for accessing per 128 and SFR space occupying the same block of
up to 2K bytes of external RAM. The CPU in this case addresses, 80H through FFH, although they are physi-
is executing from internal ROM. Port 0 serves as a cally separate entities.
multiplexed address/data bus to the RAM, and 3 lines
of Port 2 are being used to page the RAM. The CPU
generates RD and WR signals as needed during exter- 7FH
nal RAM accesses.
BANK 2FH
SELECT T-ADDRESSABLE SPACE
BITS IN } BI
,...------./1 DATA (B IT ADDRESSES 0-7F)
PSW~ 20H
11{ 18H
lFH
17H
10{ 4 BANKS OF
10H
8 REGISTERS
OFH
01 { R0-R7
08H
00 {
0
07H - RESET VALUE OF
STACK POINTER
270251-7
Figure 5. Accessing External Data Memory. The Lower 128 bytes of RAM are present in all
If the Program Memory Is Internal, the Other MeS-51 devices as mapped in Figure 7. The lowest 32
Bits of P2 are Available as 110. bytes are grouped into 4 banks of 8 registers. Program
instructions callout these registers as RO through R7.
There can be up to 64K bytes of external Data Memo- Two bits in the Program Status Word (PSW) select
ry. External Data Memory addresses can be either 1 or which register bank is in use. This allows more efficient
2 bytes wide. One-byte addresses are often used in con- use of code space, since register instructions are shorter
junction with one or more other I/O lines to page the than instructions that use direct addressing.
RAM, as shown in Figure 5. Two-byte addresses can
also be used, in which case the high address byte is
emitted at Port 2. FFH
5·5
inter MCS®-51 ARCHITECTURAL OVERVIEW
I CY I AC I Fa I RSll RSO I ov I Ip I
PSW 7 ,J L PSW 0
CARRY FLAG RECEIVES CARRY OUT PARITY OF ACCUMULATOR SET
FROM BIT 1 OF ALU OPERANDS BY HARDWARE TO 1 IF IT CONTAINS
AN ODD NUMBER OF 1S, OTHERWISE
IT IS RESET TO 0
PSW 6i - - PSW 1
AUXILIARY CARRY FLAG RECEIVES USER DEFINABLE FLAG
CARRY OUT FROM BIT 1 OF
ADDITION OPERANDS
PSW 5 PSW 2
GENERAL PURPOSE STATUS FLAG OVERFLOW FLAG SET BY
ARITHMETIC OPERATIONS
, PSW 4 PSW 3
REGISTER BANK SELECT BIT 1 REGISTER BANK SELECT BIT 0
270251-10
The next 16 bytes above the register banks form a block Sixteen addresses in SFR space are both byte- and bit-
of bit-addressable memory space. The MCS-51 instruc- addressable. The bit-addressable SFRs are those whose
tion set includes a wide selection of single-bit instruc- address ends in OOOB. The bit addresses in this area are
tions, and the 128 bits in this area can be directly ad- 80H through FFH.
dressed by these instructions. The bit addresses in this
area are OOH through 7FH.
THE MCS®·51 INSTRUCTION SET
All of the bytes in the Lower 128 can be accessed by
either direct or indirect addressing. The Upper 128 All members of the MCS-51 family execute the same
(Figure 8) can only be accessed by indirect addressing. instruction set. The MCS-51 instruction set is opti-
The Upper 128 bytes of RAM are not implemented in mized for 8-bit control applications. It provides a vari-
the 8051, but are in the 8052AH, 83C51FA, and ety of fast addressing modes for accessing the internal
83C152. RAM to facilitate byte operations on smaIl data struc-
tures. The instruction set provides extensive support for
Figure 9 gives a brief look at the Special Function Reg- one-bit variables as a separate data type, allowing direct
ister (SFR) space. SFRs include the Port latches, tim- bit manipulation in control and logic systems that re-
ers, peripheral controls, etc. These registers can only be quire Boolean processing.
accessed by direct addressing. In general, all MCS-51
microcontrollers have the same SFRs as the 8051, and An overview of the MCS-51 instruction set is presented
at the same addresses in SFR space. However, enhance- below, with a brief description of how certain instruc-
ments to the, 8051 have additional SFRs that are not tions might be used. References to "the assembler" in
present in the 8051, nor perhaps in other proliferations this discussion are to Intel's MCS-51 Macro Assembler,
of the family. ASM51. More detailed information on the instruction
set can be found in the MCS-51 Macro Assembler Us-
er's Guide (Order No. 9800937 for ISIS Sysiems, Ordet
rrH ,, No. 122752 for DOS Systems).
REGISTER-MAPPED PORTS
EOH ACC
ADDRESSES THAT END IN Program Status Word
, OH OR 8H ARE ALSO
BIT-ADDRESSABLE '
The Program Status Word (pSW) ,contains several
BOH PORT 3
status bits that reflect the current state of the CPU. The
, -PORT PINS
-ACCUMULATOR PSW, shown in Figure 10, resides in SFR space. It con-
-PSW tains the Carry bit, the Auxiliary Carry (for BCD oper-
AOH PORT 2 '(ETC.)
ations), the two register bank select bits, the Overflow
90H PORT 1
flag, a Parity bit, and two user-defmable status flags.
I The Carry bit, other than serving the functions of a
SOH PORT 0
Carry bit in arithmetic operations, also serves as the
"Accumulator" for a number of Boolean operations.
270251-9
The bits RSO and RSI are used to select one of the four IMMEDIATE CONSTANTS
register banks shown in Figure 7. A number of instruc-
tions refer to these RAM locations as RO through R7. The value of a constant can follow the opcode in Pro-
The selection of which of the four banks is being re- gram Memory. For example,
ferred to is made on the basis of the bits RSO and RS 1
at execution time. MOV A, #100
The Parity bit reflects the number of Is in the Accumu- loads the Accumulator with the decimal number 100.
lator: P = 1 if the Accumulator contains an odd num- The same number could be specified in hex digits as
ber of Is, and P = 0 if the Accumulator contains an 64H.
even number of Is. Thus the number of Is in the Accu-
mulator plus P is always even.
INDEXED ADDRESSING
Two bits in the PSW are uncommitted and may be used Only Program Memory can be accessed with indexed
as general purpose status flags. addressing, and it can only be read. This addressing
mode is intended for reading look-up tables in Program
Memory. A 16-bit base register (either DPTR or the
Addressing Modes Program Counter) points to the base of the table, an.d
The addressing modes in the MCS-51 instruction set the Accumulator is set up with the table entry number.
are as follows: The address of the table entry in Program Memory is
formed by adding the Accumulator data to the base
pointer.
DIRECT ADDRESSING
Another type of indexed addressing is used in the "case
In direct addressing the operand is specified by an 8-bit jump" instruction. In this case the destination address
address field in the instruction. Only internal Data of a jump instruction is computed as the sum of the
RAM and SFRs can be directly addressed. base pointer and the Accumulator data.
INDIRECT ADDRESSING
Arithmetic Instructions
In indirect addressing the instruction specifies a register
which contains the address of the operand. Both inter- The menu of arithmetic instructions is listed in Table 2.
nal and external RAM can be indirectly addressed. The table indicates the addressing modes that can be
used with each instruction to access the <byte> oper-
The address register for 8-bit addresses can be RO or and. For example, the ADD A, <byte> instruction can
RI of the selected register bank, or the Stack Pointer. be written as:
The address register for 16-bit addresses can only be the
16-bit "data pointer" register, DPTR. ADD A,7FH (direct addressing)
ADD A,@RO (indirect addressing)
ADD A,R7 (register addressing)
REGISTER INSTRUCTIONS ADD A,#127 (immediate constant)
The register banks, containing registers RO through R7, The execution times listed in Table 2 assume a 12 MHz
can be accessed by certain instructions which carry a clock frequency. All of the arithmetic instructions exe-
3-bit register specification within the opcode of the in- cute in 1 ,""S except the INC DPTR instruction, which
struction. Instructions that access the registers this way takes 2 '""~, and the Multiply and Divide instructions,
are code efficient, since this mode eliminates an address which take 4 ,""s.
byte. When the instruction is executed, one of the eight
registers in the selected bank is accessed. One of four Note that any byte in the internal Data Memory space
banks is selected at execution time by the two bank can be incremented or decremented without going
seleCt bits in the PSW. through the Accumulator.
5-7
intJ MCS®-51 ARCHITECTURAL OVERVIEW
The DIV AB instruction divides the Accumulator by completes the shift in 4 /Ls and leaves the B register
the data in the B register and leaves the 8-bit quotient holding the bits that were shifted out.
in the Accumulator, and the 8-bit remainder in the B
register. The DA A instruction is for BCD arithmetic opera-
tions. In BCD arithmetic, ADD and ADDC instruc-
Oddly enough, DIV AB finds less use in arithmetic tions should always be followed by a DA A operation,
"divide" routines than in radix conversions and pro-· to ensure that the result is also in BCD. Note that DA
grammable shift operations. An example of the use of A will not convert a binary number to BCD. The DA
DIV AB in a radix conversion will be given later. In A operation produces a meaningful result only as the
shift operations, dividing a number by 2n shifts its n second step in the addition of two BCD bytes.
bits to the right. Using DIV AB to perform the division
Table 3. A List of the MCS®-51 Logical Instructions
Addressing Modes Execution
Mnemonic Operation
Oir Ind Reg Imm Time (/Ls)
ANL A,<byte> A = A .AND. <byte> X X X X 1
ANL <byte> ,A <byte> = <byte> .AND. A X 1
ANL <byte>,#data <byte> = <byte> .AND. #data X 2
A _ A '"'0 .......... .+ ...........
ORL A, <byle> 1"\ - n .vn ........ uy ..' C ' X X X X 1
ORL <byte> ,A <byte> = <byte> .OR. A )( 1
ORL <byte> ,#data <byte> = <byte> .OR. #data X 2
XRL A,<byte> A = A .XOR. <byte> X X X X .1
XRL <byte> ,A <byte> = <byte>.XOR.A X 1
XRL < byte> , # data <byte> = <byte> .XOR. #data X 2
CRL A A = OOH Accumulator only 1
CPL A A = .NOT.A Accumulator only 1
RL A Rotate ACC Left 1 bit Accumulatoronly 1
RLC A Rotate Left through Carry Accumulator only 1
RR A Rotate ACC Right 1 bit Accumulator only· 1
RRC A Rotate Right through Carry Accumulator only 1 ..
5-8
inter MCS®-51 ARCHITECTURAL OVERVIEW
5-9
inter MCS®-51 ARCHITECTURAL OVERVIEW
but the stack itself is accessed by indirect addressing After the routine has been executed, the Accumulator
using the SP register. This means the stack can go into contains the two digits that were shifted out on the
the Upper 128, if they are implemented, but not into right. Doing the routine with direct MOYs uses 14 code
SI:R space. bytes and 9 ,""S of execution time (assuming a 12 MHz
clock). The same operation with XCHs uses less code
The Upper 128 are not implemented in the 8051, and executes almost twice as fast.
8051AH, or 8OC51BH, nor in their ROMless or
EPROM counterparts. With these devices, if the SP To right-shift by an odd number of digits, a one-digit
points to the Upper 128, PUSHed bytes are lost, and shift must be executed. Figure 12 shows a sample of
POPped bytes are indeterminate. code that will right-shift a BCD number one digit, us-
ing the XCHD instruction. Again, the contents of the
The Data Transfer instructions include a 16-bit MOY registers holding the number and of the Accumulator
that can be used to initialize the Data Pointer (DPTR) are shown alongside each instruction.
for look-up tables in Program Memory, or for 16-bit
external Data Memory accesses.
5-10
MCS®-51 ARCHITECTURAL OVERVIEW
LOOKUP TABLES
Boolean Instructions
Table 6 shows the two instructions that are available
for reading lookup tables in Program Memory. Since MCS-51 devices contain a complete Boolean (single-bit)
thesC1 instructions access only Program Memory, the processor. The internal RAM contains 128 addressable
lookup tables can only be read, not updated. The mne- bits, and the SFR space can support up to 128 other
monic is MOVC for "move constant". addressable bits. AIl of the port lines are bit-address-
able, and each one can be, treated as a separate single-
'If the table access is to external Program Memory, then bit port. The instructions that access these bits are not
the read strobe is PSEN. just conditional branches, but a complete menu of
move, set, clear, complement, OR, and AND instruc-
tions. These kinds of bit operations are not easily ob-
tained in other architectures with any amount of byte-
oriented software.
5-11
MCS®-51 ARCHITECTURAL OVERVIEW
Table 7. A List of the MCS®-S1 Note that the Boolean instruction set includes ANL
Boolean Instructions and ORL operations, but not the XRL (Exclusive OR)
operation. An XRL operation is simple to implement in
Execution software. Suppose, for example, it is required to form
Mnemonic Operation
Time (,....s) the Exclusive OR of two bits:
ANL C,bit C = C .AND. bit 2
C = bit! .xRL. bit2
ANL C,/bit C = C .AND .. NOT. bit 2
ORL C,bit C = C.OR. bit 2 The software to do that could be as follows: -
ORL C,/bit C = C .OR. .NOT. bit 2
MOV C,bitl
MOV C,bit C = bit '1 JNB bit2,OVER
MOV bit,C bit = C 2 CPL C
OVER: (continue)
CLR C C=O 1
CLR bit bit = 0 1 First, bit! is moved to the Carry. If bit2 = 0, then _C
SETS C C=1 1 now contains the correct result. That is, bit! .xRL. bit2
= bit! if bit2 = O. On the other hand, if bit2 = 1 C
SETS bit bit = 1 1 now contains the complement of the correct result. I(
CPL C C = .NOT.C 1 need only be inverted (CPL C) to complete the opera-
tion;
CPL bit bit = .NOT. bit 1
JC rei JumpifC =1 2 This code uses the JNB instruction, one of -a series of
JNC rei JumpifC = 0 2 bit-test instructions which execute a jump if the ad-
dressed bit is set (JC, JB, JBC) or if the addressed bit is
JB bit,rel Jump if bit =1 2 not set (JNC, JNB). In the above case, bit2 is being
JNS bit, rei Jump if bit =0 2 tested, and if bit2 = 0 the CPL C instruction is jumped
JSC bit,rel Jump if bit = 1; CLR bit 2 over.
5-12
intJ MCS®-51 ARCHITECTURAL OVERVIEW
5-13
inter MCS®-S1 ARCHITECTURAL OVERVIEW
.....-t---jXTAL2
The DJNZ instruction (Decrement and Jump if Not
Zero) is for loop control. To execute a loop N times, QUA~~ ~~~~~ ' ....
RESONATOR
load a counter byte with N and terminate the loop with '--~-+-I XTAL 1
a DJNZ to the beginning, of the loop, as shown below
VSS
for N = 10:
-= '-----...,J
270251-11
MOY COUNTER,# 10
LOOP: (begin loop) Figure 13. Using the On-Chip OSCillator
•
Ill>
(end loop) IICS -51
HIIOS
DJNZ COUNTER,LOOP OR CHIIOS
(continue) XTAL2
Two bytes are speCified in the operand field of the in- VSS
struction. The jump is 'executed only if the two bytes
are not equal. In the example of Figure 12, the two 270251-12
bytes were the data in RI and the constant 2AH. The A. HMOS or CHMOS
initial data in RI was 2EH. Every time the loop was
executed, RI was decremented, and the looping was to
~
IICS":.'51
continue until the RI data reached 2AH. ' HIIOS
EXTERNAL ONLY
, CLOCK XTAL2
Another application of this instruction is in "greater SIGNAL,
than, less than" comparisons. The two bytes in the op-
erand fieid are iaken as unsigned iniegers. If the first is
less than the second, then the Carry bit is se~ (I). If the
frrst is greater than or equal to the second, then the
Carry bit is cleared. 270251-13
B.HMOSOnly
,270251-14
C. CHMOS Only
OSC.
I Sl 1 S21 S3 I I
~~~~~~~~~~~~~~~~~~~~~~~~~~
54 S5 1 56 1 Sl I I S2 53 1 54 I I
55 S6 1 Sl 1
(XTAL2)
ALE
READ OPCODE.
READ NEXT
OPCODE (DISCARD),
READOPCODE
(MOYX). . NO
READ NEXT OPCODE AGAIN. D
I
NO FETCH, I
l I ____ _
______ L-~_~_~_~~~~ _ _'__ _'___~~--~--~------
DATA
(D) MOYX (l-byle, 2-cycle)
5-15
intJ MCS®·51 ARCHITECTURAL OVERVIEW
states and phases for various kinds of instructions. Nor- The fetch/execute sequences are the same whether the
mally two program fetches are generated during each Program Memory is internal or external ,to the chip.
machine cycle, even if the instruction being executed Execution· times do not depend on whether the Pro-
doesn't require it. If the instruction being executed gram Memory is internal or external.
doesn't need more code bytes, the CPU simply ignores
the extra fetch, and the Program Counter is not incre- Figure 16 shows the signals an~ timing involved in pro-
mented. gram fetches when the Program Memory is external. If
Program Memory is external, then the Program Memo-
Execution of a one-cycle instruction (Figure l5A and ry read strobe PSEN is normally activated twice per
B) begins during State 1 ofthe machine cycle, when the machine cycle, as shown in Figure 16(A).
opcode is latched into the Instruction Register. A sec-
ond fetch occurs during S4 of the same machine cycle. If an access to external Data Memory occurs, as shown
Execution is complete at the end of State 6 of this ma- in. Figure 16(B), two PSENs are skipped, because the
chine cycle. address and data bus are being used for the Data Mem-
ory access.
The MOVX instructions take two machine cycles to
execute. No program fetch is generated during the sec- Note that a Data Memory bus cycle takes twice as
ond cycle of a MOVX instruction. This is the only time much time as a Program Memory bus cycle. Figure 16
program fetches are skipped. The fetch/execute se- shows the relative timing of the addresses being emitted
quence for MOVX instructions is shown in Figure at Ports'O and 2, and of ALE and PSEN. ALE is used
15(D). to latch the low address byte from PO into the address
latch.
ALE
PsEN
(A)
AD -------+----------~---------4----------~----~----~--- WITHOUT A
MOVX.
PCHOUT X PCHOUT
X PCHOUT
X PCHOUT
PO
, I
I
I I
I
tPCLOUT bCLouT lpCLOUT lpCLOUT
VALID VALID VALID VALID
1~lulas ~1~1~1~lulasl~1
ALE
PSEN
AD -------+-----------l-----, (8)
WITH A
MOVX.
270251-16
Figure 16. Bus Cycles In MCS@·51 Devices Executing from External Pr~gram Memory
5-16
inter MCS®-S1 ARCHITECTURAL OVERVIEW
When the CPU is executing from internal Program named IE (Interrupt Enable). This register also con-
Memory, PSEN is not activated, and program address- tains a global disable bit, which can be cleared to dis-
es are not emitted. However, ALE continues to be acti- able all interrupts at once. Figure 17 shows the IE reg-
vated twice per machine cycle and so is available as a ister for the 8052AH.
clock output signal. Note, however, that one ALE is
skipped during the execution of the MOVX instruction.
INTERRUPT PRIORITIES
INTERRUPT ENABLES Figure 19 shows, for the 8052AH, how the IE and IP
registers and the polling sequence work to determine
Each of the interrupt sources can be individually en- which if any interrupt will be serviced.
abled or disabled by setting or clearing a bit in the SFR
(MSB) (LSB)
(MSB) (LSB)
IEA I-I ET2 I ES I ETI I EXI I ETO I EXO I I-I -I PT2 I PS I PTt I PXl I PTO I PXO I
Symbol Position Function
Symbol Position Function
IP.7 reserved
EA IE.7 disables all interrupts. If EA = O. no
IP.6 reserved
interrupt will be acknowledged. If EA
PT2 IP.5 defines the Timer 2 interrupt priority
= 1. each interrupt source is
level. PT2 = 1 programs it to the
individually enabled or disabled by
higher priority level.
setting or clearing its enable bit.
PS IP.4 defines the Serial Port interrupt
IE.6' reserved
priority level. PS = 1 programs it to
ET2 IE5 enables or disables the Timer 2
the higher priority level.
overflow or capture interrupt. If ET2
PTt IP.3 defines the Timer 1 interrupt priority
= O. the Timer 2 interrupt is disabled.
level. PTI = 1 programs it to the
ES lEA enables m disables the Serial Port
higher priority level.
interrupt. If ES = 0, the Serial Port
PXl IP.2 defines the Exlernai Interrupt 1
interrupt is disabled.
priority level. pxi = t programs it to
ETI IE.3 enables or disables the Timer 1
the higher priority level.
Overflow interrupt. If ETI = O. the
, PTO IP.l defines the Timer 0 interrupt priority
Timer 1 interrupt is disabled.
level. PTO = 1 programs it to the
EXI IE.2 enables or disables External Interrupt
higher priority level.
1. If EXI = 0, Exlernal Interrupt t is
PXO IP.O defines the Exlernal Interrupt 0
disabled.
priority level. PXO = 1 programs it to
ETO lEI enables or disables the Timer 0
the higher priority level.
Overflow interrupt If ETO = O. the
Timer 0 interrupt is disabled.
Figure 18. IP(lnterrupt Priority)
EXO lEO enables or disables Exlernal Interrupt
O. If EXO = 0, Exlernal Interrupt 0 is Register in the 8052AH
disabled.
5-17
inter MCS@·51 ARCHITECTURAL OVERVIEW
HIGH PRIORITY
IP REGISTER INTERRUPT
I
I
I
I
O-o%c>t--r~-I--++I
I
I
I
I
~>t--r~-l--W
RI
TI ").---"*-0'
Tf2
EXf2 (8052 ONLY)
In operation, all the interrupt flags are latched into the pleted in less time than it takes other architectures to
interrupt control system during State 5 of every ma- commence them.
chine cycle. Th~ samples are polled during ~he follo~
ing machine cycle. If the flag for an enabled mterrupt IS
found to be set (I), the interrupt system generates an SIMULATING A THIRD PRIORITY LEVEL IN
LCALL to the appropriate location in Program Memo- SOFTWARE
ry, unless some other condition blocks the interrupt. Some appli~ations require more than the two priority
Several conditions can block an interrupt, among them levels that are provided by on-chip hardware in
that an interrupt of equal or higher priority level is MCS-SI devices. In these cases, relatively simple soft-:
already in progress. I
ware can be written to produce the same effect as a
third priority leveL
The hardware-generated LCALL causes the contents of
the Program Counter to be pushed onto the stack, a~d First, interrupts that are to have higher priority ~ha~ 1
reloads the PC with the beginning address of the service are assigned to priority 1 in the IP (Interrupt Pnonty)
routine. As previously noted (Figure 3), the service rou-. register. The service routines for priority 1 interrupts
tine for each interrupt begins at a fixed location. that are supposed" to be interruptible by "priority 2"
interrupts are written to include the following code:
Only the Program Counter is automatically pushed
onto the stack, not the PSW or any other register. Hav- PUSH IE
ingonly the PC be automatically saved allows the p~o MOV IE,#MASK
grammer to deCide how much time to spend savmg CALL . LABEL
which other registers. This enhances the interrupt re- ._ •••• *
sponse time, albeit at the expense of increasing the pro- (execute service routine)
grammer's burden of responsibility. As a result, many •••••••
interrupt functions that are typical in control applica- POP IE
tions--':'toggling a port pin, for example, or reloading a RET
timer, or unloading a serial buffer--can often be com- LABEL: RET!
5-18
MCS®-51 ARCHITECTURAL OVERVIEW
As soon as any priority 1 interrupt is acknowledged, POPping IE restores the original enable byte. Then a
the IE (Interrupt Enable) register is re-defined so as to normal RET (rather than another RET!) is used to
disable all but "priority 2" interrupts. Then, a CALL to terminate the service routine. The additional software
LABEL executes the RETI instruction, which clears adds 10 ,...S ~at 12 MHz) to priority 1 interrupts.
the priority 1 interrupt-in-progress flip-flop. At this
point any priority 1 interrupt that is enabled can be
serviced, but only "priority 2" interrupts are enabled.
5-19
Hardware Description of the 6
8051,8052 and 80e51
intJ HARDWARE DESCRIPTION
OF THE 8051, 8052 AND 80C51
INTRODUCTION • The EPROM versions of the 80SIAH, 80S2AH,
and 80CSIBH
This chapter presents a comprehensive description of
the on-chip hardware features of the MCS®-SI micro- The devices under consideration are listed in Table 1.
controllers. Included in this description are As it becomes unwieldy to be constantly referring to
"each of these devices by their individual names, we will
• The port drivers and how they function both as
adopt a convention of referring to them generically as
ports and, for Ports 0 and 2, in bus operations
80S Is and 80S2s, unless a specific member of the group
• The Timer/Counters is being referred to, in which case it will be specifically
• The Serial Interface named. The "80S Is" include the 8051, 8051AH, and"
80CSlBH, and their ROMless and EPROM versions.
• The Interrupt System
The "80S2s" are the 80S2AH, 8032AH, and 87S2BH.
• Reset
• The Reduced Power Modes in the CHMOS devices Figure I shows a functional block diagram of the 80SIs
and 8052s.
Table 1. The MCS-51 Family of Microcontrollers
Device ROM less EPROM ROM RAM 16-bit Ckt
Name Version Version Bytes Bytes Timers Type
8051 8031 " (8751) 4K 128 2 HMOS
8051AH 8031AH 8751H 4K 128 2 HMOS
8052AH 8032AH 8752BH 8K 256 3 HMOS
80C51BH 80C31BH 87C51 4K 128 2 CHMOS
~
,--------
r
....
..
AU;
·R ....... lnIQUJID32on1'.
270252-1
6-1
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
8 Bytes
F8 FF
FO B F7
E8 EF
EO ACC E7
08 OF
DO PSW 07
C8 (T2CON) (RCAP2L) (RCAP2H) (TL2) (TH2) CF
co C7
B8 IP BF
BO P3 B7
A8 IE AF
AO P2 .. A7
98 SCON SBUF 9F
90 P1 97
88 TCON TMOO TLO Tl1 THO TH1 8F
80 PO SP OPL OPH PCON 87
Figure 2. SFR Map. ( ... ) Indicates Resident in 8052s, not in 8051s
Note that not all of the addresses are occupied. Unoc- to hold a 16-bit address. It may be manipulated as a
cupied addresses are not implemented on the chip. 16-bit register or as two independent 8-bit registers.
Read accesses to these addresses will in general return
random data, and write accesses will have no effect. PORTS 0 T03
User software should not write Is to these unimple- PO, PI, P2 and P3 are the SFR latches of Ports 0, I, 2
mented locations, since they may be used in future and 3, respectively.
MCS-51 products to invoke new features. In that case
the reset or inactive values of the new bits will always SERIAL DATA BUFFER
be 0, and their active values will be 1.
The Serial Data Buffer is actually two separate regis-
The functions of the SFRs are outlined below. ters, a transmit buffer and a receive· buffer register.
When data is moved to SBUF, it goes to the transmit
ACCUMULATOR buffer where it is held for serial transmission. (Moving
ACC is the Accumulator register. The mnemonics for . a byte to SBUF is what initiates the transmission.)
Accumulator-Specific instructions, however, refer to When data is moved from SBUF, it comes from the
the Accumulator simply as A. receive buffer.
6-2
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
(MSB) (LSB)
CY AC FO RSI RSO OV P
Symbol Position Name and Significance Symbol Position Name and Significance
CY PSW.7 Carryllag. OV PSW.2 Overflow flag.
AC PSW.6 Auxiliary Carry flag. PSW.I User definable lIag.
(For BCD operations.) P PSW.O Parity flag.
FO PSW.5 Flag 0 Sell cleared by hardware each
(Available to the user for general instruction cycle to indicate an odd/
purposes.) even number of "one" bits in the
RSI PSW.4 Register bank select control bits I & Accumulator, i.e., even parity.
RSO PSW.3 O. Sellcleared by software to NOTE:
determine working register bank (see The contents of (RSI, RSO) enable the working register banks as
follows:
Note).
(O.O)-Bank 0 (00H-07H)
(0.1 )-Bank I (OBH-OFH)
(I.O)-Bank 2 (IOH-17H)
(I. I)-Bank 3 (IBH-IFH)
ADDR/DATA READ
VCC .LATCH
CONTROL
INT. BUS
INT. BUS WRITE
TO
WRITE LATCH
TO
LATCH
READ
PIN
ALTERNATE
INPUT
FUNCTION
270252-4
270252-5
C. Port 2 Bit
D. Port 3 Bit
Figure 4. 8051 Port Bit Latches and 1/0 Buffers
'See Figure 5 for details of the internal pullup.
6·3
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
Port Pin Alternate Function ADDR/DATA BUS). To be used as an input, the port
·Pl.0 T2 (Timer/Counter 2 bit latch must contain a I, which tums off the output
external input) driver PET. Then, for Ports I, 2, and 3, the pin is
·P1.l T2EX (Timer/Counter 2 pulled high by the internal pullup, but can be pulled
low by an external source.
Capture/Reload trigger)
P3.0 RXD (serial input port) Port 0 differs in not having internal pull ups. The pullup
P3.l TXD (serial output port) FET in the PO output driver (see Figure 4) is used only
P3.2 INTO (external interrupt) when the Port is emitting Is during external memory
P3.3 INT1 (external interrupt) accesses. Otherwise the pullup PET is off. Consequent-
P3.4 TO (Timer/Counter 0 external ly PO lines that are being used as output port lines are
input) open drain. Writing a 1 to the bit latch leaves both
P3.5 Tl (Timer/Counter 1 external output PETs off, so the pin floats. In that condition it
input) can be used a high-impedance input.
P3.6 WR (external Data Memory
Because Ports 1, 2, and 3 have fixed internal pullups
write strobe) they are sometimes called "quasi-bidirectional" ports.
P3.7 RD (external Data Memory When configured as inputs they pull high and will
read strobe) source current (ilL, in the data sheets) when externally
pulled low. Port 0, on the other hand, is considered
·Pl.O and P1.l serve these alternate functions only on "true" bidirectional, because when configured as an in-
the 8052. put it floats.
The alternate functions can only be activated if the cor- All the port latches in the 8051 have Is written to them
responding bit ,latch in the port SFR,contains a 1. Oth- by the reset function. If a 0 is subsequently written to a
erwise the porl pin is stuck at O. port latch, it can be reconfigured as an input by writing
altoit.
1/0 Configurations
Writing to a Port
Figure 4 shows a functional diagram of a typical bit
latch and I/O buffer in each of the four ports. The bit In the execution of an instruction that changes the val-
latch (one bit in the port's SFR) is represented as a ue in a port latch, the new value arrives at the latch
Type D flip-flop, which will clock in a value from the during S6P2 of the final cycle of the instruction. How-
internal bus in response to a "write to latch" signal ever, port latches are in fact sampled by their output
from the CPU. The Q output of the flip-flop is placed buffers only during Phase 1 of any clock period. (Dur-
on the internal bus in response to a "read latch" signal ing Phase 2 the output buffer holds the value it saw
from the CPU. The level of the port pin itself is placed during the previous Phase 1). Consequently, the new
on the internal bus in response to a "read pin" signal value in the port latch won't actually appear at the
from the CPU. Some instructions that read a port acti- output pin until the next Phase I, which will be at SIPI
vate the "read latch"signal, and others activate the of the next machine cycle.
"read pin" signal. More about that later.
If the change requires a O-to-l transition in Port I, 2, or
As shown in Figure 4, the output drivers of Ports 0 and 3, an additional puiiup is turned on during SiPi and
2 are switchable to an internal ADDR and ADDR/ SIP2 of the cycle in which the transition occurs. This is
DATA bus by an internal CONTROL signal for use in done to increase the transition speed. The extra pullup
external memory accesses. During external memory ac- can source about 100 times the current that the normal
cesses, the P2 SFR remains unchanged, but the PO SFR pullup can. It should be noted thaf the internal pull ups
gets Is written to it: are field-effect transistors, not linear resistors. The pull-
up arrangements are shown in Figure 5.
Also shown in Figure 4, is that if a P3 bit latch contains
a I, then the output level is controlled by the signal In HMOS versions of the 8051, the fixed part of the
labeled "alternate output function." The actual P3.x pullup is a depletion-mode transistor with the gate
pin level is always available to the pin's alternate input wired to the source. This transistor will allow the pin to
function, if any. source about 0.25 mA when shorted to ground. In
parallel with the fixed pullup is an enhancement-mode
Ports 1,2, and 3 have internal pullups. Port 0 has open transistor, which is activated during SI whenever the
drain outputs. Each I/O line can be independently used port bit does a O-to-I transition. During this interval, if
as an' input or an output. (Ports 0 and 2 may not be the port pin is shorted to ground, this extra transistor
used as general purpose I/O when being used as the will allow the pin to source an additional 30 mAo
6-4
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
VCC
aD ~
270252-6
A. HMOS Configuration. The enhancement mode transistor
is turned on for 2 osc. periods after Q makes a 1-to-0 transition.
Vcc Vcc Vcc
a
FROM PORT
LATCH
READ
PORT PIN
270252-7
B. CHMOS Configuration. pFET 1 is turned on for 2 osc. periods after Q
makes a 1-to-0 transition. During this time, pFET 1 also turns on pFET 3
through the inverter to form a latch which holds the 1. pFET 2 is also on.
Figure 5. Ports 1 And 3 HMOS And CHMOS Internal Pullup Configurations.
Port 2 is Similar Except That It Holds The Strong Pull up On While Emitting
1s That Are Address Bits. (See Text, "Accessing External Memory".)
In the CHMOS versions, the pullup consists of three Port Loading and Interfacing
pFETs. It should be noted that an n-channel FET
(nFEl) is turned on when a logical 1 is applied to its The output buffers of Ports 1,2, and 3 can each drive 4
gate, and is turned off when a logical 0 is applied to its LS TIL inputs. These ports on HMOS versions can be
gate. A p-channel FET (PFET) is the opposite: it is on driven in a normal manner by any TIL or NMOS cir-
when its gate sees a 0, and off when its gate sees a 1. cuit. Both HMOS and CHMOS pins can be driven by
open-collector and open-drain outputs, but note that 0-
pFETl in Figure 5 is the transistor that is turned on for to-1 transitions will not be fast. In the HMOS device, if
2 oscillator periods after a 0-to-1 transition in the port the pin is driven by an open-collector output, a 0-tO-1
latch. While it's on, it turns on pFET3 (a weak pull- transition will have to be driven by the relatively weak
up), through the inverter. This inverter and pFET form depletion mode FET in Figure 5(A). In the CHMOS
a latch which hold the 1. device, an input 0 turns off pullup pFET3, leaving only
the very weak pullup pFET2 to drive the transition.
Note that ifthe pin is emitting a 1, a negative glitch on
the pin from some external source can turn off pFET3, Port 0 output buffers can each drive 8 LS TIL inputs.
causing the pin to go into a float state. pFET2 is a very They do, however, require external pullups to drive
weak pullup which is on whenever the nFET is off, in NMOS inputs, except when being used as the
traditional CMOS style. It's only about Y,0 the strength ADDRESS/DATA bus.
of pFET3. Its function is to restore a 1 to the pin in the
event the pin had a 1 and lost it to a glitch.
6-5
HARDWARE DESCRIPTION OFTHE 8051, 8052 AND 80C51
Read-Modify-Write Feature Whenever a 1'6-bit address is used, the high byte of the
address comes out on Port 2, where it is held for the
Some instructions that read a port read the latch and duration of the read or write cycle. Note that the Port 2
others read the pin. Which ones do which? The instruc- drivers use the strong pullups during the entire time
tions that read the latch rather than the pin are the ones that they are emitting address bits that are Is. This is
that read a value, possibly change it, and then rewrite it during the execution of a MOVX @DPTR instruction.
to the latch. These are called "read-modify-write" in- During this time the Port 2 latch (the Special Function'
structions. The instructions listed below are read-mod- Register) does not have to contain Is, and the contents
ify-write instructions. When the destination operand is of the Port 2 SFR are not modified. If the external
a port, or a port bit, these instructions read the latch memory cycle is not immediately followed by another
rather than the pin: external memory cycle, the undisturbed contents of the
ANL (logical AND, e.g., ANL.PI, A) Port ~ SFR will reappear in the next cycle.
ORL (logical OR, e.g., ORL P2, A) If an 8-bit address is being used (MOVX @Ri), the
XRL (logical EX-OR, e.g., XRL P3, A) contents of the Port 2 SFR remain at the Port 2 pins
throughout the external memory cycle. This will facili-
JBC (jump if bit = I and clear bit, e.g., tate paging.
JBC Pl.l, LABEL)
CPL (complement bit, e.g., CPL P3.0) In any case, the low byte of the address is time-multi-
plexed with the data byte on Port O. The ADDR/
INC (increment, e.g., INC P2) DATA signal drives both FETs in the Port 0 output
DEC (decrement, e.g., DEC P2) buffers. Thus, in this application the Port 0 pins are not
DJNZ (decrement and jump if not zero, e.g., open-drain outputs, and do' not require external pull-
DJNZ P3, LABEL) ups. Signal ALE (Address Latch Enable) should be
used to capture the address byte into an extemallatch.
MOV, PX.Y, C (move carry bit to bit-Y of Port X) The address byte is valid at the negative transition of
CLR PX. Y (clear bit Y of Port X) ALE. Then, in a write cycle, the data byte to be written
SETB PX. Y (set bit Y of Port X) appears on Port 0 just before WR is ·activated, and re-
mains there until after WR is deactivated. In a read
It is not obvious that the last three instructions in this
cycle, the incoming byte is accepted at Port 0 just be-
list are read-modify-write instructions, but they are. fore the read strobe is deactivated.
They read the port byte, all 8 bits, modify the addressed During any access to external memory, the CPU writes
bit, then write the new byte back to the latch. OFFH to the Port 0 latch (the Special Function Regis-
ter), thus obliterating whatever information the Port 0
The reason that read-modify-write instructions are di- SFR may have been holding.
rected to the latch rather than the pin is to avoid a
possible misinterpretation of the voltage level at the External Program Memory is accessed under two con-
pin. For example, a port bit might be used to drive the ditions:
base of a transistor. When a 1 is written to the bit, the • 1) Whenever signal EA is· active; or
transistor is turned on. If the CPU then reads the same
port bit at the pin rather than the latch, it will read the 2) Whenever the program counter (PC) contains a
base voltage of the transistor and interpret it as a O. number that is larger than OFFFH (IFFFH for the
Reading the latch rather than the pin will return the 8052).
correct value of 1. ' . This requires that the ROMless versions have EA wired
low to enable the lower 4K (8K for the 8032) program
bytes to be fetched from external memory.
ACCESSING EXTERNAL MEMORY
When the CPU is executing out of external Program
Accesses to external memory are of two types: accesses Memory, all 8 bits of Port 2 are dedicated to an output
to external Program Memory and accesses to external function and may not be used for general purpose I/O.
Data Memory. Accesses to external Program Memory During external program fetches they output the high
use signal PSEN (program store enable) as the read byte of the PC. During this time the Port 2 drivers use
strobe. AccesseS to external Data Memory use RD or the strong pullups to emit PC bits that are Is.
WR (alternate functions of P3.7 and P3.6) to strobe the
memory..
TIMER/COUNTERS
Fetches from external Program Memory always use a The 8051 has two 16-bit Timer/Counter registers: Tim-
16-bit address. Accesses to external Data Memory can er 0 and Timer 1. The 8052 has these two plus one
use either a 16-bit address (MOVX @DPTR) or an mOt;"e: Timer 2. All three can be configured to operate
8-bit address (MOVX @Ri). either as timers or event counters.
6-6
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
In addition to the "Timer" or "Counter" selection, Mode 0 operation is the same for Timer 0 as for Timer
Timer 0 and Timer I have four operating modes from 1. Substitute TRO, TFO and INTO for the correspond-
which to select. Timer 2, in the 8052, has three modes ing Timer I signals in Figure 7. There are two different
of operation: "Capture," "Auto-Reload" and "baud GATE bits, one for Timer I (TMOD.7) and one for
rate generator." Timer 0 (TMOD.3).
These Timer/Counters are present in both the 8051 and Mode I is the same as Mode 0, except that the Timer
the 8052. The "Timer" or "Counter" function is select- register is being run with all 16 bits.
ed by control bits ciT in the Special Function Register
TMOD (Figure 6). These two Timer/Counters have MODE 2
four operating modes, which are selected by bit-pairs
(MI, MO) in TMOD. Modes 0, I, and 2 are the same Mode 2 configures the Timer register as an 8-bit Coun-
for both Timer/Counters. Mode 3 is different. The four ter (TLJ) with automatic reload, as shown in Figure 9.
operating modes are described in the following text. Overflow from TLI not only sets TFI, but also reloads
(MSB) (LSB)
6-7
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
cif= 0
INTERRUPT
GATE
270252-9
(MSB) (LSB)
TFI TRI TFO TRO lEI ITt lEO ITO
TLl with the contents ofTHI, which is preset by soft- CIT, GATE, TRO, INTO, and TFO. THO is locked into
ware. The reload leaves THI unchanged. a timer function (counting machine cycles) and takes
over the use ofTRI and TFI from Timer 1. Thus, THO
Mode 2 operation is the same for Timer/Copnter O. now controls the "Timer I" interrupt.
6-8
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
INTERRUPT
270252-10
1/12 lose - - - - - - - ,
INTERRUPT
TO PIN-----~
CONTROL
'TR1 -
270252-1,1
Timer 2
Table 2. Timer 2 Operating Modes
Timer 2 is a 16-bit Timer/Counter which is present
only in the 8052. Like Timers 0 and I, it can operate RCLK + TCLK CP/RL2 TR2 Mode
either as a timer or as an event counter. This is selected . 0 0 1 16-bit Auto~Reload
by bit C/T2 in the Special Function Register T2CON 1 16-bit Capture
0 1
(Figure 11). It has three operating modes: "capture,"
"auto-load" and, "baud rate generator," which are se- 1 X 1 Baud Rate Generator
lected by bits in T2CON as shown in Table 2. X X 0 (off)
6-9
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
(MSB) (LSB)
TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 cPlFi1:2
In the Capture Mode there are two options which are added feature that a 1-to-0 transition at external input
selected by bit EXEN2 in T2CON. If EXEN2 = 0, T2EX.will also trigger the 16"bit reload and set EXF2.
then Timer 2 is a 16-bit timer or counter which upon
overflowing sets bit TF2, the Timer 2 overflow bit, The auto-reload mode is illustrated in Figure 13.
which can be used to generate an interrupt. If EXEN2
= 1, then Timer 2 still does the above, but with the The baud rate generator mode is selected by RCLK =
added feature that a 1-to-O transition at external input 1 andlor TCLK = 1. It will be described in conjunc-
T2EX causes the current value in the Timer 2 registers, tion with the serial port.
TL2 and TH2, to be captured into registers RCAP2L
and RCAP2H, respectively. (RCAP2L and RCAP2H
are new Special Function Registers in the 8052.) In SERIAL INTERFACE
addition, the transition at T'2EX causes bit EXF2 in
T2CON to be set, and EXF2, like TF2, can generate an The serial port is full duplex, meaning it can transmit
interrupt. .and receive simultaneously. It is also receive-buffered,
meaning it can commence reception of a second byte
The Capture Mode is illustrated in Figure 12. before a previously received byte has been read from
the receive register. (However, if the first byte still
In the auto-reload mode there are again two options, hasn't been read by the time reception of the second
which are selected by bit EXEN2 in T2CON. If byte is complete, one of the bytes will be lost). The
EXEN2 = 0, then when Timer 2 rolls over it not only serial port receive and transmit registers are both ac-
sets TF2 but also causes the Timer 2 registers to be cessed at Special Function Register SBUF. Writing to
reloaded with the 16-bit value in registers RCAP2L SBUF loads the transmit register, and reading SBUF
and RCAP2H, which are preset by software. IfEXEN2 accesses a physically separate receive register.
= I, then Timer 2 still does the above, but with the
6-10
intJ HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
nMER2
INTERRUPT
EXEN2
270252-12
Figure 12. Timer 2 in Capture Mode
6-11
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
TIMER 2
INTERRUPT
EXEN2
270252-13
Figure 13. Timer 2 in Auto-Reload Mode
(MSB) (LSB)
SMO SMI I SM2 REN TB8 RB8 TI RI
Where SMO, SMI specify the serial port mode, as follows: • TB8 is the 9th data bit that will be
transmitted in Modes 2 and 3. Set or
SMO
0
0
SMI
0
0
Mode
0
1
2
Description
shift register
8·bitUART
9-bitUART
Baud Rate
fose/12
variable
. RB8
clear by software as desired.
In Modes 2 and 3, is the 9th data bit
that was received. In Mode I, if SM2
fose/64
= 0, RB8 is the stop bit that was
or
• SM2
3
fose/32
9-bit UART variable
enables the multiprocessor
. TI
received. In Mode 0, RBS is not used.
is transmit interrupt flag. Set by
hardware at the end of the Sth bit time
communication feature in Modes In Mode 0, or at the beginning of the
2 and 3. In Mode 2 or 3, if 8M2 Is stop bit in the other modes, in any
setto 1 then RI will no! be serial transmission. Must be cleared
activated if the received 9th data by software.
bit (RBS) is O. In Mode I, if 8M2
• RI is receive interrupt flag. Set by
= 1 then RI will not be activated
if a valid stop bit was not hardware at the end of the 8th bit time
received. In Mode 0, 8M2 should in Mode 0, or halfway through the stop
beO. bn time in the other modes, in any
• REN enables serial receotion. Set bv serial reception (except see 8M2).
software to enable reception. . Must be cleared by software.
Clear by software to disable
reception.
Baud Rates
The baud rate in Mode 0 is fixed: 2 SMOD
Mode 2 Baud Rate = 64X (Oscillator Frequency)
Oscillator Frequency
Mode 0 Baud Rate = ---'._---''---'-
12 In the 8051, the'baud rates in Modes 1 and 3 are deter-
mined by the Timer 1 overflow rate. In the 8052, these
The baud rate in Mode 2 depends on the value of bit baud rates can be determined by Timer 1, or by Timer
SMOD in Special Function Register peON. If SMOD 2, or by both (one for transmit and the other for re-
= 0 (which is the value on reset), the baud rate %4 the ceive).
oscillator frequency. If SMOD 1, the baud rate is
'1.2 the oscillato.r frequency.
6-12
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
Using Timer 1 to Generate Baud Rates mode (high nibble of TMOD = OOIOB). In that case,
the baud rate is given by the formula
When Timer 1 is used as the baud rate generator, the
baud rates in Modesl and 3 are determined by the Modes 1, 3 2SMOD Oscillator Frequency
Timer 1 overflow rate and the value of SMOD as fol~ Baud Rate = - - - X - - - - - - - - ' ' - - - - : = -
32 12x [256 - (THl)l
lows:
Modes 1,3 2SMOD One can achieve very low baud rates with Timer 1 by
Baud Rate = ----n-
X (Timer 1 Overflow Rate) leaving the Timer 1 interrupt enabled, and configuring
the Timer to run as a l6-bit timer (high nibble of
TMOD = OOOlB), and using the Timer 1 interrupt to
The Timer 1 interrupt should be disabled in this appli- do a 16-bit software reload.
cation. The Timer itself can be configured for either
"timer" or "counter" operation, and in any of its 3 Figure 15 lists various commonly used baud rates and
. running modes. In the most typical applications, it is how they can be obtained from Timer 1.
configured for "timer" operation, in the auto-reload
Timer 1
Baud Rate fosc SMOD Reload
clf Mode
Value
Mode 0 Max: 1 MHZ 12MHZ X X X X
Mode 2 Max: 375K 12MHZ 1 X X X
Modes 1, 3: 62.5K 12MHZ 1 0 2 FFH
19.2K 11.059 MHZ 1 a 2 FDH
9.6K 11.059 MHZ a a 2 FDH
4.8K 11.059 MHZ a a 2 FAH
2.4K 11.059 MHZ a a 2 F4H
1.2K 11.059 MHZ a a 2 E8H
137.5K 11.986 MHZ a a 2 1DH
110K 6MHZ a a 2 72H
110K 12MHZ a a 1 FEEBH
Figure 15. Timer 1 Generated Commonly Used Baud Rates
Using Timer 2 to Generate Baud Rates 11). Note then the' baud rates for transmit and receive
can be simultaneously different. Setting RCLK and/or
In the 8052, Timer 2 is selected as the baud rate genera- TCLK puts Timer 2 into its baud rate generator mode,
tor by setting TCLK and/or RCLK in T2CON (Figure as shown in Figure 16.
nMER 1
OVERFLOW
AX CLOCK
TXCLOCK
EX""
L NOTE AYAILAIIU.rTY OF ADDmoNAL EXTERNAL INTERRUPT
270252-14
The baud rate generator mode is similar to the auto-re- Transmission is initiated by any instruction that uses
load mode, in that a rollover in TH2 causes the Timer 2 SBUF as a destination register. The "write to SBUF"
registers to be reloaded with the 16-bit value in registers signal at S6P2 also loads a I into the 9th position ofthe
RCAP2H and RCAP2L, which are preset by software. transmit shift register and tells the TX Control block to
commence a transmission. The internal timing is such
Now, the baud rates in Modes I and 3 are determined that one full machine cycle will elapse between "write
by Timer 2's overflow rate as follows: to SBUF," and activation of SEND.
Timer 2 Overflow Rate SEND enables the output of the shift register to the
Modes I, 3 Baud Rate = 16" alternate output function line of P3.0, and also enables
SHIFT CLOCK to the alternate output function line of
The Timer can be configured for either "timer" or P3.1. SHIFT CLOCK is low during S3, S4, and S5 of
"counter" operation. In the most typical applications, it every machine cycle, and high during S6, SI and S2. At
is configUred for "timer" operation (C/T2 = 0). "Tim- S6P2 of every machine cycle in which SEND is active,
er" operation is a little different for Timer 2 when it's the contents of the transmit shift register are shifted to
'being used as a baud rate generator. Normally, as a the right one position.
timer it would increment every machine cycle (thus at As data bits shift out to the right, zeroes come in from
'112 the oscillator frequency). As a baud rate generator, the left. When the MSB of the data byte is at the output
however, it increments every state time (thus at '!. the position of the shift register, then the I that was initial-
oscillator frequency). In that case the baud rate is given ly loaded into the 9th position, is just to the left of the
by the formula MSB, and all positions to the left ofthat contain zeroes.
Modes I, 3 Oscillator Frequency This condition flags the TX Control block to do one
last shift and then deactivate SEND and set TI. Both of
Baud Rate = 32x [65536 - (RCAP2H, RCAP2L)1 these actions occur at SIPI of the 10th machine cycle
after "write to SBUF."
where (RCAP2H, RCAP2L) is the content of
RCAP2H and RCAP2J:, taken as a 16-bit unsigned in- Reception is initiated by the condition REN = I and
teger. Rl. = O. At S6P2 of the next machine cycle, the RX
Control unit writes the bits 11111110 to the receive
Timer 2 as a baud rate generator is shown in Figure 16. shift register, and in the next clock phase activates RE-
This Figure is valid only if RCLK + TCLK = I in CEIVE.
T2CON. Note that a rollover in TH2 does not setTF2,
and will not generate an interrupt. Therefore, the Timer RECEIVE enables SHIFT CLOCK to the alternate
2 interrupt does not have to be disabled when Timer 2 output function line of P3.1. SHIFT CLOCK makes
is in the baud rate generator mode. Note too" that if transitions at S3Pl and S6Pl of every machine cycle.
EXEN2 is set, a I-to-O transition in T2EX will set At S6P2 of every machine cycle in which RECEIVE is
EXF2 but will not cause a reload from (RCAP2H, active, the contents of the receive shift register are shift-
RCAP2L) to (TH2, TL2). Thus when Timer 2 is in use ed to the left one position. The value that comes in
as ,a baud rate generator, T2EX can be used as an extra from the right is the value that was sampled at the P3.0
external interrupt, if desired. pin at S5P2 of the same machine cycle. '
As data bits come in from the right, Is shift out to the
It should be noted that when Timer 2 is running (TRZ left. When the 0 that was initially loaded into the right-
= I) in "timer" function in the baud rate generator
most position arrives at the leftmost position in the shift
mode, one should not try to read or write TH2 or TL2. register, it flags the RX Control block to do one last
Under these conditions the Timer is being incremented shift and load SBUF. At SIP I of the 10th machine
every state time, and the results of a read or write may cycle after the write to SCON that cleared RI, RE-
not be accurate. The RCAP registers may be read, but CEIVE is cleared and'RI is set.
shouldn't be written to, because a write might overlap a
reload and cause write and/or reload errors. Tum the
Timer off (clear TR2) before accessing the Timer 2 or More About Mode '1
RCAP registers, in this case. Ten bits are transmitted (through TXD), or received
(through RXD): a start bit (0), 8 data bits (LSD first),
More About Mode 0 and a stop bit (1), On receive, the stop bit goes into
RB8 in SCON. In the 8051 the'baud rate is determined
Serial data enters and exits through RXD. TXD out- by the Timer 1 overflow rate. In the 8052 it is deter-
puts the shift clock. 8 bits are transmitted/received: 8 mined either by the Timer 1 overflow rate, or the Timer
data bits (LSB first). The baud rate is fixed at 1/12 the 2 overflow rate, or both (one for transmit and the other
oscillator frequency. for receive).
Figure 17 shows a simplified functional diagram of the Figure 18 shows a simplified functional diagram of the
serial port in Mode 0, and associated timing. serial port in Mode 1, and associated timings for trans-
mit receive.
6-14
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
WRITE
SBUF
TO ---'--=~~~r:--~~----1---------r-, RXD
P3.0ALT
OUTPUT
FUNCTION
56.-_.------1
TXD
P3.1 ALT
OUTPUT
FUNCTION
' - - - - - I RX CLOCK
RX CONTROL SHIFT
REN--...r--l--_ _.j START
Ri-"'~ L..._--i........,...-.-T""'!,......,-i---.J RXD
P3.0ALT
INPUT
FUNCTION
READ
SBUF
ALE
4WRITE TO SBUF
SEND 88P2' I
SHIFT
~RIi~~~==j=::::::::::::::::::::::::::::::::::::::::::::::::::::~r----
'!!'CEIVE L-
RECEIVE
SHIFT
RXD (DATA IN)---.....,[}':'~---{}.!'r.!----o=-----[i=----LJ='''-----[}''~--o=-----[F-
TIMER 1 TIM·ER2
OVERFLOW OVERFLOW
WRIT~E-r-:=jrot:m::;r~;""'~~_":-'"~_-r"""'\~;.....r-,
TO
SBUF
TXD
RECEIVE
..
! R";~LOC fiTART BITI
___________________________________________________
~R~I
oj D4 .. DI D)
STOP BIT
~r----
270252-16
Figure 18. Serial Port Mode 1. TCLK, RCLK and timer 2 are Present in the 8052/8032 Only.
Transmission is initiated by any instruction that uses times are synchronized to the divide-by-16 counter, not
SBUF as a destination register. The "write to SBUF" to the "write to SBUF" signal).
signal also loads a 1 into the 9th bit position of the
transmit shift register and flags the TX Control unit The tra:!lsinission begins with activation of SEND,
that a transmission is requested. Transmission actually which puts the start bit at TXD. One bit time later,
commences at SIPI of the machine cycle following the DATA is activated, which enables the output bit· of the
next rollover in the divide-by-16 counter. (Thus, the bit transmit shift register to TXD. The first shift pulse oc-
curs one bit time after that.
6-16
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
As data bits shift out to the right, zeroes are clocked in mit, the 9th data bit (TB8) can be assigned the value of
from the left. When the MSB of the data byte is at the o or 1. On receive, the 9th data bit goes into RB8 in
output position of the shift register, then the 1 that was SCON. The baud rate is programmable to either Yo. or
initially loaded into the 9th position is just to the left of '164 the oscillator frequency in Mode 2. Mode 3 may
the MSB, and all positions to the left of that contain have a variable baud rate generated from either Timer 1
zeroes. This condition flags the TX Control unit to do or 2 depending on the state of TCLK and RCLK.
one last shift and then deactivate SEND and set TI.
This occurs at the 10th divide-by-16 rollover after Figures 19 and 20 show a functional diagram of the
"write to SBUF." serial port in Modes 2 and 3. The receive portion is
exactly the same as in Mode I: The transmit portion
Reception is initiated by a detected I-to-O transition at differs from Mode 1 only in the 9th bit of the transmit
RXD. For this purpose RXD is sampled at a rate of 16 shift register.
times whatever baud rate has been established. When a
transition is detected, the divide-by-16 counter is imme- Transmission is initiated by any instruction that uses
diately reset, and IFFH is written into the input shift SBUF as a destination register. The "write to SBUF"
register. Resetting the divide-by-16 counter aligns its signal also loads TB8 into the 9th pit position of the
rollovers with the boundaries of the incoming bit times. transmit shift register and flags the TX Control unit
that a transmission is requested. Transmission com-
The 16 states of the counter divide each bit time into mences at SIPl of the machine cycle following the next
16ths. At the 7th, 8th, and 9th counter states of each bit rollover in the divide-by-16 counter. (Thus, the bit
time, the bit detector samples the value of RXD. The times are synchronized to the divide-by-16 counter, not
value accepted is the value that was seen in at least 2 of to the "write to SBUF" signal.)
the 3 samples. This is done for noise rejection. If the
value accepted during the first bit time is not 0, the The transmission begins with activation of SEND,
receive circuits are reset and the unit goes back to look- which puts the start bit at TXD. One bit time later,
ing for another I-to-O transition. This is to provide re- DATA is activated, which enables the output bit of the
jection of false start bits. If the start bit proves valid, it transmit shift register to TXD. The first shift pulse oc-
is shifted into the input shift register, and reception of curs one bit time after that. The first shift clocks a 1
the rest of the frame will proceed. (the stop bit) into the 9th bit position of the shift regis-
ter. Thereafter, only zeroes are clocked in. Thus, as
As data bits come in from the right, Is shift out to the data bits shift out to the right, zeroes are clocked in
left. When the start bit arrives at the leftmost position from the left. When TB8 is at the output position of the
in the shift register, (which in mode 1 is a 9-bit regis- shift register, then the stop bit is just to the left of TB8,
ter), it flags the RX Control block to do one last shift, and all positions to the left of that contain zeroes. This
load SBUF and RB8, and set RI. The signal to load condition flags the TX Control unit to do one last shift
SBUF and RB8, and to set RI, will be generated if, and and then deactivate SEND and set TI. This occurs at
only if, the following conditions are met at the time the the lIth divide-by-16 rollover after "write to SBUF."
final shift pulse is generated.
Reception is initiated by a detected I-to-O transition at
1) RI = 0, and RXD. For this purpose RXD is sampled at a rate of 16
2) Either 5M2 = 0, or the received stop bit = 1 times whatever baud rate has been established. When a
transition is detected, the divide-by-16 counter is imme-
If either of these two conditions is not met, the received diately reset, and IFFH is written to the input shift
frame is irretrievably lost. If both conditions are met, register.
the stop bit goes into RB8, the 8 data bits go into
SBUF, and RI is activated. At this time, whether the At the 7th, 8th and 9th counter states of each bit time,
above conditions are met or not, the unit goes back to the bit detector samples the value of RXD. The value-
looking for a 1-to-0 transItion in RXD. accepted is the value that was seen in at least 2 of the 3
samples. If the value accepted during the first bit time
is not 0, the receive circuits are reset and the unit goes
More About Modes 2 and 3 back to looking for another I-to-O transition. If the
start bit proves valid, it is shifted into the input shift
Eleven bits are transmitted (through TXD), or received register, and reception of the rest of the frame will pro-
(throughRXD): a start bit (0),8 data bits (LSB first), a ceed. . .
programmable 9th data bit, and a stop bit (1). On trans-
6-17
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
WRITE
TO
SBUF
TXD
PHASE 2 CLOCK
('hfosc)
MODE2
TI
SMOD=l SERIAL
PORT
INTERRUPT
RXD
READ _ _......"
SBUF
:~~T~XD~}~T}A~RT~.~IT/~P~D~==~=~==~=~=~:;:;~:;~:;~C:::: )\TRANSMIT
TI
~------~------------------------------ ____________~r---
270252-17
6-18
infef HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
TIMER" TIMER 2
OVERFLOW OVERFLOW
TXD
TCLK -
SEND
LOAD
SBUF
SHIFT 1------...,
RXD
TX
~FLOC~~~~~=-~L-~L--IL--~L-~L-~I--JL--~L-~L-~.L--
---A WRITE TO SBUF
~ SEND
DATA L S1P1 I
SHIFT TRANSMIT
----riD\'TARTBIT/ DO
TI
I
STOP BIT GEN
RX
CLOCK
RXD BIT DETECTORI START BIT /
RECEIVE SAMPLE TIMES
SHIFT ~ __~'L__~L_ _~L_ _"L_~L-_~L_ _~L___JL-__~L-_ _ _
~RI~_______________________________ ~r-----
270252-18
Figure 20. Serial Port Mode 3. TCLK, RCLK, and Timer 2 are Present in the 8052/8032 Only.
6-19
, intJ HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
As data bits come in from the right, Is shift out to the was transition-activated. If the interrupt was level-acti-
left. When the start bit arrives at the leftmost position vated, then the external requesting source is what con-
in the shift register (which in Modes 2 and 3 is a 9-bit trols the request flag, rather than the on-chip hardware.
register), it flags the RX Control block to do one last
shift, load SBUF and RB8, and set RI. The signal to The Timer 0 and Timer 1 Interrupts are generated by
load SBUF and RB8, and to set RI, will be generated if, TFO and TFI, which are set by a rollover in theirre-
and only if, the following conditions are met at the time spective Timer/Counter registers (except see Timer 0 in
the final shift pulse is generated: Mode 3). When a timer interrupt is generated, the flag
that generated it is cleared by the on-chip hardware
1) RI = 0, and when the service routine is vectored to.
2) Either 5M2 = 0 or the received 9th data bit =1
.The Serial Port Interrupt is generated by the logical OR
If either of these conditions is not met, the received of RI and TI. Neither of these flags is Cleared by hard-
frame is irretrievably lost, and RI is not set. If both ware when the service routine is vectored to. In fact,
conditions are met, the received 9th data bit goes into the service routine will normally have to determine
RB8, and the first 8 data bits go into SBUF. One bit whether it was RI or TI that generated the interrupt,
time later, whether the above conditions were met or and the bit will have to be Cleared in software.
not, the unit goes back to looking for a I-to-O transition
at the RXD input. In the 8052, the Timer 2 Interrupt is generated by the
logical OR of TF2 and EXF2. Neither of these flags is
Note that the value of the received stop bit is irrelevant Cleared by hardware when the service routine is vec-.
to SBUF, RB8, or RI. tored to. In fact, the service routine may have to deter-
mine whether it was TF2 or EXF2 that generated the
interrupt, and the -bit will have to be cleared in 80ft-
INTERRUPTS ware.
The 8051 provides 5 interrupt sources. The 8052 pro- All of the bits that generate interrupts can be set or
vides 6. These are shown in Figure 21. Cleared by software, with the same result as though it
had been set or cleared by hardware. That is, interrupts
The External Interrupts INTO and INTI can each be can be generated or pending interrupts can be canceled
either level-activated or transition-activated, depending in software.
on bits ITO and ITI in Register TCON. The flags that
actually generate these interrupts are bits lEO and lEI (MSB) (LSB)
in TCON. When an external interrupt is generated, the
flag that generated it is cleared by the hardware when 1~1-1~1~lml~I~I~1
the service routine is vectored to only if the interrupt Symbol Position Function
~ IE.7 disables all interrupts. If EA = 0, no
interrupt will be acknowledged. .If EA
= 1. each interrupt source Is
individually enabled or disabled by
selling or clearing its enable bH.
IE.6 reserved.
ET2 IE.5 enables or disables the Timer 2
TFO'---------· Overflow or caoture interruot. If ET2
= 0, the Timer 2 Interrupt is disabled.
ES IE.4 enables or disables the Serial Port
interrupt. If ES = O. the Serial Port
INTERRUPT interrupt is disabled.
SOURCES
ETI IE.3 enables or disables the Timer 1
Overflow interrupt. If En = O. the
Timer 1 interrupt Is disabled:
~,--------~~ EXI IE.2 enables. or disables External Interrupt
1. If EXI = O. External Interrupt 1 is
disabled.
ETO IE.l enables or disables the Timer 0
Overflow interrupt. If ETO = 0, the
Timer 0 interruptis disabled.
EXO lE.O enables or disables External Interrupt
O. If EXO = 0, External Interrupt 0 is
disabled.
User sdftware should never write 1s to unimplemented bits,
270252-19 since they [!lay be used in future MC5-51 products.
Each of these interrupt sources can be individually en- If two requests of different priority levels are received
abled or disabled by setting or clearing a bit in Special simultaneously, the request of higher priority level is
Function Register IE (Figure 22). IE contains also a serviced. If requests of the same priority level are re-
global disable bit, EA, which disables all interrupts at ceived simultaneously, an internal polling sequence de-
once. termines which request is serviced. Thus within each
priority level there is a second priority structure deter-
Note in Figure 23 that bit position IE.6 is unimple- mined by the polling sequence, as follows:
mented. In the 805 Is, bit position IE.5 is also unimple-
mented. User software should not write Is to these bit Source Priority Within Level
positions, since they may be used in future MCS-51 1. lEO (highest)
products. 2. TFO
3. IE1
4. TF1
Priority Level Structure 5. RI +TI
Each interrupt source can also be individually pro- 6. TF2 + EXF2 (lowest)
grammed to one of two priority levels by setting or
clearing a bit in Special Function Register IP (Figure Note that the "priority within level" structure is only
23). A low-priority interrupt can itself be interrupted used to resolve simultaneous requests of the same priori-
by a high-priority interrupt, but not by another low-pri- ty leveL
ority interrupt. A high-priority interrupt can't be inter-
rupted by any other interrupt source. The IP register contains a number of unimplemented
bits. IP.7 and IP.6 are vacant in the 8052s, and in the
8051s these and IP.5 are vacant. User software should
(MSB) (LSB)
not write Is to these bit positions, since they may be
1-1-1~1~lrnl~I~I~1 used in future MCS-51 products.
Symbol Position Function
IP.7 reserved
How Interrupts Are Handled
IP.6 reserved
PT2 IP.5 defines the Timer 2 interrupt priority
The interrupt flags are sampled at S5P2 of every ma-
level. PT2 = 1 programs it to the chine cycle. The samples are polled during the follow-
higher priOrity level. ing machine cycle. If one of the flags was in a set condi-
PS IP.4 defines the Serial Port interrupt priority tion at S5P2 of the preceding cycle, the polling cycle
level. PS = 1 programs it to the will find it and the interrupt system will generate an
higher priority level.
LCALL to the appropriate service routine, provided
PTl IP.3 defines the Timer 1 interrupt priority this hardware-generated LCALL is not blocked by any
level. PTl = 1 programs it to the
of the following conditions:
higher priority level.
PTO IP.l defines the Timer 0 interrupt priority
1. An interrupt of equal or higher priority level is al-
level. PTO = 1 programs it to the ready in progress.
higher priority level.
2. The cUrrent (polling) cycle is not the final cycle in
PXO IP.O defines the External Interrupt 0 priority the execution of the instruction in progress.
level. PXO = 1 programs it to the
higher priority level. 3. The instruction in progress is RET! or any write to
User software should never write 1s to unimplemented bits, the IE or IP registers.
since they may be used in future MCS·51 products.
Any of these three conditions will block the generation
Figure 23. IP: Interrupt Priority Register of the LCALL to the interrupt service routine. Condi-
tion 2 ensures that the instruction in progress will be
········~'\---'-----=l.llli---L---l'l:l-----L----
INTERRUPT
f'7'tINTERRUPT
INTERRUPTS
ARE POLLED
LONG CALL TO
INTERRUPT
VECTOR AOORESS
INTERRUPT ROUTIN.E
GOES LATCHEO
ACTIVE
270252-20
This is the fastest possible response when C2 is the final cycle of an instruction other than RETI or an access to IE or IP.
6-21
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
R5T:
~L IIIIIIIII /~ CINTERNAL RE5ET 51GNAL
,
5AMPLE R5T ,
5AMPLE R5T -
P5EN:
po:
,
- - 1 1 05C. PERIOD5 - ........, ...- - - - - 1 9 05C. PERIOD5 -----<....,
270252-33
6-23
intJ HARDWARE DESCRIPTION OF THE 8051,8052 AND 80C51
6-24
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
mode. In the Idle mode, the internal clock signal is The flag bits GFO and GFI can be used to give an
gated off to the CPU, but not to the Interrupt, Timer, indication if an interrupt occurred during normal oper-
and Serial Port functions. The CPU status is preserved ation or during an Idle. For example, an instruction
in its entirety: the Stack Pointer, Program Counter, that activates Idle can also set one or both flag bits.
Program Status Word, Accumulator, and all other reg- When Idle is terminated by an interrupt, the interrupt
isters maintain their data during Idle. The port pins service routine can examine the flag bits.
hold the logical states they had at the time Idle was
activated. ALE and PSEN hold at logic high levels. The other way of terminating the Idle mode is with a
hardware reset. Since the clock oscillator is still run-
There are two ways to terminate the Idle. Activation of ning, the hardware reset needs to be held active for only
any enabled interrupt will cause PCON.O to be cleared two machine cycles (24 oscillatoi- periods) to complete
by hardware, terminating the Idle mode. The interrupt the reset.
will be serviced, and following RETI the next instruc- The signal at the RST pin clears the IDL bit directly
tion to' be executed will be the one following the in- and asynchronously. At this time the CPU resumes
struction that put the device into Idle. program execution from where it left off; that is, at the
instruction following the one that invoked the Idle
Mode. As shown in Figure 25, two or three machine
~
cycles of program execution may take place before the
internal reset algorithm takes control. On-chip hard-
ware inhibits access to the internal RAM during this
XTAL 2 = XTAL 1 time, but access to the port pins is not inhibited. To,
eliminate the possibility of unexpected outputs at the
port pins, the instruction following the one that invokes
INTERRUPT,
i-r-C>SERIAL PORT,
Idle should not be one that writes to a port pin or to
TIMER BLOCKS external Data RAM.
CPU
POWER DOWN MODE
An instruction that sets PCON.l causes that to be the
last instruction executed' before going into the Power
270252-22 Down mode: In the Power Down mode, the on-chip
oscillator is stopped. With the clock frozen, all func-
Figure 27. Idle and Power Down Hardware
tions are stopped, but the on-chip RAM and Special
Function Registers are. held. The port pins output the
(MSB) (LSB) values held by their respective SFRs. ALE and PSEN
SMOD GF1 GFO PD IDL
output lows.
The only exit from Power Down for the 80C5l is a
Symbol Posltlo'n Name and Function
hardware reset. Reset redefines all. the SFRs, but does
SMOD PCON.7 Double Baud rate bit. When set to a 1
not change the on-chip RAM.
and Timer 1 is used to generate baud
rate, and the Serial Port is used in In the Power Down mode of operation, VCC can be
modes 1, 2, or 3. reduced to as low as 2V. Care must be taken, however,
PCON.S (Reserved) to ensure that VCC is not reduced before the Power
PCON.5 (Reserved) Down mode is invoked, and that VCC is restored to its
PCON.4 (Reserved)
normal operating level, before the Power Down mode is
terminated. The reset that terminates Power Down also
GF1 PCON.3 General-purpose flag bit.
frees the' oscillator. The reset should not be activated
GFO PCON.2 General-purpose flag bit. before VCC is restored to its normal ,operating level,
PD PCON.1 Power Down bit. Setting this bit and must be held active long enough to allow the oscil-
activates power down operation. lator to restart and stahilize (normally less than 10
IDL PCON.O Idle mode bit. Setting this bit activates
msec). ' ,
idle mode operation.
If 1s are written to PD and IDL at the same time, PD takes
Precedence. The reset value of PCON is (OXXXOOOO).
EPROM VERSIONS
In the HM0S devices the PCON register only contains The EPROM versions of these devices are listed in Ta-
SMOD. The other four bits are implemented only in the
CHMOS devices. User software should never write 1s to
ble 4. The 8751H programs at VPP = 21V using one
unimplemented bits, since they may be used in future MCS- 50 msec PROG pulse per byte programmed. This re-
51 products. sults in at6tal programming time (4K bytes) of approx-
imately 4 minutes.
Figure 28. PCON: Power Control Register
6-25
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
The 87S2BH and 87CS1 use the faster "Quick-Pulse" 87C51 AND 8752BH
programming™ algorithm. These devices program at
VPP = 12.7SV using a series of twenty-five 100 p.s The 87CS1 and 87S2BH contain two Program Memory
PROG pulses per byte programmed. This results in a locking schemes: Encrypted Verify and Lock Bits.
total programming time of approximately 26 seconds
for the 87S2BH (8K bytes) and 13 seconds for the Encrypted Verify: These devices implement a 32-byte
87CS1 (4K bytes). EPROM array that can be programmed by the custom-
er, and which can then be used to encrypt the program
Detailed procedures for programming and verifying code bytes during EPROM verification. The EPROM
each device are given in the data sheets. verification procedure is performed as usual, except
that each code byte comes out X-NORed ~th one of
the 32 key bytes. The key bytes are gone through in
EXPOSURE TO LIGHT sequence. Therefore, to read the ROM code, one has to
It is good practice to cover the EPROM window with know the 32 key bytes in their proper sequence.
an opaque label when the device is in operation. This is
not so much to protect the EPROM array·from inad- Unprogrammed bytes have the value FFH. Therefore,
vertent erasure, but to protect the RAM and other on- if the Encryption Array is lc;ft unprogrammed all the
chip logic. Allowing light to impinge on the silicon die key bytes have the value FFH. Since any code byte
while the device is operating can cause logical malfunc- X-NORed with FFH leaves the code byte. unchanged,
tion. leaving the Encryption Array unprogrammed in effect
bypasses the encryption feature.
LOck Bits: Also on the chip are two Lock Bits which
Program Memory Locks can be left unprogrammed (U) or programmed (P) to
In some micro controller applications it is desirable that obtain the following features:
the Program Memory be secure from software piracy. Bit 2 Bit 1 Additional Features
Intel has responded to this. need by implementing a
Program Memory locking scheme in some of the MCS- U U None
Sl devices. While it is impossible· for anyone to guaran- U P • Externally fetched code can not
tee absolute security against all levels of technological access internal Program Memory.
sophistication, the Program Memory locks in the MCS-
SI devices will present a formidable barrier against Hie- • Further programming disabled.
gal readout of protected software. P U (Reserved for Future definition.)
P P • Externally fetched code can not
8751H access internal Program Memory.
• Further programming disabled. .
The 87S1H contains· a lock bit which, once pro-
grammed, denies electrical access by any external • Program verification is disabled.
means to.the on-chip Program Memory. The effect .of
this lock bit is that while it is programmed the internal When Lock Bit 1 is programmed, the logic level at the
Program Memory can not be read out, the device can EA pin is sampled and latched during reset. If the d~
not be further programmed, and it can not execute ex- vice is powered up without a reset, the latch initializes
ternal Program Memory. Erasing the EPROM array to a random value, and holds that value until reset is
deactivates the lock bit and restores the device's full activated. It is necessary that the latched value of EA
functionality. It can then be r~programmed. be in agreement with the current logic level at that pin
in order for the device to function properly.
The procedure·for programming the lock bit is detailed
in the 87S1H data sheet.
6-26
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
ONCE Mode in the 87C51 Normal operation is restored after a normal reset is
applied.
The ONCE ("on-circuit emulation") mode facilitates
testing and debugging of systems using the 87C51 with-
out the 87C51 having to be removed from the circuit. THE ON-CHIP OSCILLATORS
The ONCE mode is invoked by:
1. Pull ALE low while the device is in reset and PSEN HMOS Versions
is high; The on-chip oscillator circuitry for the HMOS
2. Hold ALE low as RST is deactivated. (HMOS-I and HMOS-II) members of the MCS-51 fam-
ily is a single stage linear inverter (Figure 29), intended
While the device is in ONCE mode, the Port 0 pins go for use as a crystal-controlled, positive reactance oscil-
into a float state, and the other port pins and ALE and lator (Figure 30). In this application the crystal is oper-
PSEN are weakly pulled high. The oscillator circuit ated in its fundamental response mode as an inductive
remains active. While the 87C51 is in this mode, an reactance in parallel resonance with capacitance exter-
emulator or test CPU can be used to drive the circuit. nal to the crystal.
Vee
TO INTERNAL
TIMINGCKTS
XTAL2
XTAL1
if
SUBST.
270252-23
Figure 29. On-Chip Oscillator Circuitry in the HMOS Versions of the MCS®-51 Family
Q2
TO INTERNAL
TIMING CKTS
Vss
~-t---QUARTZ CRYSTAL
OR CERAMIC RESONATOR
270252-24
6-27
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
The crystal specifications and capacitance values (Cl To drive the HMOS parts with an external .clock
and C2 in Figure 30) are not critical. 30 pF can be used source, apply the external clock signal to XTAL2, and
in these positions at any frequency with good quality ground XTALl, as shown in Figure 31. A pullup resis-
crystals. A ceramic resonator can be used in place of tor may be used (to increase noise margin), but is op-
the crystal iii cost-sensitive applications. When a ce- tional if VOH of the driving gate exceeds the VlH MIN
ramic resonator is used, Cl and C2 are normally select- specification of XTAL2.
ed to be of somewhat higher values, typicaIly, 47 pF.
The manufacturer of the ceramic resonator should be
consulted for recommendations on the values of these CHMOS VERSIONS
capacitors.
The on-chip oscillator circuitry for the 80C5IBH,
A more in-depth discussion of crystal specifications, ce- shown in Figure 32, consists of a single stage linear
ramic resonators, and the selection of values for Cl and inverter intended for use as a crystal-controlled, posi-
C2 can be found in Application Note AP-155, "Oscilla- tive reactance oscillator in the same manner as the
tors for Microcontrollers," which is included in this HMOS parts. However, there are some important dif-
manual. ferences.
TO INTERNAL
Vcc
TIMING CKTS
1 01
4000
XTAL1 XTAL2
D2
PD -----II+---.
270252-26
Figure 32. On-Chip Oscillator Circuitry in the CHMOS Versions of the MCS®-S1 Family
6-28
inter HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
VCC
TO INTERNAL
TIMING CKTS
Rt
VSS
-------- XTAL1----- XTAL2------
80CS1
~--r--QUARTZ CRYSTAL
OR CERAMIC
RESONATOR
270252-27
The oscillator can be used with the same external com- Rise and fall times are dependent on the external load-
ponents as the HMOS versions, as shown in Figure 33. ing that each pin must drive. They are often taken to be
Typically, CI = C2 = 30 pF when the feedback ele- something in the neighborhood of 10 nsec, measured
ment is a quartz crystal, and CI = C2 = 47 pF when a between 0.8V and 2.0V.
ceramic resonator is used.
Propagation delays are different for different pins. For
To drive the CHMOS parts with an external clock a given pin they vary with pin loading, temperature,
source, apply the external clock signal to XTALl, and VCC, and manufacturing lot. If the XTAL2 waveform
leave XTAL2 float, as shown in Figure 34. is taken as the timing reference, prop delays may vary
from 25 to 125 nsec.
The reason for this change from the way the HMOS
part is driven can be seen by comparing Figures 29 and The AC Timings section of the data sheets do not refer-
32. In the HMOS devices the internal timing circuits ence any timing to the XTAL2 waveform. Rather, they
are driven by the signal at XTAL2. In the CHMOS relate the critical edges of control and input signals to
devices the internal timing circuits are driven by the each other. The timings published in the data sheets
signal at XTALI. include the effects of propagation delays under the
specified test conditions.
80CS1
MCS®-S1 PIN DESCRIPTIONS
NC XTAL2
6-29
HARDWARE DESCRIPTION OF THE.8051, 8052 AND 80C51
to them are pulled high by the internal pullups, and in The Port 3 output buffers can source/sink 4 LS TTL
that state can be used as inputs. As inputs, Port 1 pins loads.
that are externally being pulled low will source current
(ilL, on the data sheet) because ofthe internal pullups. RST: Reset input. A high on this pin for two machine
cycles while' the oscillator is' running resets the device.
In the 8052, pins P1.0 and Pl.l also serve the alternate
functions of T2 and T2EX. T2 is the Timer 2 external ALE/PROG: Address Latch Enable output pulse for
input. T2EX is the input through which a Timer 2 latching the low byte of the address during accesses to
"capture" is triggered. external memory. ALE is emitted at a constant rate of
'I. of the oscillator frequency, for external timing or
Port 2: Port 2 is an 8-bit bidirectional I/O port with clocking purposes, even when there are no accesses to
internal pullups. The Port 2 output buffers can sink/ external memory. (However, one ALE pulse is skipped
~ource 4 LS TTL loads. Port 2 emits the high-order during each access to external Data Me~ This pin
address byte during accesses to external meniory that is also the program pulse input (pROG during
use 16-bit addresses. In this application it uses the EPROM programming.
strong internal pullups when emitting Is. Port 2 also
receives the high-order address and control bits during PSEN: Program Store Enable is the read strobe to ex-
8751H programming and verification, and during pro- ternal Program Memory. When the device is executing
gram verification in the 8051AH. out of external Program Memory, PSEN is activated
twice each machine cycle (except that two PSEN acti-
Port 3: Port 3 is an 8-bit bidirectional I/O port with vations are~ed during accesses to external Data
internal pullups. It also serves the functions of various Memory). PSEN is not activated when the device is
special features of the MCS-51 Family, as listed below: executing out of internal Program Memory.
Port Pin Alternate Function EA/VPP: When EA is held high the CPU executes out
P3.0 RXD (serial input port) of internal Program Memory (unless the Program
P3.1 TXD (serial output port) Counter exceeds OFFFH in the 8051AH, or IFFFH in
P3.2 INTO (external interrupt 0) the 8052). Holding EA low forces the CPU to execute
P3.3 INT1 (external interrupt 1) out of externlll memory regardless of the Program
P3.4 TO (Timer 0 external input) Counter value. In the 8031AH and 8032, EA must be
P3.5 T1 (Timer 1 external input)
extremely wired low. In the EPROM devices, this pin
also receives the programming supply voltage (VPP)
P3.6 WR (external data memory
during EPROM programming. .
write strobe)
P3.7 RD (external data memory XTALl: Input to the inverting oscillator amplifier.
read strobe)
XTAL2: Output from the inverting oscillator amplifier..
~~nnnnnnnnnnnnnnnnn
~UUUUUUUUUUUUUUUU~
ALE:
270252-29
I ~1P2 ~1P2
I
STATE 41 STATE 51 STATE 81 STATE 1 STATE 21 STATE 31 STATE 41 STATE 51
~1P2 ~1P2 ~In ~1P2 ~1P2 ~1P2
XTAL2:
ALE:
RD:
PO:
PCH OR PCH OR
P2: DPH OR P2 SFR OUT
P2SFR P2SFR
270252-30
I I
STATE 41 STATE 5 STATE
~1P2 ~1P2 ~1P2
61 STATE 1 ISTATE 2.1 STATE 3.1 STATE 41 STATE 51
~1P2 ~1P2 ~1P2 ~1P2 ~1P2
XTAL2:
ALE:
jr--
ViR: PCLOUTIF
IS EXTERNAL
po: - - - - - I DPL OR RI
OUT
DATA OUT
~f ~
P2 PCH OR PCH OR
DPH OR P2 SFR OUT
P2SFR P2SFR
270252-31
6-31
HARDWARE DESCRIPTION OF THE 8051, 8052 AND 80C51
XTAL2:
- -YZ,P1 PO'P1~.
INPUTS S A M P L E D : . .
P2, P3, RST ~,P3, R S T = r l -
MOY PORT, SRC: OLD DATA NEW DATA
SERIAL PORT
SHIFT CLOCK
(MODE 0)'
---+I r-- RXD PIN SAMPLED RXD SAMPLED --.j ~
270252-32
6-32
Hardware Description of the 7
83C51FA
HARDWARE DESCRIPTION
OF THE 83C51FA (83C252)
INTRODUCTION Port
Name Function
Pin
The 83C51FA is an 8-bit control-oriented microcon-
troller based on the 8051 architecture. The 83C51FA is P1.2 ECI External Count Input to the PCA
an enhanced version of the 80C51BH and incorporates
many new features. These features include: P1.S CEXO External 110 for Compare/Capture
Module 0
• Programmable Counter Array with
- Compare/Capture P1.4 CEX1 External I/O for Comparel.Capture
- High Speed Output Module 1
- Pulse Width Modulator P1.5 CEX2 External I/O for Compare/Capture
- Watchdog Timer Module 2
• Programmable Serial Channel
- Automatic Address Recognition P1,6 CEXS External I/O for Compare/Capture
- Framing Error Detection ModuleS
• Enhanced Power Down Mode P1.7 CEX4 External I/O for Compare/Capture
Module 4
• 16-Bit Up/Down Timer/Counter
• 8K Factory Mask ROM
The time-base for the PCA is a programmable 16-bit
• 256 Bytes of On-Chip Data RAM timer/counter. This timer is the only one that can serve
• 7 Interrupt Sources the PCA. This timer is started or stopped by setting or
clearing bit CR in the Special Function Register
The 83C51FA uses the standard 8051 instruction set CCON, and can be programmed to count any of the
and is pin for pin compatible with the existing following signals (where Fosc is the 83C51FA oscilla-
MCS®-5l products, However, the numbering system tor frequency):
for the 83C51FA is slightly different. The 83C51FA is • Fosc/12
the factory masked ROM device; the 80C51FA is the The Counter increments once per machine cycle.
ROMless device; and the 87C51FA is the EPROM de-
vice. • Fosc/4
With a 16 MHz crystal, the counter increments once
It is assumed that the reader is familiar with the 8051 every 250 ns.
architecture. For more detailed information on the • Timer 0 overflow
8051, consult the "Hardware Description of the 8051 The counteds incremented whenever Timer 0 over-
and 8052" chapter. flows. This mode allows a programmable input fre-
quency to the PCA.
• External input on ECI pin
OVERVIEW OF THE PCA The counter is incremented when a I-to-O transition
is detected on the ECI pin. The counter is limited to
The Programmable Timer/Counter Array (PCA) con- input frequencies of Fosc/8 in this mode.
sists of a 16-bit counter and five 16-bit compare/cap-
ture modules. Each compare/capture module has its The 16-bit PCA timer/counter can also be pro-
own mode register, CCAPMn, which is used to config- grammed to either run or pause when the CPU is in
ure the module. The compare/capture modules and the Idle mode.
PCA counter share Port 1 pins for hardware interfacing
as shown below:
7-1
intJ HARDWARE DESCRIPTION OF THE 83C51FA
Each of the five 16-bit compare/capture modules can High speed output mode, an interrupt can be generated
be programmed to do one of the following: when the module executes its function.
• 16-bit capture; positive edge activated.
• 16-bit capture, negative edge activated. DESCRIPTION OF THE PCA
• 16-bit capture, both positive and negative edge acti- HARDWARE
vated.
• 16-bit software timer. The time base for the PCA is a 16-bit timer/counter
consisting of registers CH and CL (high and low bytes
• High-speed output. of the count value), controlled by Special Function
• 8-bit Pulse Width Modulator (PWM). Register CCON (Figure 1) and a mode register CMOD
(Figure 2).
In addition, Compare/Capture module 4 can be used as
a Watchdog Timer. CCON contains bits CF (Counter Flag) which gets set
by hardware when the counter rolls over and CR
When any o.f the compare/capture modules. are pro- (Counter Run) which is used to tum the counter on
grammed to the capture mode or the 16-bit .Timer/ and off. It also contains interrupt flags from each of the
five PCA modules.
7-2
inter HARDWARE DESCRIPTION OF THE 83C51FA
CMOD contains the following bits: CPS! and CPSO-select the counter input
CIDL- selects whether the PCA counter continues to ECF- enables CF to generate an interrupt.
run in Idle Mode
WDTE- enables the Watchdog Timer function
Each of the five PCA modules has a Compare/Capture MATn-enables a comparator match to set the cor-
Mode register, CCAPMn, n = 0 through 4 (Figure 3). responding CCFn flag
The following bits in each CCAPMn register define TOGn- enables a comparator match to toggle the
that module's function. CEXnpin
ECOMn- enables that module's comparator function PWMn- enables the PWM output at the CEXn pin
CAPPn- enables the capture function on positive ECCFn- enables any Compare/Capture event to flag
transitions at theCEXn pin an interrupt
CAPNn- enables the capture function on negative
transitions at the CEXn pin
7-3
intJ HARDWARE DESCRIPTION OF THE 83C51FA
There are 6 modes of operation for each of the 5. PCA defined function. Invalid combinations will produce un-
modules: Shown below are the combinations of bits in defined results.
the CCAPMn register that are valid and have a
ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn Module Function
0 0 0 0 0 0 0 No operation
X 1 0 0 0 0 X 16-bit capture by a positive-edge
trigger on CEXn
X 0 1 0 0 0 X 16-bit capture by a negativecedge
trigger on CEXn
X 1 1 0 0 0 X 16-bit capture by a transition
on CEXn
1 0 0 1 0 0 X 16-bit software timer
1 0 0 1 1 0 .x High Speed Output
1 0 0 0 0 1 0 a-bit PWM
x= Don't Care
7-4
inter HARDWARE DESCRIPTION OF THE 83C51FA
COUNT
INTERRUPT
ENABLE
Fosc/12
Fosc/4
TIMER 0
OVERFLOW
'-t===:..:::::t-----[]ECI
270421-1
7-5
HARDWARE DESCRIPTION OF THE 83C51FA
CEXn
CCAPMn REGISTER
270421-2
n = 0, 1, 2, 3 or 4
x = Don'l Care
16 Bit Timer with the count value of the counter module. When they
are equal, a match signal is generated which can set the
Setting bit ECOMn in the Compare/Capture. Mode status bit CCFn in· the PCA COntrol register CCON
Register (CCAPMn) enables the Comparator function and/or toggle the corresponding CEXn pin.
as shown in Figure 6. The Comparator compares a
16-bit value stored in the compare/capture register
WOTE
(MODULE 4 ONLY)
_ . L____- II CAUSE
I
PCA TIMER
16 r-----------,
COUNTER VALUE
r----------~---------_1---------~
RESET
WRITE TO
. CCAPnL
RESET ------L..;
WRITE TO
CCAPnH
270421-3
n = 0, 1, 2, 3 or 4
x = Don'l Care
7-6
inter HARDWARE DESCRIPTION OF THE 83C51FA
Bit ECOMn is set by software and is initially cleared reverses the logic level of its" I/O pin, and/or can gener-
during reset. It also gets cleared when a write to ate an interrupt as shown in Figure 6. When the PCA
CCAPnL register happens and is set if CCAPnH is module is configured in this manner as a High Speed
written to. This feature prevents ·action until the com- Output, the user, by setting or clearing the pin in soft-
plete 16-bit value is loaded into the CCAPnH/L regis- ware, can select whether the module's output pin will
ter if the low value is written to the 16-bit register first. change from a logical 0 to a logical 1 or vice versa.
270421-4
n = 0, 1, 2, 3 or 4
x = Don't Care
Figure 7. 8-Bit PWM Mode
7-7
intJ HARDWARE DESCRIPTION OF THE 83C51FA
Watch Dog Timer Mode not activated unless the received byte is an address byte
(9th data bit = I), and the address corresponds to ei-
A Watchdog Timer js a circuit that automatically in- ther a Given Address or a Broadcast Address.
vokes a reset unless the system being watched sends
regular hold-off signals to the Watchdog. These circuits The feature works the same way in the 8-bit mode
are used in applications that are subject to electrical (mode I) as in the 9-bit modes, except that the stop bit
noise, power glitches, electrostatic discharges, etc., or takes the place of the 9th data bit. That is, if SM2 is set,
where high reliability is required with hands-off opera- RI is not activated unless the received byte agrees with
tion. either the Given or Broadcast address and is terminated
by a valid stop bit.
In this mode, every time the count in the PCA counter
module matches the value 'stored in compare/capture The Given Address is specified by the contents of two
module 4, an internal reset is generated. The' bit that new SFRs: SADDR and SADEN. The 83C51FA's in-
selects this mode is WDTE in the CMOD register. dividual address is defined in SADDR. SADEN is a
Compare/capture module 4 should be set up to be a mask byte that defines don't-cares in SADDR to form '
16-bit timer or a High Speed Output in the Watchdog the Given Address. For example,
Timer mode. ' SADDR = 01010110
SADEN = 11111100
To hold off the reset, the user's software can:
spec,ify the Given Address to be OIOIOIXX.
• Continually reset the PCA 16-bit timer value to a
lower value than the reset value in module 4. The Broadcast. Address is formed from the logical OR
• Clear the WDTE bit when a match is about to oc- of SADDR and SADEN. Zeros in the logical OR are
cur, and then set the WDTE bit just after the match don't-cares. For example, the values given above for
condition (temporarily disabling the feature). SADDR and SADEN defme the broadcast address to
or be 11 111 11X.
• Continually change the CCAP4H and CCAP4L val-
ue to one that is "far" from a match value. Automatic Address Recognition allows a host proces-
sor to establish communication -with an addressed
Finally, the Watchdog Timer can be used to program a slave, without all the other slave controllers having to
reset by allowing a match to occur. respond to the transmission. The addressed slave then
clears its SM2 bit to enable reception of data bytes (9th
data bit = 0) from the host.
EXTENDED SERIAL PORT FEATURES The Given and Broadcast addresses allow each micro-
The full duplex serial port of the 83C51FA is the same controller to have its own (Given) address and a com-
as the serial port of the 8052 but with two added fea- mon (Broadcast) address. A "host" on the serial chan-
tures: Automatic Address Recognition and Framing nel can selectively address single 83C51FA's using the
Error Detection. 'Given Address or all 83C51FA's using the Broadcast
Address.
Automatic Address Recognition On reset, the SADDR and SADEN registers are initial-
ized to OOH. This defines the Given and Broadcast ad-
Automatic Address Recognition is useful in multi-proc- dresses to be XXXXXXXX (all don't-cares) for back-
essor applications in which the CPUs communicate wards compatibility with the MCS®-51 family.
through the serial channel. Using this feature, the
83C51FA's Serial Port refrains from interrupting the
CPU unless it receives its own address. Automatic Ad- Framing Error Detection
dress Recognition is enabled by setting the SM2 bit in
SCON. - Another new feature of the Serial Port is Framing Er-
ror Detection. This allows the receiving controller to
Normally the Serial Port would be configured into ei- check the stop bit in modes I, 2, or 3. A missing stop
ther of the 9-bit modes (modes 2 and 3). In these bit causes a Framing Error bit, FE, to be set. The FE
modes, if SM2 is set, the Receive Interrupt flag RI is bit can then be checked in software immediately after
each reception to detect the lack of a valid stop bit. A
missing stop bit can be caused, for example, by noise on
the serial lines, or by two CPUs trying to transmit at
the same time.
7-8
inter HARDWARE DESCRIPTION OF THE 83C51FA
The FE bit, once set, must be cleared in software. A iced, the next instruction executed after RETI will be
valid stop bit does not cause the FE bit to be cleared. the one following the instruction that put the device in
Power Down.
The FE bit resides in SCON, and has the same bit ad-
dress as the SMO bit. A new control bit in the PCON
register determines if accesses to the SMO/FE bit ad- Power Off Flag
dress are to SMO or to FE. The new control bit in
PCON is called SMODO, and resides at PCON.6 (Fig- A Power Off Flag, POF, has been added to the PCON
ure 8). IfSMODO = 0, then accesses to SCON.7 are to register (Figure 8). This flag is set by hardware when
SMO. IfSMODO = I, then accesses to SCON.7 are to VCC comes up, and can be set or cleared by software.
FE. This allows one to distinguish between a "cold start"
reset and a "warm start" reset.
REDUCED POWER MODES A cold start reset is one that is coincident with VCC
being turned on to the device after it was turned off. A
warm start reset is one that. occurs after the device has
Idle Mode already been powered up and running. A warm start
reset could be generated, for example, by a Watchdog
Idle Mode is the same in the 83C51FA as in the Timer, or as an exit from Power Down Mode.
80C5IBH. Note that the PCA can be programmed to·
either pause or continue operations during Idle. To use the feature, one checks the POF bit in software
immediately after reset. POF = I would indicate a
cold start. The software then clears POF, and com-
Power Down Mode mences its tasks. POF = 0 immediately after reset
would indicate a warm start.
The Power Down Mode on the 83C51FA differs from
the SOC5IBH in one respect: the 83C51FA can exit VCC must remain above 3 volts for POF to retain a o.
Power Down with either a hardware Reset or an Exter-
nal Interrupt. (The 80C5IBH can only exit Power
Down with a hardware Reset.) An exit with an Exter- TIMER 2 AS AN UP/DOWN COUNTER
nal Interrupt allows not only the on-chip RAM to be
saved but also the Special Function Registers. Timer 2 is a general purpose 16-bit timer/counter
which is present in the 8052 and in the 83C51FA. Tim-
The External Interrupt, INTO or INTI, must be en- er 2 has the same functionality in both of these devices
abled and configured as level-sensitive to properly ter- except that in the 8052 Timer 2 can only count up, and
minate Power Down. Also the interrupt should not be in the 83C51FA Timer 2 can be programmed to count
executed before Vee is restored to its normal operating up or down. The option to count up or down becomes
level, and must be held down long enough for the oscil- available when the Timer is configured to its 16-bit
lator to restart and stabilize. Once the interrupt is serv- auto-reload mode.
7-9
inter HARDWARE DESCRIPTION OF THE 83C51FA
x x x x x x x DCEN
Address = OC9H Reset Value = XXXX XXXOB
DCEN When set, this bit allows Timer 2 to be configured as an up/down counter.
Figure 9. T2MOD: Timer 2 Mode Control Register
~
~ .~ !C/f2=o
T2 PIN ------~
TIMER 2
INTERRUPT
T2EX PIN ------+1
EXEN2
270421-5
The Special Function Register T2MOD (present in the When DCEN is set (I), the Timer 2 Auto-Reload Mode
83C51FA but not in the 8052) contains a bit named takes the form shown in Figure 11. The T2EX pin now
DCEN (Down Counter Enable). T2MOD is shown in controls the direction of count. A logic 1 at T2EX
Figure 9. When this bit is clear (0), the Timer 2 Auto- makes Timer 2 count up. A logic 0 at T2EX makes
Reload Mode in the 83C51FA is exactly the same as iii Timer 2 count down. Also, the EXF2 bit toggles every
the 8052. Figure,IO shows Timer 2 in Auto-Reload time Timer 2 overflows or underflows. In this operating
Mode with DCEN = o. mode, the EXF2 bit does not flag an interrupt.
270421-6
7-11
HARDWARE DESCRIPTION OF THE 83C51FA
INTO---cY ITO
TFO-------------------------.~
INT1,...---<:r-
TF1------------------------.~
INTERRUPT
SOURCES
CF-3ECF
~\--------..,D)--------------+~
TF2 _ _ _ _ _ _ _ _
EXF2- -
...,D.·. ____________•
,- ~
270421-7
(Sea oxceptions ,,·,hen Timer 2 is used as baud rate gl3l"!Aratnr or an up/down counter.)
The Timer 2 interrupt is generated by the logical OR of All of the bits that generate interrupts can be set or
TF2 and EXF2. Neither of these flags is cleared by cleared in software, with the same result as though it
hardware when the service routine is vectored to. In had been set or Cleared by hardware. That is, interrupts
fact, the service routine may have to determine whether can be generated or pending interrupts can be cancelled
it was TF2 or EXF2 that generated the interrupt, and in software. . .
the bit will have to be cleared in software.
Each of these interrupt sources can be individually en-
The PCA interrupt is generated by the logical OR of abled or disabled by setting or clearing a bit in Special
CF, CCFO, CCF1, CCF2, CCF3, and CCF4. None of Function Register IE (Figure 13). Note that IE also
these flags is Cleared by hardware when the service rou- contains a global disable bit, EA. If EA is set (I), the
tine is vectored to. In fact, normally the service routine interrupts· are individually enabled or disabled by their
will have to determine which bit flagged the interrupt corresponding bits in IE. If EA is clear (0), all inter-
and clear that bit in software. rupts are disabled.
7-12
1
\
If two interrupts of different priority levels are flagged location of the interrupt service routine as shoWn be-
simultaneously, the interrupt request of the higher pri- low.
ority level is serviced. If interrupts of the same priority SOURCE STARTING ADDRESS OF
level are flagged simultaneously, an internal polling se- SERVICE ROUTINE
quence determines which interrupt request is serviced. lEO 0003H
Thus within each priority level there is a second priori- .
TFO OOOBH
ty structure determined by the following polling se-
IE1 0013H
quence:
TF1 001BH
SOURCE PRIORITY WITHIN LEVEL 0023H
RI+TI
1. lEO (highest) TF2+EXF2 002BH
2. TFO PCA 0033H
3. lEI
Execution proc~eds from that location until the RETI
4. TFI instruction is encountered, which terminates the inter-
5.PCA rupt service routine. Note that the starting addresses of
6.RI+TI consecutive interrupt service routines are only 8 bytes
apart. That means if consecutive interrupts are being
7. TF2+ EXF2 (lowest) used (lEO and TFO, for example, or. TFO and lEI), and
if the first interrupt routine is more than 7 bytes long,
Note that the "priority within level" structure is only then that routine will have to execute a jump out to
used to resolve simultaneous requests of the same prior- some other memory location where the service routine
ity level. can be completed without overlapping the starting ad-
·dress of the next interrupt routine. .
LOCATION OF INTERRUPT SERVICE . Note that, although the polling position of the PCA-
ROUTINES generated interrilpt is higher than that of the Serial
Port, the starting address of the Serial Port interrupt
The Interrupt Control System acknowledges an inter- routine is unchanged from the 8051. This is for back-
rupt request by executing a hardware-generated wards software compatibility. Similarly, the Timer 2
LCALL to the appropriate service routine. The hard- interrupt 'starting addreSs is compatible with the 8052.
ware-generated LCALL pushes the contents of the Pro- This allows conversion of 8052 (HMOS) designs to the
gram Counter onto the stack (but it does not'save the 83C51FA (CHMOS) with no software modification.
PSW) and reloads the PC with the starting
7-14
inter HARDWARE DESCRIPTION OF THE 83C51FA
Table 1. Special Function Register Memory Map and Values After Reset
F8 CH CCAPOH CCAP1H CCAP2H CCAP3H CCAP4H FF
00000000 XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
FO *S F7
00000000
E8 CL CCAPOL CCAP1L CCAP2L CCAP3L CCAP4L EF
00000000 XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
EO 'ACC E7
00000000
08 CCON CMOO CCAPMO CCAPM1 CCAPM2 CCAPM3 CCAPM4 OF
OOXOOOOO OOXXXOOO XOOOOOOO XOOOOOOO XOOOOOOO XOOOOOOO XOOOOOOO
DO • PSW 07
00000000
C8 T2CON T2MOO RCAP2L RCAP2H TL2 TH2 CF
00000000 XXXXXXXO 00000000 00000000 00000000 00000000
co C7
S8 • IP SAOEN SF
XOOOOOOO 00000000
So * P3 S7
11111111
A8 • IE SAOOR AF
00000000 00000000
AO • P2 A7
11111111
98 'SCON * SSUF 9F
00000000 XXXXXXXX
90 • P1 97
11111111
88 " TCON *TMOO • TLO • TL1 • THO, • TH1 8F
00000000 00000000 00000000 00000000 00000000 00000000
80 " PO • SP • OPL • OPH 'PCON •• 87
11111111 00000111 00000000 00000000 OOXXOOOO
• = Found In the 8051 core (See 8051 Hardware Description for explanations of these SFRs).
•• = See description of PCON SFR. Bit PCON.4 is not affected by reset.
X = Undefined.
7-15
Hardware Description of the 8'
83C152
HARDWARE DESCRIPTION
OF THE 83C152
1.0 INTRODUCTION use of external program memory. The second difference
is that RESET is active low in the 83CI52 and active
The 83CI52 Universal Communications Controller is high in the 80C51BH. This is very important to design-
an 8-bit microcontroller designed for the intelligent ers who may currently be using the 80C51BH and plan-
management of peripheral systems or components. The ning to use the 83C152, or are planning on using both
83CI52 is a derivative of the 80C51BH and retains the devices on the same board. The third difference is that
same functionality. The 83CI52 is fabricated on the GFO and GFI, general purpose flags in PCON, have
same CHMOS III process as the 80C51BH. What been renamed GFIEN and XRCLK. GFIEN enables
makes the 83CI52 different is that it has added func- idle flags to be generated in SDLC mode, and XRCLK
tions and peripherals to the basic 80C5IBH architec- enables the receiver to be externally clocked. All of the
ture that are supported by new Special Function Regis- previously unused bits are now being used and inter-
ters (SFRs). These enhancements include: a high speed rupt vectors have been added to support the new en-
multi-protocol serial communication interface, two hancements. Programmers using old code generated for
channels for DMA transfers, HOLD/HLDA bus con- the 80C51BH will have to examine their programs to
trol, a fifth I/O port, expanded data memory, and ex- ensure that new bits are properly loaded, and that the
panded program memory. new interrupt vectors will not interfere with their pro-
gram.
In addition to a standard UART, referred to here as
Local Serial Channel (LSC) , the 83Cl52 has an on- Throughout the rest of this manual the 80CI52 and the
board multi-protocol communication controller called 83CI52 will be referred to generically as the "CI52".
the Global Serial Channel (GSC). The GSC interface
supports SDLC, CSMA/CD, user definable protocols, The CI52 is based on the 80C51BH architecture and
and a subset of HDLC protocols. The GSC capabilities utilizes the same 80C5IBH instruction set. Figure 1.1 is
include: address recognition, collision resolution, CRC a block diagram of the C152. Readers are urged to
generation, flag generation, automatic retransmission, compare this block diagram with the 80C51BH block
and a hardware based acknowledge feature. This high diagram. There have been no new instructions added.
speed serial channel is capable of implementing the All the new features and peripherals are supported by
Data Link Layer and the Physical Link Layer as shown an extension of the Special Function Registers (SFRs).
in the OSI open systems communication model. This Very little of the information pertaining specifically to
model can be found in the document "Reference Model the 80C5IBH core will be discussed in this chapter.
for Open Systems Interconnection Architecture", The detailed information on such functions as: the in-
ISO/TC97/SCI6 N309. struction set, port operation, timer/counters, etc., can
be found in the MCS®-51 Architecture chapter in the
The DMA circuitry consists of two 8-bit DMA chan- Intel Embedded Controller Handbook. Knowledge of
nels with 16-bit addressability. The control signals; the 80C5IBH is required to fully understand this man-
Read (RD), Write (WR), hold and hold acknowledge ual and the operation of the C152. To gain a basic un-
(HOLD/HLDA) are used to access external memory. derstanding on the operation of the 80C51BH, the
The DMA channels are capable of addressing up to reader should familiarize himself with the entire MCS-
64K bytes (16 bits). The destination or source address 51 chapter of the Embedded Controller Handbook.
!;an be automatically incremented. The lower 8 bits of
the address are multiplexed on the data bus Port 0 and Another source of information that the reader may find
the upper eight bits of address will be on Port 2. Data is helpful is Intel's LAN Components User's Manual, or-
transmitted over an 8-bit address/data bus. Up to 64K . der number 230814. Inside are descriptions of various
bytes of data may be transmitted for each DMA activa- protocols, application examples, and application notes
tion. dealing with different serial communication environ-
ments.
The new I/O port (P4) functions the same as Ports 1-3,
found on the 80C51BH.
2.0 COMPARISON OF 80C152 AND
Internal memory has been doubled in the 83C152. Data 80C51BH FEATURES
memory has been expanded to 256 bytes, and internal
program memory has been expanded to 8K bytes.
2.1 Memory Space
There are also some specific differences between the A good understanding of the memory space and how it
83CI52 and the 80C51BH. The first is that the number- is used in the operation of MCS-51 products is essen-
ing system between the 83CI52 and the 80C5IBH is tial. All the enhancements on the CI52 are implement-
slightly different. The 83CI52 and the 80C5IBH are ed by accessing Special Function Registers (SFRs),
factory masked ROM devices. The 80CI52 and the added data memory, or added program memory.
80C3IBH are ROMless devices which require the
8-1
P4.0-P4.7 PO .0- PO.7
l
SARLI
SARHI
DARL1
DARHI
BCRL1 :t:
~
::u
c
:e~
"'1'1 ::u
c· m
......
c::
III
C
m
en
:.. n
(Xl ID
::u
N n0" =ti
-4
7<: (5
C Z
..
iii'
eD
III
o."
-4
3
~"
:t:
m
CI)
Co)
....n
U1
N
CRC
GENERATOR
ADRO-3
BAUD TCDCNT
2.1.1 SPECIAL FUNCTION REGISTERS (SFRs) (IDA), Source Address Space bit (SAS). Increment
~ource Address bit (ISA), DMA Channel Mode bit
The following list contains all the SFRs, their names (DM), Transfer Mode bit (TM), DMA Done bit
and function. All of the SFRs of the 80C51BH are reo (DONE), and the GO bit (GO). DCONO is used to
tained and for a detailed explanation of their operation, control DMA Channel O.
please refer to the chapter, "Hardware Description of
the 8051 and 8052" that is found in the Embedded DCONI - (93H) Same as DCONO except this is for
Controller Handbook. An overview of the new SFRs is DMA Channel 1.
found in Section 2.2.1.1, with a detailed explanation in
Section 3.7 and Section 4.5. GMOD - (84H) Contains the Protocol bit (PR). the
Preamble Length (PLI.O), CRC Type (CT). Address
Length (AL). Mode select (Ml.0), and External Trans-
2.1.1.1 New SFRs mit Clock (TXC). This register is used for GSC opera-
The following descriptions are quick overviews of the tion only.
new SFRs, and not intended to give a complete under- IENI - (OC8H) Interrupt enable register for DMA and
standing of their use. The reader should refer to the GSC interrupts. .
detailed explanation in Section 3 for the GSC SFRs,
and Section 4'for the DMA SFRs. IFS - (OA4H) Determines the number of bit times sepa-
rating transmitted frames.
ADR 0,1,2,3 - (95H, OA5H, OBSH, OCSH) Contains
the four bytes for address matching during GSC opera- IPNI - (OF8H) Interrupt priority register for DMA
tion. and GSC interrupts.
AMSKO - (OD5H) Selects "don't care" bits to be used MYSLOT - (OFSH) Contains the Jamming mode bit
with ADRO. (DCJ). the Deterministic Collision Resolution Algo-
rithm bit (DCR). and the DCR slot address for the
AMSKI - (OESH) Selects "don't care" bits to be used GSC.
with ADRI.
P4 - (OCOH) Contains the memory "image" of Port 4.
BAUD - (94H) Contains the programmable value for
the baud rate generator for the GSC. The baud rate will PRBS - (OE4H) Contains a pseudo-random number to
equal (fosc)/«BAUD + I) X 8). be used in CSMA/CD backoff algorithms. May be read
or written to by user software.
BCRLO - (OE2H) Contains the low byte of a count-
down counter that determines when the DMA access RFIFO - (F4H) RFIFO is used to access a 3-byte FIFO
for Channel 0 is complete. that contains the receive data from the GSC.
BCRHO - (OE3H) Contains the high byte for count- RSTAT - (OE8H) Contains the Hardware Based Ac·
down counter for Channel O. knowledge Enable bit (HABEN), Global Receive En-
able bit (GREN). Receive FIFO Not Empty bit
BCRLl - (OF2H) Same as BCRLO except for DMA (RFNE). Receive Done bit (RDN). CRC Error bit
Channell. (CRCE). Alignment Error bit (AE), Receiver Colli-
BCRHI - (OF3H) Same as BCRHO except for DMA sion!Abort detect· bit (RCABT), and the Overrun bit
Channell. (OVR). used with both DMA and GSC.
BKOFF - (OC4H) An 8-bit count-down timer used SARLO - (OA2H) Contains the low byte of the source
with the CSMA/CD resolution algorithm. address for DMA transfers.
DARLO - (OC2H) Contains the low byte of the destina- SARHO - (OA3H) Contains the high byte of the source
tion address for DMA Channel O. address for DMA transfers.
DARHO - (OC3H) Contains the high byte of the desti- SARLI - (OB2H) Saine as SARLO but for DMA Chan-.
nation address for DMA Channel O. nell.
DARLI - (OD2H) Same as DARLO except for DMA SARHI - (OB3H) Same as SARHI but for DMA Chan-
Channell. nel I.
DARHI - (OD3H) Same as DARHO except for DMA SLOTTM - (OB4H) Determines the length of the slot
Channell. time in CSMA/CD.
DCONO - (92H) Contains the Destination Address TCDCNT - (OD4H) Contains the number of collisions
Space bit (DAS). Increment Destination Address bit in the current frame if using CSMA/CD GSC.
8-3
inter HARDWARE DESCRIPTION OF THE 83C152
8-4
inter HARDWARE DESCRIPTION OF THE'S3C152
TFIFO - (85H) TFIFO is used to access a 3-byte FIFO The addresses of-the second 128 bytes of data memory
that contains the transmission data for the GSC. happen to overlap the SFR addresses. The SFRs and
their memory locations are shown in Figure 2.2. This
TSTAT - (OD8H) Contains the DMA Service bit means that. internal data memory spaces have the same
(DMA), Transmit Enable bit (TEN), Transmit FIFO address as the SFR address. However, each type of
Not Full bit (TFNF), Transmit Done bit (TDN), memory is addressed differently. To access data memo-
Transmit Collision Detect bit (TCDT), Underrun bit ry above 80H, indirect addressing or the DMA chan-
(UR), No Acknowledge bit (NOACK), and the Re- nels must be used. To access the SFRs, direct address-
ceive oata Line Idle bit (LNI). This register is used ing is used. When direct addressing is used, the address
with both DMA and GSC. is the source or destination, e.g. MOY A, IOH, moves
the contents of location IOH into the accumulator.
The general purpose flag bits (GFO and GFl) that exist When indirect addressing is used, the address of the
on the 80C51BH are no longer available on the C152. destination or source exists within another register, e.g.
GFO has been renamed GFIEN (GSC Flag Idle En- MOY A, @RO. This instruction moves the contents of
able) and IS used to enable idle fill flags. Also GFI has the memory location addressed by RO into the accumu-
been renamed XRCLK (External Receive Clock En- lator. Directly addressing the locations 80H to OFFH
able) and is used to enable the receiver to be clocked will access the SFRs. Another form of indirect address-
externally. ing is with the use of Stack Poillter Operations. If the
Stack Pointer contains an address and a PUSH or POP
instruction is executed, indirect addressing is actually
2.1.2 DATA MEMORY
used. Directly accessing an unused SFR address will
Internal data memory consists of 256 bytes as shown in give undefined results.
Figure 2.1. The first 128 bytes are addressed exactly
Physically, there are separate SFR memory and data
like an 80C51BH, using direct addressing.
memory spaces allocated on the chip. Since·there are
separate spaces, the SFRs do not diminish the available
data memory space.
rv
OffH OfFH
(0)
OVERLAPPING
MEMORY
ADDRESSES
A(0)
SPECIAL FUNCTION REGISTER
SPACE
oaOH
(0)
02fH
BIT ADDRESSABLE
MEMORY SPACE
020H
01FH .,
REGISTER BANK 3
017H
REGISTER BANK 2
010H
REGISTER BANK 1
007H
REGISTER BANK 0
°NOTE:
User data memory above BOH must be addressed indirectly. Using direct addressing above BOH accesses 'the Special
Function Registers.
External data memory is accessed like an SOC51BH, 2.1.2.1 Bit Addressable Memory
with "MOVX" instructions. Addresses up to 64K may
be accessed when using the Data Pointer (DPTR). The C152 has several memory spaces in which the bits
When accessing external data memory with the DPTR, are directly addressed by their location. The directly
the address appears on Port 0 and 2. When using the addressable bits and their symbolic names are shown in
DPTR, if less, than 64K of external data memory is Figure 2.3A, 2.3B, and 2.3C.
used, the address is emitted on all sixteen pins. This
means that when using the DPTR, the pins of Port 2 Bit addresses 0 to 7FH reside in on-board user data
not used for addresses cannot be used for general pur- RAM in byte addresses 20H to 2FH (see Figure 2.3A).
pose VO. An alternative to using 16-bit addresses with
the DPTR is to use RO or Rl to address the external Bit addresses SOH to.OFFH reside in the SFR memory
data memory. When using the registers to address ex- space, but not every SFR is bit addressable, see Figure
ternal data memory, the address range is limited to 256 2.3B. The addressable bits are scattered throughout the
bytes. However, software manipulation of VO Port 2 SFRs. The addressable bits occur every eighth SFR ad-
pins as normal I/O, allows this 256 bytes restriction to dress starting at SOH and occupy the entire byte. Most
be expanded via bank switching. When using RO or Rl of the bits that are addressable in the SFRs have been
as data pointers, Port 2 pins that'are not used for ad- given symbolic names. These names will often be re-
dressing, can be used as general purpose I/O. ferred to in this or other documentation on the C152.
Most assemblers also allow the use of the symbolic
names when writing in assembly language. These
names are shown in Figure 2.3C.
8-6
inter HARDWARE DESCRIPTION OF THE 83C152
8-7
HARDWARE DESCRIPTION OF THE 83C152
1--------I1FFFH'
EXTERNAL IF U; =0
INTERNAL IF EA =1
' - - - - - - - - " ' OOOOH
270427·4
8-8
inter HARDWARE DESCRIPTION OF THE 83C152
2.2 Interrupt Structure added SFRs are IENI (CSH) for enabling the inter-
rupts and IPNI (FSH) for setting the priority. For an
The CI52 retains all five interrupts of the SOC5IBH. In explanation on how the priority of interrupts affects
addition, six new interrupts have been added for a total their operation please refer to the MCS-51 Architecture
of II available interrupts. Two SFRs have been added and Hardware Chapters in the Intel Embedded Con-
to the CI52 for control of the new interrupts. These troller Handbook.
IEN1 FUNCTIONS
Symbol Position Vector Function
- IEN1.7 RESERVED and do not exist on Chip.
- IEN1.6 RESERVED and do not exist on chip.
EGSTE IEN1.5 04BH GSC TRANSMIT ERROR-If TSTAT.O (DMA) is cleared, the
interrupt service routine at 4BH is invoked when TSTAT.6
(NOACK) or TSTAT.4 (TCDT) is set and EGSTE is enabled. If
TSTAT.O (DMA) is set, the interrupt service routine will be
invoked when the TSTAT.5 (UR) is set and EGSTE.is enabled.
EDMA1 IEN1A 053H DMA CHANNEL REQUEST 1-The interrupt service routine
at53H is invoked when DCON1.1 (DONE) is set and EDMA 1 is
enabled.
EGSTV IEN1.3 043H GSC TRANSMIT VALID-If TSTAT.O (DMA) is cleared, the
interrupt service routine at 43H is invoked when TSTAT.2
(TFNF) is set and EGSTV is enabled. If TSTAT.O (DMA) is set,
the interrupt service routine will be invoked when TSTAT.3
(TDN) is set and EGSTV is enabled.
EDMAO IEN1.2 03BH DMA CHANNEL REQUEST ~The interrupt service routine
at 3BH will be invoked when DCONO.1 (DONE) is set and
EDMAO is enabled.
EGSRE IEN1.1 033H GSC RECEIVE ERROR-The interrupt service routine at 33H
will be invoked when RSTATA (CRCE), RSTAT.7 (OVR),
RSTAT.6 (RCABT), or RSTAT.5 (AE), is set and EGSRE is
enabled. This functions the same whether or not TSTAT.O
(DMA) is set.
EGSRV IEN1.0 02BH GSC RECEIVE VALID-If TSTAT.O (DMA) is cleared, the
interrupt service routine at 2BH will be invoked when RSTAT.2
(RFNE) is set and EGSRV is enabled. If TSTAT.O (DMA) is
set, the interrupt service routine will be invoked when
RSTAT.3 (RDN) is set and EGSRV is enabled.
IPNI is used the same way the current SOC5IBH interrupt priority register (IP) is. By assigning a "I" to the
appropriate bit, that interrupt has a higher priority than an interrupt with a "0" assigned to it in the priority register.
8-9
intJ HARDWARE DESCRIPTION OF THE 83C152
The eleven interrupts are sampled in the following order when assigned the same priority level in the IP and IPNI
registers:
Priority Priority Interrupt Interrupt
Priority Symbolic Symbolic Symbolic Symbolic Vector
Sequence Address Name Address Name Address
1 IP.O PXO lE.O EXO 03hi (FIRST)
2 IPN1.0 PGSRV IEN1.0 EGSRV 2BH
3 IP.1 PTO 1E.1 ETO OBH
4 IPN1.1 PGSRE IEN1.1 EGSRE 33H
5 IPN1.2 PDMAO IEN1.2 EDMAO 3BH
6 IP.2 PX1 IE.2 EX1 13H
7 IPN1.3 PGSTV IEN1.3 EGSTV 43H
8 IPN1.4 PDMA1 IEN1.4 EDMA1 53H
9 IP.3 PT1 1E.3 ET1 1BH
10 IPN1.5 PGSTE IEN1.5 EGSTE 4BH
11 IP.4 PS IE.4 ES 23H (LAST)
2.3 Reset
RESET performs the same operations in both the 80C5lBH and the Cl52 and those conditions that exist at the end
of a valid RESET are:
Register Contents Register Contents
ACC OOH PO-P4 OFFH
ADRO-3 OOH PCON OXXXOOOOB
AMSKO OOH PRBS bOH
AMSK1 OOH PSW OOH
B OOH RFIFO INDETERMINATE
BAUD OOH RSTAT OOOOOOOOB
BCRHO INDETERMINATE SARHO INDETERMINATE
BCRH1 INDETERMINATE SARH1 INDETERMINATE
BCRLO INDETERMINATE SARLO INDETERMINATE
CRL1 INDETERMINATE SARL1 INDETERMINATE
BKOFF INDETERMINATE SBUF INDETERMINATE
DARHO INDETERMINATE SCON OOH
DARH1 INDETERMINATE SLOTTM OOH
DARLO INDETERMINATE SP 07H
DARL1 INDETERMINATE TCDCNT INDETERMINATE
DCONO OOH TCON / OOH
DCON1 OOH TFIFO INDETERMINATE
DPTR OOOOH THO OOH
GMOD XOOOOOOOB TH1 OOH
IE OXXOOOOOB TLO OOH
IEN1 XXOOOOOOB TL1 OOH
IFS OOH TMOb OOH
IP XXXOOOOOB TSTAT XXOO0100B
IPN1 XXOOOOOOB PC OOOOH
MYSLOT OOOOOOOOB
8-10
HARDWARE DESCRIPTION OF THE 83C152
The same conditions apply for both the 80C5lBH and 2.6 Package
C152 for a correct reset pulse or "power-on" reset ex-
cept that Reset is active low on the C152. Please refer
to the 8051/52 Hardware Description Chapter of the
a
The 83Cl52 is packaged in 48 pin DIP and a 68 lead
PLCC. This differs from the 40 pin DIP and 44 pin
Intel Embedded Controller Handbook for an explana- PLCC of the 80C51BH. The larger package is required
tion on how to provide a proper power-on reset. Since to accommodate the extra 8 bit I/O port (P4). Figure
Reset is active low on the C152, the resistor should be 2.5A and 2.5B show the packages and the pin names.
tied to VCC and the capacitor should be tied to VSS.
8-11
inter HARDWARE DESCRIPTION OFTHE'83C152
INDEX
CORNER'\..
"l "': "'! OJ "!
Ii: Ii: Ii: Ii: Ii: Ii: >'"
g~ c..i <i
'" > z Z z
<i
Z
. :;; . ... ....
0
0. 0.
N
0.
"'!
0. 0.
Pl.6 10 P4.S
Pl.7 11 P4.6
N.C. 12 P4.7
13 N.C.
P3.0 14 EA
P3.1 15 ALE
P3.2 16 PSEN
N.C. 17 N.C.
80C152
P3.3 18 83C152 N.C.
P3.4 19 N.C.
N.C. N.C.
N.C. N.C.
N.C. P2.7
P3.5 P2.6
P3.6 P2.5
P3.7 P2.4
N.C. P2.3
"! N
'" N ~
'""' ...0 . on
'" ...
c..i c..i c..i 0 N
Z ,z Z oi
..J ..J
0 ci ci ci > ci Q.
ci ci oi Q.
oi
Q. Q. Q. Q. ~ ~ Q. 0. Q. Q. Q.
X x
270427-6
PIN DESCRIPTION
Pin
Description
Name
VSS Circuit ground potential.
VCC Supply voltage during normal, Idle, and Power down operation.' Nominally + 5V
...L 04nOI
.L lV-tO.
XTAL1 Input to the inverting oscillator amplifier. Also serves as the input for using an
external Clock signal.
XTAL2 Output from the oscillator amplifier.
PORTO ' Port 0 is an 8-bit open drain bi-directional 1/0 port. Port 0 pins that have 1s written to
them float and in that state can be used as high-impedance inputs. Port 0 is also the
multiplexed low-order address and data bus during accesses to external Program
and Data Memory: In this application it uses strong internal pullups when emitting
1s. Port 0 also outputs the code bytes during program verification in the 83C152.
External pullups are required during program verification.
PORT 1 Port 1 is an 8-bit bi-directionall/O port with internal pullups. Port 1 pins that have 1s
written to them are pulled high by the internal pullups, and in that state can be used
as inputs. As inputs, Port 1 pins that are externally being pulled low will source
current because of the internal pull ups. Port 1 also has the following special
functions and for the special functions to operate a "1" has to be written to that pin
first.
8-12
inter HARDWARE DESCRIPTION OF THE 83C152
8-13
intJ HARDWARE DESCRIPTION OF THE 83C152
8-14
HARDWARE DESCRIPTION OF THE 83C152
Table 3.1
ADDRESS
DATA DU· ACKNOW- RECOG- PRE-
ENCODING FLAGS CRC PLEX LEDGE NITION BACKOFF AMBLE
M N N 0 1 N 1 3 H F N H U N 8' 1 N A D N 8
A R R 1 1 0 6 2 A U 0 A S 0 B 6 0 L E 0 B
N=NOT AVAILABLE N Z Z 1 / N B B L L N R E N I B R T T N I
M=MANDATORV C I 1 I E I I F L E D R E T I M E E E T
O=OPTIONAL H 1 D T T W D / T A R R
P = NORMALLV PREFERRED E 1 L C A A E A L N M
X=N/A S 1 E C U R F L A I
T 0 I T E I L T N
E T 0 N E I
R E S
D T
I
C
DATA ENCODING:
MANCHESTER(CSMA/CD) X N N 1 P 1 0 0 M N 0 0 0 0 0 0 0 0 0 N 0
NRZI (SDLC) N X N P 1 1 0 0 0 0 0 N P 0 0 0 N N N 0 0
'. NRZ (EXT CLK) N N X 0 0 1 0 0 0 0 0 N 0 0 0 0 0 0 0 0 0
FLAGS:Ollllll0 (SDLC) N P 0 X 1 1 0 0 0 0 0 N P 0 0 0 N N N 0 0
11/IDLE P N 0 1 X 1 0 0 0 N 0 0 0 0 0 0 0 0 0 1 0
CRC:NONE 1 1 1 1 1 X N N 1 N 1 1 1 1 1 1 N N N 1 1
l6-BITCCITI 0 0 0 0 0 N X N 0 0 0 0 0 0 0 0 0 0 0 0 0
32-BIT AUTODIN II 0 0 0 0 0 N N X 0 N 0 0 0 0 0 0 0 0 0 0 0
DUPLEX:HALF 0 0 0 0 0 1 0 0 X N 0 0 0 0 0 0 0 0 0 0 0
FULL N 0 0 M N N M N N X 0 N P 0 0 0 N N N 0 0
ACKNOWLEDGEMENT:NONE 0 0 0 0 0 1 0 0 0 0 X N N 0 0 0 0 0 0 0 0
HARDWARE 0 N N N 0 1 0 0 0 N N X N 0 0 0 N 0 0 N 0
USER DEFINED 0 P 0 0 0 1 0 0 0 P N N X 0 0 0 0 0 0 0 0
ADDRESS RECOGNITION:
NONE/ALL 0 0 0 0 0 1 0 0 0 0 0 0 0 X N N 0 0 0 0 0
8-BIT 0 0 0 0 0 1 0 0 0 0 0 0 0 N X N 0 0 0 0 0
l6-BIT 0 0 0 0 0 1 0 0 0 0 0 0 0 N N X 0 0 0 0 0
COLLISION RESOLUTION:
NORMAL \
0 N 0 N 0 N 0 0 M N 0 N 0 0 0 0 X N N N 0
ALTERNATE O' N 0 N 0 N 0 0 M N 0 0 0 0 0 0 N X N N 0
DETERMINISTIC 0 N 0 N 0 N 0 0 M N 0 0 0 0 0 0 N N X N 0
PREAMBLE:NONE N 0 0 0 1 1 0 0 0 0 0 N 0 0 0 0 N N N X N
8-BIT 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 N X
32-BIT 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 N N
64-BIT 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 N N
JAM:D.C. M N N N 0 N 0 0 M N 0 0 0 0 0 0 0 0 0 N 0
CRC M N N N 0 N 0 0 M N 0 0 0 0 0 0 0 0 0 N 0
CLOCKING:EXTERNAL N M .N 0 0 N 0 0 0 0 0 N 0 0 0 0 N N N 0 0
INTERNAL 0 0 N 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CONTROL: CPU 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RAW RECEIVE: 1 1 1 1 1 1 1 1 1 N 1 1 1 1 1 1 0 0 0 1 1
RAW TRANSMIT: 1 1 1 1 1 1 1 1 1 N 1 1 1 1 1 1 N N N 1 1
CSMAlCD: 0 N 2 1 P 1 0 0 M N 0 0 0 0 0 0 0 0 0 N 0
SDLC: N 0 0 P 1 1 0 0 0 0 0 N 0 0 0 0 N N N P 0
8-15
HARDWARE DESCRIPTION OF THE 83C152
8·16
HARDWARE DESCRIPTION OF THE 83C152
Note 1: Programmable in Raw transmit or receive of collision resolution made available to the user on the
mode. C152. Re-transmission is attempted when a resolution
algorithm indicates that a station's opportunity has ar-
Note 2: When CSMA/CD is enabled, an external clock rived.
can be used on the transmitter, but not the receiver.
Since the receiver monitors the link for Manchester vio- Normally, in CSMA/CD, re-transmission slot assign-
lations, external hardware would be required to refor- ments are intended to be random. This method gives all
mat the data from NRZ to Manchester on the transmit- stations an equal opportunity to utilize the serial com-
ter. These hardware requirements go beyond the expec- munication link but also leaves the possibility of anoth-
tations of this table for implementation. For that reason er collision due to two stations having the same slot
it was assumed that the external clock cannot be used assignment. There is an option on the C152 which al-
at all with CSMA/CD protocol, although it is actually lows all the stations to have their slot assignments pre-
possible to do so. viously determined by user software. This pre-assign-
ment of slots is called the deterministic resolution
Almost all the options available from Table 3.1 can be mode. This method allows resolution after the first col-
implemented with the proper software to perform the lision and ensures the access of the link to each station
functions that are necessary for the options selected. In during the resolution. Deterministic resolution can be
Table 3.1, a judgment has been made by the authors on advantageous when the link is being heavily used and
which options are practical and which are not. What collisions are frequently occurring and in real time ap-
this means is that in Table 3.1, an UN" should be inter- plications where determinism is required. Deterministic
preted as meaning that the option is either not practical resolution may also be desirable if it is known before-
when implemented with user software or that it cannot hand that a certain station's communication needs to be
be done. An "0" is used when that function is one of prioritized over those of other stations if it is involved
several that can be implemented with the GSC without in a collision.
additional user software.
The GSC is targeted to operate at bit rates up to 2.4 3.2.2 CSMAlCD FRAME FORMAT
MBps using the external clock options and up to 2 The frame format in CSMA/CD consists of a pream-
MBps using the internal baud rate generator, internal ble, Beginning of Frame flag (BOF), address field, in-
data formatting and on-chip clock recovery. The baud formation field, CRC, and End of Frame flag (EOF) as
rate generator allows most standard rates to be shown in Figure 3.1.
achieved. These standards include the proposed
IEEE802.3 LAN standard (1.0MBps) and the T1 stan-
dard (1.544MBps). The baud rate is derived from the IPREAMBLE IBOF IADDRESS IINFO ICRC IEOF I
crystal frequency. This makes crystal selection impor- Figure 3.1 Typical CSMA/CD Frame
tant when determining the frequency and accuracy of
the baud rate. PREAMBLE - The preamble is a series of alternating
Is and Os. The length of the preamble is programmable
to be 0, 8, 32, or 64 bits. The purpose of the preamble is
3.2 CSMA/CD Operation to allow all the receivers to synchronize to the same
clock edges and identifies to the other stations on-line
3.2.1 CSMA/CD OVERVIEW that there is activity indicating the link is being used.
For these reasons zero preamble length is not compati-
CSMA/CD operates by sensing the transmission line ble with standard CSMAlCD, protocols. When using
for a carrier, which indicates link activity. At the end of CSMAlCD, the BOF is considered part of the pream-
link activity, a station must wait a period of time, called ble compared to SDLC, where the BOF is not part of
the deference period, before transmission may begin. the preamble. This means that if zero preamble length
The deference period is also known as the interframe were to be used in CSMA/CD mode, no BOF would be
space. The interframe space is explained in Section generated. It is strongly recommended that zero pream-
3.2.3. ble length never be used in CSMA/CD mode. If the
preamble contains two consecutive Os, the preamble is
With this type of operation, there is always the possibil- considered invalid. If the C152 detects an invalid pre-
ity of a collision occurring after the deference period amble, the frame is ignored.
due to line delays. If a collision is detected after trans-
mission is started, a jamming mechanism is used to en- BOF - In CSMA/CD the Beginning-Of-Frame is a part
sure that all stations monitoring the line are awar,e of of the preamble and consists of two sequential Is. The
the collision. A resolution algorithm is then executed to purpose of the BOF is to identify the end of the pream-
resolve the contention. There are three different modes ble and indicate to the receiver(s) that the address will
immediately follow.
8-17
HARDWARE DESCRIPTION OF THE 83C152
ADDRESS - The address field is used to identify which algorithm can be used but IEEE 802.3 uses a 32-bit
messages are iIi.tended for which stations. The user CRC. The generation polynomial the CI52 uses with
must assign addresses to each destination and source. the 32-bit CRC is:
How the addresses are assigned, how they are main- G(X) = X32 + X26 + X23 + X22 +X16 + XI2 +
tained, and how each transmitter is made aware of , . XII + XIO + X8 + X7 + X5 + X4 + X2
which addresses are available is an issue that is left to .+ X + I
the user. Some suggestions are discussed in Section
3.5.5. Generally, each address is unique to each station The CRC generator, as shown in Figure 3.2, operates
but there are special cases where this is not true. In , by taking each bit as it is received and XOR'ing it with
these special cases, a message is intended for more than bit 31 of the current eRC. This result is then placed in
one station. These multi-targeted messages are called temporary storage. The result of XOR'ing bit 31 with
broadcast or multicast-group addresses. A broadcast the received bit is then XOR'd with bits 0, I, 3, 4, 6, 7,
address consisting of all Is will always be received by 9, 10, 11, 15,21,22,25 as the CRC is shifted right one
all stations. A multicast-group address usually is indi- position. When the CRC is shifted right, the temporary
cated by using a las the first address bit. The user can storage space holding the result of XOR'ing bit 31 and
choose to mask off all or selective bits of the address so the incoming bit is shifted into position O. The whole
that the GSC receives all messages or multicast-group process is then repeated with the next incoming or out-
messages. The address length is programmable to be 8 going bit. .
or 16 bits. An address consisting of all Is will always be
received by the GSC on the C152. The address bits are The usei' has no access to the CRC generator or the bits
always passed from the GSC to the CPU. With user which constitute the CRC while in CSMAlCD. On
software, the address can be extended beyond 16 bits, transmission, the CRC is automatically appended to
but the automatic address recognition will only work the data being sent, and on reception, the CRe bits are
on a maximum of 16 bits. User software will have to not normally loaded into the receive FIFO. Instead,
resolve any remaining address bits. they are automatically stripped. The only indication the
user has for the status of the eRC is a pass/fail flag.
INFO - This is the information field and contains the The pass/fail flag only operates during reception. A
data that one device on the link wishes to transmit to CRC is considered as passing when the the CRC gener-
another device. It can be of any length the user wishes ator has 1100011100000100 11011010 011110IlB as a
but needs to be in multiples of 8 bits. This is because remainder after all of the data, including the CRe
multiples of 8 bits are used to transfer data into or out checksum, from the transmitting station has been cy-
of the GSC FIFOs. The information field is delineated cled through the CRC generator. The preamble, BOF
from the rest of the components of the frame by the and EOF are not included as part of the CRC algo-
preceding address field and the following CRC.. The rithm. An interrupt is available that will interrupt the
receiver determines the position of the end of the infor- CPU if the CRC of the receiver is invalid. The user can
mation field by passing the bytes through a temporary enaole the CRC to be passed to the CPU by placing the
storage space. When the EOF is received the bytes in receiver in the raw receive mode.
temporary storage are the CRC, and the last bit re-
ceived previous to the CRC constitute the end of the This method of calculating the CRC is compatible with
information field. IEEE 802.3.
CRC - The Cyclic Redundancy Check (CRC) is an er- EOF - The End Of Frame indicates when the transmis-
ror checking algorithm commonly used in serial com- ,ion i, comnleted. The end flag in CSMA/CD consists
municationS. The CI52 offers two types of CRC algo- ~i an idle c~ndition. An idle c;ndition is assumed when
rithms, a 16-bit and a 32-bit. The 16-bit algorithm is there is no transitions and the link remains high for 2 or
normally ~sed in the SDLC mode and will be described more bit times.
in the SDLC section. In CSMAlCD applications either
8-18
HARDWARE DESCRIPTION OF THE 83C152
270427-8
3.2.3 INTER FRAME SPACE around period is the amount of time that is needed by
user software to complete the handling of a received
The interframe space is the amount of time that trans- frame and be prepared to receive the next frame. An
mission is delayed after the link is sensed as being idle interframe space smaller than the required tum-around
and is used to separate transmitted frames. In alternate period could be used, but would allow some frames to
backoff mode, the interframe space may also be includ- be missed.
ed in the determination of when retransmissions may
actually begin. The C152 allows programmable inter- When a GSC transmitter has a new message to send, it
frame spaces of even numbers of bit times from 2 to will first sense the link. If activity is detected, transmis-
256. sion will be deferred to allow the frame in progress to
complete. When link activity ceases, the station contin-
The period of the interframe space is determined by the ues deferring for one interframe space period.
contents of IFS. IFS is an SFR that is programmable
from 0 to 254. The interframe space is measured in bit As mentioned earlier, the interframe space is used dur-
times. The value in IFS mUltiplied by the bit time ing the collision resolution period as well as during nor-
equals the interframe space unless IFS equals O. If IFS mal transmission. The backoff method selected affects
does equal 0, then the interframe space will equal 256 how the deference period is handled during normal
bit times. One of the considerations when loading the transmission. If normal backoff mode is selected, the
IFS is that only even numbers (LSB must be 0) can be interframe space timer is reset if activity occurs during
used because only the 7 most significant bits are loaded approximately the first half of the interframe space. If
into IFS. The LSB is controlled by the GSC and deter- alternate backoff or. deterministic backoff is selected,
mines which half of the IFS is currently being used. In the timer is not reset. in all cases whe~ the interframe
some modes, the interframe space timer is re-triggered space timer expires, transmission may begin, regardless
if activity is detected during the first half of the period. if there is activity 'on the link or not. Although the
The GSC determines which half of the interframe space C152 resets the interframe space timer if activity is de-
is currently being used by examining the LSB. A one tected during the first one-half of the interframe space,
indicates the first half and zero indicates the second this is not necessarily true of all CSMA/CD systems.
half of the IFS. (IEEE 802.3 recommends that the interframe space be
reset if activity is detected during the first two-thirds or
After reset IFS is 0, which delays the first transmission less of the interframe space.)
for both SDLC and CSMA/CD by 256 bit times (after
reset, a bit time equals 8 oscillator clock periods).
3.2.4 COLLISION RESOLUTION
In most applications, the period of the interframe space The method used to resolve a collision is called the
will be equal to or greater than the amount of time backoff algorithm.
needed to tum-around the' received frame. The turn-
8-19
HARDWARE DESCRIPTION OF THE 83C152
How the backoff algorithm executes is dependent on A collision is assumed if a pulse is less than three sam-
which part of the frame the collision was detected in. ple periods in length or if an. expected transition is
How collisions are detected is shown in Figure 3.3. If missed. Figures 3.3A and B show where transition must
the collision occurred before data has been loaded into occur and where transitions are invalid. The sample
the Receive FIFO, then reception' is simply stopped. . periods occur at a rate that is 8 times the baud rate as
determined by the SFR BAUD.
The time when the first byte is loaded into the Receive
FIFO is dependent on the CRC length. After detection During transmission, each device monitors its own
of the BOF flag, all subsequent data is passed through. transmission pin with its receive circuitry. A collision is
the CRC stripping/generation hardware. Also,there is assumed if the receiver detects Manchester encoding
an additional delay of 8 bit times, as the Receive FIFO violations as defined in Figures 3.3A and B.
operates with only eight bit quantities. This means that
after the BOF, there is a 24(40) bit time delay before Where the collision occurs determines what actions are
data is loaded into the Receive FIFO if the 16(32) bit taken. If the collision occurs after the preamble, the
CRC is selected. If the collision occurs after data has Timer Collision Detect (TCDT) bit is set. If the Enable
been loaded into the receive FIFO, then .the error flag Global Serial Transmit Error (EGSTE) interrupt
Receiver Abort (RCABT) is set and REN cleared. This (lEN 1. 5) is enabled, the CPU is interrupted. If this type
prevents another reception while the CPU tries to fig- of collision occurs, user software must determine what
ure out what to do next. If the Enable Global Serial actions to take for a proper recovery.
(channel) Receive Error (EGSRE) interrupt (IENl.l)
is enabled the CPU is interrupted. At this time user If the transmitting station detects the collision during
software must decide what actions to take to assure a the preamble or BOF, the actions taken are automatic.
proper recovery. The transmitter will attempt resolution up to eight
tries. After the eighth attempt, the error flag (TCDT) is
set. If EGSTE is enabled, the CPU is then interrupted.
LOGICAL o
VALUE
1. o o
MANCHESTER
ENCODING
.
".,. - - - "1" BIT, TIME - - - -.....
".:..'- - "0" BIT TIME - - - -..
"
(8 X BAUD) ,
R.ECEIVt
SAMPLING
RATE
INVALID
MANDATORY TRANSITION
270427-9
LOGICAL o
VALUE
o
MANCHESTER
ENCODING
,,>----
...
.
"1" BIT TIME - - - - - - - - - - "1" BIT TIME - - - -..
"
(8 X BAUD) ,
RECEIVE
SAMPLING'
RATE
INVALID
MANDATORY TRANSITION
OPTIONAL TRANSITION
270427-10
When a transmitting GSC detects a collision, the first algorithm is used. These methods are .named: "Normal
action taken is to apply a jamming signal to the link. Backoff", "Alternate Backoff", and "Deterministic
The jam is sent following the end of the preamble, or Backoff".
immediately if the preamble has already .been complet-
ed. This action is taken to insure that other stations on Before going into detail on the various backoff schemes,
the link are aware that a collision has occurred. there is a parameter called the slot time that must be
understood by the user. The slot time is used during the
The jamming signal can be one of two types, D.C. or collision resolution and is the basic scheduling quantum
CRC. D.C. jam is selected by setting the DCI bit for retransmission once a collision is detected. The slot
(MYSLOT.7). The D.C. jam applies a continuous low time also represents the maximum length of a collision
level signal for a duration equal to the CRC length. To fragment and the upper bound on the acquisition time
select the CRC type of jam, the DCJ bit needs to be of the network. The value of the slot time is determined
cleared. CRC is selected after the C152 is reset. The by the contents of SLOTTM. SLOTTM is programma-
CRC,jam operates by taking the current CRC calculat- ble from b to 255. A slot time is equal to 256-SLOTTM
ed up to that point, inverting the data and applying that multiplied by the bit time,unless SLOTTM equals o. If
signal to the. link. o is used in SLOTTM, th~n the slot time period will
equal 256 bit times.· A bit time is equal to Ilbaud rate.
After applying the jam, the resolution phase is next. The timing requirements on the slot time is that it be
This phase will effect the throughput and efficiency of equal to, or greater than the longest round-trip propa-
the link once a collision is detected. There are three gation time of the signal plus the jam time. The jam
methods to choose from that determine which backoff time is equal to the CRC length.
8-21
intJ HARDWARE DESCRIPTION OF THE 83C152
Normal and Alternate CSMA/CD Modes In alternate mode the backoff time begins immediately
at the end of an interframe space after the jam. If alter-
In the Normal and Alternate Normal resolution modes, nate backoff is used then the slot time does not occur
the slot position assigned .to a station is determined by unin after the interframe space expires as shown in Fig-
the SFR, Pseudo Random Binary Sequence (PRBS). ure 3.4. This mode will usually be used when the inter-
The PRBS generates a random number by using a se- frame space is longer than the slot time. This prevents
ries of feedback shift registers that are clocked by the the situation where the slot time expires before the in-
CPU phase clocks. terframe space period. This preserves the bandwidth of
the collision resolution by insuring that each station is
There is a maximum physical limit of 256 slot positions allowed up to 8 re-attempts at transmission. Networks
available. The slot assigned is derived from PRBS dur- where the slot time is less than the interframe space
ing the resolution phase of a collision. But the value in generally exist where there is a short topology, or high
PRBS is ANDed' with the contents of TCDCNT. The data rates are used.
way TCDCNT operates is that as collisions occur,
TCDCNT shifts left one bit position and a 1 is shifted
into the LSB. As TCDCNT is filled with Is from colli- Deterministic Collision Resolution
sions, the maximum range of slot assignments also in- In Deterministic Collision Resolution, when a collision
creases by powers of 2. This variable upper limit is de- occurs, all stations enter a special mode, whether or not
termined by the number of collisions, but can never be they were involved in the collision. The resolution p~ri
greater than 255. The PRBS maximum value will be od is divided into a programmable number of slots With
(2**n)-I, where n is the number. of pre~?usly a~ each station having a unique slot assignment. The first
tempted transmissions that resulted In a colliSion. This slot starts after one interframe space. A station is al-
means that on the first re-transmission, the PRBS value lowed to start transmitting only during its own slot and
could be 0 or I, on the second re-transmission the will transmit as long as it needs to unless some error
PRBS could be any value from 0 to 3, and on the eighth occurs. After any transmission, one interframe expires
collision PRBS could be any value from 0 to 255. There before the next slot begins. If no collision occurs, the
is no way that the user software can get access to the protocol operates as in regular CSMA/CD mode.
slot position assigned to a station once the backoff pro-
cess has started. This method operates as follows. The user software as-
signs each station its own slot position and loads it in
The backoff can be programmed to start either at the the SFR, MYSLOT. That station has to wait a number
end of the jam, as in Ethernet, or at the end of the of slot times equal to (maximum number of slots) -
interframe space. (MYSLOT). Only the lower six bits of MYSLOT are
used for slot assignment. This means that when using
In normal mode the backoff time begins immediately at
deterministic resolution, a maximum of 63 stations in
the end of the jam. The slot time begins as soon as the . the network can participate in any collision resolution.
jam is completed but must wait until at le~t one int~r Another station may be added to the network, but not
frame space has completed before attemptIng transnus- allowed to participate in a resolution. That station
sion. Slot 0 is the first to occur, followed by Slot 1 and should have 0 as its assigned slot. This prevents the
so on. This means the lowest slot number assigned will station from attempting to retransmit during the colli-
win control of the link as long as the slot time ends sion resolution. When using deterministic resolution,
after the the interframe space expires. In networks the PRBS must be disabled. By writing OFFH into the
where the slot time is longer than the interframe space, PRBS, it is frozen into an all Is st.at.e. The maximum
normal backoff will usually be implemented. This is number of stations that may be involved in the resolu-
because the interframe space time will expire before tion is loaded into TCDCNT. The slot count does not
Slot 0 is complete. This is shown in Figure 3.4. In net- .
begin until the receiver senses that the line is idl~ and
works where the interframe space is longer than the slot
one interframe space expires. At the end of the Inter-
time, Slot 0 will expire before the interframe space and frame space the GSC starts counting the slots. Alter-
will not be able to transmit during that resolution at- nate backoff mode should be selected whenever deter-
tempt. Taken to an extreme where the interframe space ministic backoff mode is being used. Then, if activity is
is much larger than the slot time, it is possible that
detected on the link with deterministic backoff mode
there will be no resolution during the first couple of
selected, the GSC first waits uhtil the link is idle and
collisions because the possible number of slot times then waits until the end of the interframe space before
available will still be less than the interframe space.
the slot timer continues counting the slots. This allows
This would waste the bandwidth of the resolution by another station to transmit a pending message in its
not allowing all stations the opportunity of 8 attempts proper slot and 'each station gets an opportunity to
at retransmission.
transmit when the slot time equals the value in its
MYSLOT register.
8-22
HARDWARE DESCRIPTION OF THE 83C152
The bottom diagram of Figure 3.4 illustrates this mech- collision may attempt transmission during the resolu-
anism for a number of stations (MAX). It shows sta- tion period after an interframe space period. Determi-
tions with slot numbers (MAX-2), 2 and I transmitting nistic mode prevents this from happening because all
during the resolution period. Note the interframe space stations on the link are required to enter into the reso-
after the jam and after each transmission. After all the lution phase, whether or not they are involved in the
slot positions have been exercised, normal CSMA/CD collision. Then, a station is either allowed to transmit
operation resumes. Unless deterministic resolution is during its assigned slot or is prevented from transmit-
selected, it is possible that stations not involved in the ting during the resolution period.
~.
IFS
FIRST SLOT TIME FIRST IFS ST
~.
IFS
SLOT TIME IFS ST
SECOND SLOT TIME SLOT TIME SECOND IFS ST ST
SLOT TIME SLOT TIME SLOT TIME IFS ST Sf. ST
COLLISION- COLLISION
270427-11
(CURRENT
BACKOFF
VALUE=) ~.- - - - - - ( 5 ) . (4) (3) (2) (.) (0)
(lN~IAL =><+!_+_--:)>.j..:~:,-:-----~:~-:-:-:-::-:-:-:-:
BACKOFF j I I I I
VALUE=5): : :.... : :
I I It-, I I I I I ,
-V: ):::: :
(INI~IAL -"...c:""_+-_J.""'''' "
9ACKOFF ., Ie,
VALUE=3): : :.... : :
1,1-, I I I I
,, ,,
, ,
, ,, , , ,, , 0 ...
;:: ~ , ~
1.... '&1')1
11-11-1 ~ ~
'00 10'1'
11-11-1 ;:: , ;:: ;:: '"
;:: ;::
270427-13
8-23
inter HARDWARE DESCRIPTION OF THE 83C152
3.2.5 CSMA/CD DATA ENCODING A transmitting station with HABEN enabled expects
an acknowledge. It must receive one prior to the end of
Manchester encoding/decoding is automatically select- the interframe space, or else an error is assumed and
ed when the user software selects CSMA/CO transmis- the NOACK bit is set. Setting of the TON bit is also
sion mode (See Figure 3.5). In Manchester encoding delayed until the end of the interframe space. Collisions
the value of the bit is determined by the transition in detected during the interframe space will also cause
the middle of the bit time, a positive transition is decod- NOACK to be set.
ed as a 1 and a negative transition is decoded as a O.
The user software may enable the interrupt so that the
If the external IX clock feature is chosen the transmis- CPU is notified when TON is set. If the OSC is serv-
sion mode is always NRZ (see Section 3.5.11). Using iced by OMA, the user must time out one interframe
CSMA/CO with the external clock option is not sup- space and then check the NOACK bit or the TON bit.
ported because the data needs reformatting from NRZ
to Manchester for the receiver to be able to detect code
violations and collisions. 3.3 SOLe Operation
Hardware Based Acknowledge (HBA) is a data link SOLC is a communication protocol developed by IBM
packet acknowledging scheme that the user software and widely used in industry. It is based on a primary/
can enable with CSMA/CO protocol. It is not an op- secondary architecture and requires that each second-
tion with SOLC protocol however. ary station have a unique address. The secondary sta-
tions can only communicate to the primary station, and
In general HBA can give improved system response then, only when the primary station allows communi-
time and increased effective transmission rates over ac- cation to take place. This eliminates the possibility of
knowledge schemes implemented in higher layers of the contention on the serial line caused by the secondary
network architecture. Another benefit is the possibility station'S trying to transmit simultaneously.
of early release of the transmit buffer as soon as the
acknowledge is received. In the CIS2, SOLC can be configured to work in either
full or half duplex. When adhering to strict SOLC pro-
The acknowledge consists of a preamble followed by an tocol, full duplex is required. Full duplex is selected
idle condition. A receiving station with HABEN en- whenever a 16-bit CRC is selected. At the end of a valid
abled will send an acknowledge only if the in"oming reset thel6"bit CRC is selected. To select half duplex
address is unique to the receiving station and if the with a 16-bit CRC, the receiver must be turned off by
frame is determined to be correct with no errors. 'For user software before transmission. The receiver is
the acknowledge to be sent, ten must be set. For the turned off by clearing the OREN bit (RSTAT.l). The
transmitting· station to recognize the acknowledge receiver needs to be turned off because the address that
OREN must be set. A zero as the LSB of the address is transmitted is the address. of the secondary station'S
indicates that the address is unique and not a group or receiver. If not turned off, the receiver could mistake
broadcast address. Errors can be caused by collisions, the outgoing message as being intended for itself. When
incorrect CRC, misalignment, or FIFO overflow. The 32-bit CRCs are used, half duplex is the only method
receiver sends the acknowledge as soon as the line is available for transmission.
sensed to be idle. The l!~cr must progI1h~ the interframe
space and the preamble length such that the acknowl-
edge is completed before IFS expires. This is normally
done by programming IFS larger than the preamble.
o o o
I BIT I
- - TIME--+;
270427-14
8-24
inter HARDWARE DESCRIPTION OF THE 83C152
3.3.2 SOLC Frame Format CONTROL - The control field is used for initialization
of the system, identifying the sequence of a frame, to
The format of an SOLC frame is shown in Figure 3.6. identify if the message is complete, to tell secondary
The frame consists of a Beginning of Frame flag, Ad- stations if a response is expected, and acknowledgement
dress field, Control Field, Information field (optional), of previously sent frames. The user software is responsi-
a CRC, and the End of Frame flag. ble for insertion of the control field as the .GSC hard-
ware has no provisions for the management· of this
IBOF IADDRESS ICONTROL IINFO ICRC IEOF I field. The interpretation and formation of the control
field must also be handled by user software. The infor-
Figure 3.6. Typical SOLC Frame mation following the control field is typically used for
information transfer, error reporting, and various other
BOF - The begin of frame flag for SOLC is 01111110. functions. These functions are accomplished by the for-
It is only one of two possible combinations that have six mat of the control field. There are three formats avail-
consecutive ones in SOLC. The other possibility is an able. The types of formats are Informational, Supervi-
abort character which consists of eight or more consec- sory, or Unnumbered. Figure 3.7 shows the various for-
utive ones. This is because SOLC utilizes a process mat types and how to identify them.
called bit stuffing. Bit stuffing is the insertion of a 0 as
the next bit every time a sequence of five consecutive Is Since the user software is responsible for the implemen-
is detected. The receiver automatically removes a 0 af- tation of the control field, what follows is a simple ex-
ter every consecutive group of five ones. This removal planation on the control field and its functions. For a
of the 0 bit is referred to as bit stripping. Bit stuffing is complete understanding and proper implementation of
discussed in Section 3.3.4. All the procedures required SOLC, the user should refer to the IBM document,
for bit stuffing and bit stripping are automatically han- GA27-3093-2, IBM Synchronous Oata Link Control
. died by the GSC. General Information. Within that document, is another
list of IBM documents which go into detail on the
In standard SOLC protocol the BOF signals the start of SOLC protocol and its use.
a frame and is limited to 8 bits in length. Since there is
no preamble in SOLC the BOF is considered an entire The control field is eight bits wide and the format is
separate field and marks the beginning of the frame. determined by bits 0 and 1. If bit 0 is a zero, then the
The BOF also serves as the clock synchronization frame is an informational frame. If bit 0 is a one and bit
mechanism and the reference point for determining the 1 a zero, then it is a supervisory frame, and if bit 0 is a
position of the address and control fields. one and bit I a one then the frame is an unnumbered
frame.
AOORESS - The address field is used to identify which
stations the message is intended for. Each secondary In an informational frame bits 3,2,1 contain the se-
station must have a unique address. The primary sta- quence count of the frame being sent.
tion must then be made aware of which addresses are
assigned to each station. The address length is specified Bit 4 is the P IF (Poll/Final) bit. If bit 4 equals 1 and
as 8-bits in standard SOLC protocols but it is expand- originates from the primary, then the secondary station
able to 16-bits in the C152. User software can further is expected to initiate a transmission. If bit 4 equals 1
expand the number of address bits, but the automatic and originates from a secondary station, then the frame
address recognition feature works on a maximum of 16- is t~e final frame in a transmission.
bits.
Bits 7,6,5 contain the sequence count a station expects·
In SOLC the addresses are normally unique for each on the next transmission to it. The sequence count can
station. However, there are several classes of messages vary from OOOB to 11 lB. The count then starts over
that are intended for more than one station. These mes- again at OOOB after the value IliB is incremented. The
sages are called broadcast and group addressed frames. acknowledgement is recognized by the receiving station
An address consisting of allIs will always be automati- when it decodes bits 7,6,5 of an incoming frame. The
cally received by the GSC, this is defined as the broad- station sending the transmission is acknowledging the
cast address in SOLC. A group address is an address frames received up to the count represented in bits 7,6,5
that is common to more than one station. The GSC (sequence count-I). With this method, up to seven se-
provides address masking bits to provide the capability quential frames may be transmitted prior to an ac-
of receiving group addresses. knowledgement being received. If eight frames were al-
lowed to pass before an acknowledgement, the sequence
If desired, the user software can mask off all the bits of count would roll over and this would negate the pur-
the address. This type of masking puts the GSC in a· pose of the sequence numbers.
promiscuous mode so that all addresses are received.
8-25
HARDWARE DESCRIPTION OF THE 83C152
BIT
POSITIONS-
7 65. 4 321 o
RE¢'EPTjlON SENDING
SEQUENCE SEQUENCE
270427-15
RECEPTION SEQUENCE - The sequence expected in (the SENDING SEQUENCE portion of the control byte
in the next received frame. This also confirms correct reception of up to seven frames prior to the sequence given.
POLL/FINAL - Identifies the frame as being a polling request from the master station or the last in a series of
frames from the master or secondary;
SENDING SEQUENCE- Identifies the sequence of the frame being transmitted.
o - If bit 0 = 0 the frame. is identified as a informational format type.
INFORMATION FORMAT
-----------------~----------------------------~---------
M
POSITIONS- 7 6 5 4 3 .2 o
~R-E~C-E-P-T~:IO-N-,-po-LL-/~~--~--~~
270427-16
SUPERVISORY FORMAT
-------------~--------------------------------~-~-------
. M 7 6 5 432 1 0
POSITIONS-.--_ _·..,.--_ _,--_ _- - - . . - - - - , - -___- - - - . . . - -.....
,I.
.
COMMAND/ IpOLL/ICOMMAND/1
R~sPoNsE ViNAl·1 RESPONSE I
1 1
I I
II
270427-17
8-26
inter HARDWARE DESCRIPTION OF THE 83C152
Following the informational control field comes the in- When the mode is 10, the sending station is indicating
formation to be transferred. that its receiver is not ready to accept frames.
In the supervisory format (bits 1,0 = 0,1) bits 3,2 de- Mode 11 is an illegal mode in SDLe protocol.
termine which mode is being used.
Bits 7,6,5 represent the value of the sequence the sta-
When the mode is 00 it indicates that the receive line of tion expects when the next transfer occurs for that sta-
the station that sent the supervisory frame is enabled tion. There is no information following the control field
and ready to accept frames. when the supervisory format is used.
When the mode is 01, it indicates that previously a In the unnumbered format (bits 1,0 = 1,1) bits 7, 6, 5,
received frame was rejected. The value in the receive 3, 2 (notice bit 4 is missing) indicate commands from
count identifies which frame(s) need to be retransmit- the primary to secondary stations or requests of second-
ted. ary stations to the pritnary.
8-27
HARDWARE 'DESCRIPTION OF THE 83C152
In an unnumbered frame, information of variable rithms, a 16-bit and a 32-bit. The 32-bit algorithm is
length may follow the control field if UI is, used, or normally used in. CSMAlCD applications and is de-
information of fixed length may follow if FRMR is scribed in section 3.2.2. In most SDLC applications a
used. 16-bit CRC is used and the hardware configuration that
supports 16-bit CRC is shown in Figure 3.8; The gener-
As stated earlier, the user software is responsible for the ating polynomial that the CRC generator uses with the
proper management of the control field. This portion of 16-bit CRC is:
the frame is passed to or from the GSCFIFOs as basic
informational type data. G(X) = X"16 + X"12 + X"5 + 1
INFO - This is the information field and contains ,the The way the CRC operates is that as a bit is received it
data that,one device on the 'link' wishes to transmit to is XOR'd with bit 15 of the current CRC and placed in
another device. It can be of any length the user wishes, temporary storage. The result of XOR'ing bit 15 with
but must be a multiple of 8 bits. It is possible that some the received bit is then XOR'dwith bit 4 and bit 11 as
frames may contain no information field. The informa- the CRC is shifted one position to the right. The bit in
tion field is identified to the receiving stations by the temporary storage is shifted into position O.
preceding control field and the following CRC. The
GSC determines where the last of the information field The required CRC length for SDLC is' 16 bits. The
is by passing the bits through the CRC generator. CRC is automatically stripped from the frame and not
When the last bit or BOF is received the bits that re- passed on: to the CPU. The last 16 bits ,are then run
main constitute the CRC. though the CRC generator to insure that the correct
remainder is left. The remainder that is checked for is
CRC - The Cyclic Redundancy Check (CRC) is an er- 001110100001111B (lDOF Hex). If there is a mis-
ror checking sequence commonly used in serial com- match, an error is generated. The user software has the
munications. The C152 offers two types of CRC algo- optiqn of enabling this interrupt so the CPU is notified.
270427-19
Figure3_8_16-BitCRC
8-28
inter HARDWARE DESCRIPTION OF THE 83C152
EOF - The End Of Frame (EOF) indicates when the 3.3.5 SENDING ABORT CHARACTER
transmission is complete. The EOF is identified by the
end flag. An end flag consists of the bit pattern An abort character is one of the exceptions to the rule
01111110. The EOF can also serve as the BOF for the that disallows more than 5 consecutive Is. The abort
next frame. character consists of any occurrence of seven or more
consecutive ones. The simplest way for the CI52 to
send an abort character is to clear the TEN bit. This
3.3.3 DATA ENCODING causes the output to be disabled which, in turn, forces it
The transmission of data in SDLC mode is done via to a constant high state. The delay necessary to insure
NRZI encoding as shown in Figure 3.9. NRZI encod- that the link is high for seven bit times, is a task that
ing transmits data by changing the state of the output needs to be handled by user software. Other methods of
whenever a 0 is being transmitted. Whenever a I is sending an abort character are using the IFS register or
transmitted the state of the output remains the same as using the Raw Transmit mode. Using IFS still entails
the previous bit and remains valid for the entire bit clearing the TEN bit, but TEN can be immediately re-
time. When SDLC mode is selected it automatically enabled. The next message will not begin until the IFS
enables the NRZI encoding on the transmit line and expires. The IFS begins timing out as soon as DEN
NRZI decoding on the receive line. goes high which identifies the end of transmission. This
also requires that IFS contain a value equal to or great-
er than 8. This method may have the undesirable effect
3.3.4 BIT STUFFING/STRIPPING that DEN goes high and disables the external drivers.
The other alternative is to switch to Raw Transmit
In SDLC mode one of the primary rules of the protocol mode. Then, writing OFFH to TFIFO would generate a
is that in any normal data transmission, there will never high output for 8 bit times. This method would leave
be an occurrence of more than 5, consecutive Is. The DEN active during the transmission of the abort char-
GSC takes care of this housekeeping chore by automat- acter.
ically inserting a 0 after every occurrence of 5 consecu-
tive Is and the receiver automatically removes a zero When the receiver detects seven or more consecutive Is
after receiving 5 consecutive Is. All the necessary steps and data has been loaded into the receive FIFO, the
required for implementing bit stuffing and stripping are RCABT flag is set in RSTAT and that frame is ig-
incorporated into the GSC hardware. This makes the nored. If no data has been loaded into the receive
operation transparent to the user. About the only time FIFO, there are no abort flags set and that fraine is just
this operation becomes apparent to the user, is if the ignored. A retransmitted frame may immediately fol-
actual data on the transmission medium is being moni- Iowan abort character, provided the proper flags are
tored by a device that 'is not aware of the automatic used.
insertion of Os. The bit stuffing/stripping guarantees
that there will be at least one transition every 6 bit
times while the line is active.
o , , o o
BIT '
-TIME~
270427-20
8-29
inter HARDWARE DESCRIPTION OF THE 83C152
3.3.6 LINE IDLE passing the message to the downstream· station. This
delay is necessary so that a station can decode its own
If 15 or more consecutive Is are detected by the receiv- address before the message is passed on. The various
er the Line Idle bit (LNI) in TSTAT is set. The seven networks are shown in Figure 3.10.
Is from the abort character may be included when sens-
ing for a line idle condition. The same methods used for
sending the Abort character can be used for creating 3.3.9 HDLC/SDLC COMPARISON
the Idle condition. However, the values would need to HDLC (High level Data Link Control) is a standard
be changed to reflect 15 bit times, instead of seven bit adopted by the International Standards Organization
times. (ISO). The HDLC standard is defined in theISO docu-
ment #ISO 6159 - HDLC unbalanced classes ofproce-
3.3.7 ACKNOWLEDGEMENT dures. IBM developed the SDLC protocol as a subset of
HDLC. SDLC conforms to HDLC protocol require-
Acknowledgment in SDLC is an implied acknowledge ments, but is more restrictive. SDLC contains a more
/ and is contained in the controi field. Part of the control precise definition on the modes of operation.
frame is the sequence number .of the next expected
frame. This sequence number is caUed the Receive Some of the major differences between SDLC and
Count. In transmitting the Receive Count, the receiver HDLCare:
is in fact acknowledging aU the previous frames prior to SDLC HDLC
the count that was transmitted. This allows for the Unbalanced (primary/ Balanced
transmission of up to seven frames before an acknowl- secondary) (peer to peer)
edge is required back to the transmitter. The limitation Modulo 8 (no extensions Modulo 128 (up to 127
of seven frames is necessary because the Receive Count
in the control field is limited to three binary diiits. This allowed, up to 7 out- outstanding frames
means that if an eighth transmission occurred this standing frames before before acknowledge
would cause the next Receive Count to repeat the first acknowledge is required) is required)
count that still is waiting for an acknowledge. This 8-bit addressing only Extended addressing
would defeat the purpose of the acknowledgement. The Byte aligned data Variable size of data
processing and general maintenance of the sequence
cOunt must be done by the user software. The Hard- The C152 does not support HDLC implementation re-
ware Based Acknowledge option that is provided in the quiring data alignment other than byte alignment. The
Cl52 is not compatible with standard SDLC protocol. user wiU find that many of the protocol parameters are
programmable in the Cl52 which allows easy imple-
mentation of proprietary or standard HDLC network.
3.3.8 PRIMARY/SECONDARY STATIONS User software needs to implement the control field
All SDLC networks are based upon a primary/second- functions.
ary station relationship. There can be only one primary
station in a network and aU the other stations are con-
sidered secondary. All communication is between the 3.4 User Defined Protocols
primary and secondary station. Secondary station to The explanation on the implementation of user defined
secondary station direct communication is prohibited. protocols would go beyond the scope of this manual,
If there is a need for secundary to secondary COfliiliuni-
but examining Table 3.1 should give the reader a con-
cation, the user software will have to make aUowances solidated list of niost of the possibilities. In this manual,
for the master to act as an intermediary. Secondary any deviation from the documents that cover the imple-
stations are aUowed use of the serial line only when the mentation of CSMA/CD or SDLC are considered user
master permits them. This is done by the master polling defmed protocols. Examples of this would be the use of
the secondary stations to see if they have a need to SDLC with the 32-bit CRC selected or CSMA/CD
access the serial line: This should prevent any collisions with hardware based acknowledge.
from occurring, provided each secondary station has its
own unique address. This arrangement also partiaUy
determines the types of networks supported. Normal
SDLC networks consist of point-to-point, multi·drop, 3.5 Using the GSC
or ring configurations and the Cl52 supports aU of
these. However, some SDLC processors support an au- 3.5.1 LINE DISCIPLINE
tomatic one bit delay at each node that is not supported
by the C152. In a "Loop Mode" configuration, is is Line discipline is how the management of the transfer
necessary that the transmission be delayed from the re- of data over the physical medium is controlled. Two
ception of the frames from the upstream station before types of line discipline will be discussed in this section:
full duplex and half duplex.
8-30
HARDWARE DESCRIPTION OF THE 83C152
Point-to-Point Network
270427-21
Multi-Drop Network
270427-22
Ring Network
270427-23
8-31
inter HARDWARE DESCRIPTION OF THE 83C152
Full duplex is the simultaneous transmission and recep- Some of the general areas that will impact the overall
tion of data. Full duplex uses anywhere from two to scheme on how to incorporate future changes to the
four wires. At least one wire is needed for transmission system are:
and one wire for reception. Usually there will also be a
ground reference on each signal if the distance from 1) Communication of the change to all the stations or
station to station is relatively long. Full-duplex opera- the primary station.
tion in the C152 requires that both the receive and the
transmit portion ,of the GSC are functioning at the 2) Maximum distance for communication. This will af-
same time. Since both the transmitter and receiver are fect the drivers used and the slot time.
operating, two CRC generators are also needed. The
C152 handles this problem by having one 32-bit CRC 3) More stations may be on the line at one time. This
generator and one 16-bit CRC generator. When sup- may impact the interframe space or the collision resolu-
porting full-duplex operation, the 32-bit CRC generator tion used.
is modified to work as a 16-bit CRC generator. When-
ever the 16-bit CRC is selected, the GSC automatically 4) If using CSMAlCD without deterministic resolu-
enters the full duplex mode. Half duplex with a 16-bit tion, any increase in network size will have a negative
CRC is discussed in the following paragraph. impact on the average throughput of the network and
lower the efficiency. The user will have to give careful
Half duplex is the alternate transmission and reception consideration when deciding how large a system can
of data over a single cornmon wire. Only one or two ultimately be and still maintain adequate performance.
wires are needed in half-duplex systems. One wire is
needed for the signal and if the distance to be covered is
long there will also. be a wire for the ground reference. 3.5.3 DMA SERVICING OF GSC CHANNELS
In half-duplex mode, only the receiver or- transmitter
There are two sources that can be used to control the
can operate at one time. When the receiver or transmit-
GSC. The first is CPU control and the second is DMA
ter operates is determined by user software, but typical-
control.
ly the receiver will always be enabled unless the GSC is
transmitting. Whenever half duplex is being used the
CPU control is used when user software takes care of
software must insure that only the receiver or transmit- . the tasks such as: loading the TFIFO, reading the RFI-
ter is enabled at any given time. This is particularly FO, checking the status flags, and general tracking of
important when using SDLC, so that the receiver will
the transmission process. As the number of tasks grow
not recognize its own address when the transmitter is and higher data transfer rates are used, the overhead
operating. Half-duplex operation in the C152 is sup- required by the CPU becomes the dominant consump-
ported with either 16-bit or 32-bit CRCs. Whenever a
tion of time. Eventually, a point is reached where the
32-bit CRC is selected, only half-duplex operation can
CPU is spending 100% of its time responding to the
be supported by the GSC. It is possible to simulate full-
needs of the GSC. An alternative is to have the DMA
duplex operation with a 32-bit CRC, but this would channels control the GSC.
require that the CRC be performed with software. CaI-
culating the CRC with the CPU would greatly reduce
A detailed explanation on the general use of the DMA
the data rates that could be used with the GSC. When-
channels is covered in Section 4. In this section only
ever a 16-bit CRC is selected, full-duplex operation is
those details required for the use of the DMA channels
automatically chosen and the GSC must be reconfig-
with the GSC will be covered.
ured if half-duplex operation is preferred.
The DMA channels can be configured by user software
3.5.2 PLANNING FOR NETWORK CHANGES so that the GSC data transfers are serviced by the
AND EXPANSIONS DMA controller. Since there are two DMA channels,
one channel can be used to service the receiver, and one
A complete explanation on how to plan for network channel can. be used to service the transmitter. In using
expansion will not be covered in this manual as there the DMA channels, the CPU is relieved of much of the
are far too many possibilities that would need to be time required to do the basic servicing ofthe GSC buff-
discussed. But there are several areas that will have ers. The types of servicing that the DMA channels can
major impact when allowing for changes in the system. provide are: loading of the transmit FIFO, removing.
In cases where there will never be any changes allowed, data from the receive FIFO, notification of the CPU
expansion plans become a mute issue. However, it is when the transmission or reception has ended, and re-
strongly suggested that there always be some allowance sponse to certain error conditions. When using the
for future modifications.
8-32
inter HARDWARE DESCRIPTION OF THE 83C152
DMA channels the source or destination of the data that will be received, up to 64K. If not using the Done
intended for serial transmission can be internal data flag, then GSC servicing would be driven by the receive
memory, external data memory, or any of the SFRs. Done (RDN) flag and/or interrupt. RDN is set when
the EOF is detected. When using the RDN flag, RFNE
The only tasks required after initialization of the DMA should also be checked to insure that all the data has
and GSC registers are enabling the proper interrupts been emptied out of the receive FIFO.
and informing the DMA controller when to start. After
the DMA channels are started all that is required of the The byte count register is used for all transmissions and
CPU is to respond to error conditions or wait until the this means that all packets going out will have to be of
end of transmission. the same length or the length of the packet to be sent
will have to be known prior to the start of transmission.
Initialization of the DMA channels requires setting up When using the DMA channels to service the GSC
the control, source, and destination address registers. transmitter, there is no practical way to disable the
On the DMA channel servicing the receiver, the con- Done flag. This is because the transmit done flag
trol register needs to be loaded as follows: DCONn.2 = (TDN) is set when the transmit FIFO is empty and the
0, this sets the transfer mode so that response is to GSC last message bit has been transmitted. But, when using
interrupts and put the DMA control in alternate cycle the DMA channel to service the transmitter, loads to
mode; DCONn.3 = 1, this enables the demand mode; the TFIFO continue to occur until the byte count
DCONnA = 0, this clears the automatic increment reaches O. This makes it impossible to use TDN as a
option for the source address; and DCONn.5 = I, this flag to stop the DMA transfers to TFIFO. It is possible
defines the source as SFR: The DMA channel servicing to examine some other registers or conditions, such as
the receiver also needs its source address register to the current byte count, to determine when to stop the
contain the address of RFIFO (SARHN = XXH, DMA transfers to TFIFO, but this is not recommended
SARLN = OF4H). On the DMA channel servicing the as a way to service the DMA and GSC when transmit-
transmitter, the control register needs to be loaded as ting because frequent reading of the DMA registers will
follows: DCONn.2 = 0; DCONn.3 = I; DCONn.6 = cause the effective DMA transfer rate to slow down.
0, this clears the automatic increment option for the
destination address; and DCONn.7 = I, this sets the When using the DMA channels, initialization of the
destination as SFR. The DMA channel serving the GSC would be exactly the same as normal except that
transmitter also requires that its destination address TSTAT.O = I (DMA), this informs the GSC that the
register contains the address of TFIFO (DARHN = DMA channels are going to he lIsed to service the GSC.
XXH, DARLN = 85H). Assuming that DCONO Although only TSTAT is written to, hoth the receiver
would be serving the receiver and DCONI the trans- and transmitter use this sallie DMA hit.
mitter, DCONO would be loaded with XXIOIOXOB
and DCONI would be loaded with IOXXIOXOB. The The interrupts EGSTE (IEN1.5), GSC transmit error;
contents of SARRO and DARHI do not have any im- EGSTV (lEN 1.3), GSC transmit valid; EGSRE
pact when using internal SFRs as the source or destina- (IENl.l), GSC receive error; and EGSRV (IENl.O),
tion. GSC receive valid; need to be enabled. The DMA inter-
rupts are normally not used when servicing the GSC
When using the DMA channels to service the GSC, the with the DMA channels. To ensure that the DMA in-
byte count registers will also need to be initialized. terrupts are not responded to is a function of the user
software and should be checked by the software to
The Done flag for the DMA channel servicing the re- make sure they are not enabled. Priority for these inter-
ceiver should be used if fixed packet lengths only are rupts can also be set at this time. Whether to use high
being transmitted or to insure that memory is not over- or low priority needs to be decided by the user. When
written by long received data packets. Overwriting of responding'to the GSC interrupts, if a buffer is being
data can occur when using a smaller buffer than the. used to store the GSC information, then the DMA reg-
packet size. In these cases the servicing of the DMA isters used for the buffer will probably need updating.
and/or GSC would be in response to the DMA Done
flag when the byte ~ount reaches zero. After this initialization, all that needs to be done when
the GSC is actually going to be used is: load the byte
In some cases the buffer size is not the limiting factor count, set-up the source addresses for the DMA chan-
and the packet lengths will be unknown. In these cases nei servicing the transmitter, set-up the destination ad-
it would be desirable to eliminate the function of the dresses for the DMA channel servicing the receiver,
Done flag. To effectively disable the Done flag for the and start the DMA transfer. The GSC enable bits
DMA channel servicing the receiver, the byte count should be set first and then the GO bits for the DMA.
should be set to some number larger than any packet This initiates the data transfers.
8-33
intJ HARDWARE DESCRIPTION OF THE 83C152
This simplifies the maintenance of the GSC and can Initialization of the system can be broken down into
make the implementation of an external buffer for several steps. First, are the assumptions of each net-
packetized information automatic. work station.
An external buffer can be used as the source of data for The first assumption is that the type of data encoding
transmission, or the destination of data from the receiv- to be used is predetermined for the system and that
er. In this arrangement, the message size is limited to each station will adhere to the same basic rules defining
the RAM size or 64K, whichever is smaller. By using that encoding. The second assumption is that the basic
an external buffer, the data can be accessed by other protocol and line discipline is predetermined and
devices which may want access to the serial data. The known. This means that all stations.are using CSMAI
amount of time required for the external data moves CD or SDLC or whatever, and that all stations are
will also decrease. Under CPU control, a "MOVX" either full or half duplex. The third assumption is that
command would take 24 oscillator periods to complete. the baud rate is preset for the whole system. Although
Under DMA control, external to internal, or internal to the baud rate could probably be determined by the mi-
external, data moves take only 12 oscillator periods. croprocessor just by monitoring the link, it will make it
much simpler if the baud rate is known in advance.
3.5.4 BAUD RATE One of the first things that will be required during sys-
tem initialization is the assignment of unique addresses
The GSC baud rate is determined by the contents of the
SFR, BAUD, or the external clock. The formula used for each station. In a two-station only environment this
to determine the baud rate when using the internal is not necessary and can be ignored. However, keep in
mind, that all systems should be constructed for easy
clock is:
future expansions. Therefore, even in only a two station
(fosc)/«BAUD+ 1)*8) system, addresses should be assigned. There are three
basic ways in which addresses can be assigned. The
For example if a 12 MHz oscillator is used the baud first, and most common is preassigned addresses that
rate can vary from: - are loaded into the station by the user. This could be
done with a DIP-switch, through a keyboard. The sec-
12,000,000/«0-1- 1)'8) = 1.5 MBPS ond method of assigning addresses is to randomly as-
sign an address and, then check for its uniqueness
to: throughout the system, and the third method is to
make an inquiry to the system for the assignment of a
12.000.000/«255+1)'8) ='5.859 KBPS unique address. Once the method of address assignment
is determined, the method should become part of the
There are certain requirements that the external clock specifications for the system to which all additions will
will need to meet. These requirements are specified in have to adhere. This, then, is the final assumption.
the data sheet. For a description of the use of the GSC
with external clock please read Section 3.5.11. The negotiation process may not be clear for some
readers. The following two procedures are given as a'
guideline for dynamic address assignment.
3.5.5 INITIALIZATION
In the first procedure, a station assumes a random ad-
Initialization can be broken down into two major' com-
dress and then checks for its uniqueness throughout the
ponents, i) iniiiaiizaiion of the component so that its
system. As a station is initialized into the system it
serial port is capable of proper communication; and 2)
sends out a message containing its assumed address.
initialization of the system or a station so that intelligi-
The format of the message should be such that any
ble communication can take place.
station decoding the address recognizes it as a request
for initialization. If that address is already used, the
Most of the initialization of the component has already
receiving station returns a message, with its own ad-
been discussed in the previous sections. Those items not
dress stating that the address in question is already tak-
covered are the parameters required for the component
en. The initializing station then picks another address.
to effectively communicate with other components.
When the initializing station sends its inquiry for the
These types of issues are common to both system and
address check, a timer is also started. If the timer ex-
component initialization and will be covered in the fol-
lowing text. pires before the iilquiry is responded to, then that sta-
tion assumes the address chosen is okay.
8-34
inter HARDWARE DESCRIPTION OF THE 83C152
In the second procedure, an initializing station asks for In Raw Receive, the transmitter should be externally
an address assignment from the system. This requires connected to the receiver. To do this a port pin should
that some station on the link take care of the task of be used to enable an external device to connect the two
maintaining a record of which addresses are used. This pins together. In Raw Receive mode the receiver acts as
station will be called station-I. When the initializing normal except that all bytes following the BOF are
station, called station-2, gets on the link, it sends out a loaded into the receive FIFO, including the CRC. Also
message with a broadcast address. The format of the address recognition is not active but needs to be per-
message should be such that all other stations on the formed in software. IfSDLC is selected as the protocol,
link recognize it as a request for address assignment. zero-bit deletion is still enabled. The transmitter still
Part of the message from station-2 is a random number operates as normal and in this mode most of the trans-
generated by the station requesting the address. Sta- mitter functions and an external transceiver can be test-
tion-2 then examines all received messages for this ran- ed. This is also the only way that the CRC can be read
dom number. The random number could be the address by the CPU, but the CRC error bit will not be set.
of the received message or could be within the informa-
tion section of a broadcast frame. All the stations, ex-
cept station-I, on the link should ignore the initializa- 3.5.7 EXTERNAL DRIVER INTERFACE
tion request. Station-I, upon receiving the initialization A signal is provided from the CI52 to enable transmit-
request, assigns an address and returns it to station-2. ter drivers for the serial link. This is provided for sys-
Station-l will be required to format the message in such tems that require more than what the GSC ports are
a manner so that all stations on the link recognize it as capable of delivering. The voltage and currents that the
a response to initialization. This means that all stations GSC is capable of providing are the saine levels as those
except station-2 ignore the return message. for normal port operation. The signal used to enable the
external drivers is DEN. No similar signal is needed for
3.5.6 TEST MODES the receiver.
There are two test modes associated with the GSC that
are made available to the user. The test modes are 3.5.8 JITTER (RECEIVE)
named Raw Receive and Raw Transmit. The test Datajitter is the difference between the actual transmit-
modes are selected by the proper setting of the two ted waveform and the exact calculated value(s). In
mode bits in GMOD (MO = GMOD.5, MI = NRZI, data jitter would be how much the actual wave-
GMOD.6). If Ml,MO = 0,1 then Raw Transmit is se- form exceeds or falls short of one calculated bit time. A
lected. If MI,MO = 1,0 then Raw Receive is enabled. bit time equals l/baud rate. If using Manchester encod-
ing, there can be two transitions during one bit time as
In Raw Transmit, the transmit output is internally con- shown in Figure 3.11. This causes a second parameter
nected to the Receiver input. This is intended to be to be considered when trying to figure out the complete
used as a local loop-back test mode, so that all data data jitter aniount. This other parameter is the half-bit
written to the transmitter will be returned by the re- jitter. The half-bit jitter is comprised of the difference in
ceiver. Raw Transmit can also be used to transmit user time that the half-bit transition actually occurs and the
data. If Raw Transmit is used in this way the data is calculated value. Jitter is important because if the tran-
emitted with no preamble, flag, address, CRC, and no sition occurs too soon it is considered noise, and if the
bit insertion. The data is still encoded with whatever transition occurs too late, then either the bit is missed
format is selected, Manchester with CSMA/CD, NRZI or a collision is assumed.
with SDLC or as NRZ if external clocks are used. The
receiver still operates as normal and in this mode most
of the receive functions can be tested.
8-35
inter HARDWARE DESCRIPTION OFTHE 83C152
LOGICAL o o o
VALUE
MANCHESTER
ENCODING
'I
(8 X BAUDf
RECEIV
I
SAMPLING I
RATE
I I
....
I I
RECEIVED I
.. -
I I I I
DATA I I I I I I
I
... I
, I
I
I
I
.-----
I I
RECEIVED I
.. -
I I I. I
DATA .1
I
I I
I
I
I
I I
---- ..
270427-24
8-36
inter HARDWARE DESCRIPTION OF THE 83C152
I
I BIT I
:~ TIME ---..:
I
a a a
NRZ
L
270427-25
8-37
inter HARDWARE DESCRIPTION OF THE 83C152
o, 1 , 0 1 , 0 ,1 1 ,0 0 0 0',
IDEAL WAVEFORM
., ,
I I I I I I I I I I I I I I I I I
ax SAMPLING RATE 111111111111111111111111111111111111111111111111111111\1111111111111111.11111111,11111I11j11l1l11l11l11l1Ul1l111j111l1l1l11l11l1l1l11111111l1111
, ACTUAL WAVEFORM
RECOVERED BIT
STREAM CLOCK
270427-26
o 000 o 0: 0:
IDEAL WAVEFORM
, ,
I I I I I I I I I I I I I I I I I
ax SAMPLING RATE 1111111111111111111111111111111111111 111111111111111111111111111111111111111111111111111111111111111111111111 111111111111111111111111111111
ACTUAL WAVEFORM
RECOVERED BIT
STREAM CLOCK
270427-27
8-38
infef HARDWARE DESCRIPTION OF THE 83C152
dress as transmission takes place. This also needs to be multi-cast address. The user software can enable the
done when using CSMA/CD with a 16-bit CRC for the interrupt for RDN to determine when a frame is com-
same reason. pleted.
8-39
inter HARDWARE DESCRIPTION OF THE 83C152
If less than eight attempts are desired TCDCNT can be All the stations monitor the link as long as that station
loaded with some value which will reduce the number is active, even if not attempting to transmit. This is to
of collisions possible before TCDCNT overflows. The ensure that each station always defers the minimum
value loaded should consist of all 1s as the least signifi- amount oftime before attempting a transmission and so
cant bits, e.g. 7, OFH, 3FH. A solid block of Is is sug- that addresses are recognized. However, the collision
gested because TCDCNT is used as a mask when gen- detect circuitry operates slightly differently.
erating the random slot number assignment. The
TCDCNT register operates by shifting the contents one In normal back-off mode, a transmitting station always
bit position to the left as each collision is detected. As monitors the link while transmitting. If a collision is
each shift occurs a 1 is loaded into the LSB. When detected one or more of the transmitting stations apply
tCDCNT overflows, GSC operation stops and the the jam signal and all transmitting stations enter the
CPU is notified by the setting of the TCDT bit which back-off algorithm. The receiving stations also cop.-
can flag an interrupt. stantly monitor for a collision but do not take part in
the resolution phase. This allows a station to try to
The amount of time that the GSC has before it must be transmit in the middle of a resolution period. This in
ready to retransmit after a collision is determined by turn mayor may not cause another collision. If the new
the mode which is selected. The mode is determined station trying to transmit on the link does so during an
MO (GMOD.5) and Ml (GMOD.6). If MO and Ml unused slot time then there will probably not be a colli-
equal 0,0 (normal backoff) then the minimum period sion. If trying to transmit during a used slot time, then
before retransmission will be either the interframe there will probably be a collision. The actions the re-
space or the backoff period, whichever is longer. If MO ceiver does take when detecting a collision is to just
and Ml equal 1,1 (alternate backoff) then the minimum stop receiving data if data has 110t been loaded into
period before retransmission will be the interframe RFIFO or to stop reception, clear receiver enable
space plus the backoff period. Both of these are shown (REN) and set the receiver abort flag (RCABT -
in Figure 3.4. Alternate backoff must be enabled if us- RSTAT.6).
ing deterministic resolution. If the GSC is not ready to
retransmit by the time its assigned slot becomes avail- If deterministic resolution is used, the transmitting sta-
able, the slot time is lost and the station must wait until tions go through pretty much the same process as in
the collision resolution time period has' passed. normal back-off, except that the slots are predeter-
mined. All the receivers go through the back-off algo-
Instead of waiting for the collision resolution to pass, .rithm and may only transmit during their assigned slot.
the transmission could be aborted. The decision to
abort is usually dependent on the number of stations on
the link and how many collisions have already oc- 3.6.4 SUCCESSFUL ENDING OF
curred. The number of collisions can be obtained by TRANSMISSIONS AND RECEPTIONS
examining the register, TCDCNT. The abort is normal-
In both CSMA/CD and SDLC modes, the TDN bit is
ly implemented by clearing TEN. The new transmis-
set and TEN cleared at the end of a successful trans-
sion begins by setting TEN and loading TFIFO. The mission. The end of the transmission occurs when the
minimum amount of time available to initiate a retrans-
TFIFO is empty and the last byte has been transmitted.
mission would be one interframe space period after the In CSMAlCD the user should clear the TCDCNT reg-
line is sensed as being idle.
ister after successful transmission.
As the nUfiibef of stations approach 256 the probability At the end of a successfui reception, me RDN bit is set
of a successful transmission decreases rapidly. If there
. and GREN is cleared. The end of reception occurs
are more than 256 stations involved in the collision
when the EOF flag is detected by the GSC hardware.
there would be nb resolution since at least two of the
stations will always have the same backoff interval se-
lected.
8-40
inter HARDWARE DESCRIPTION OF THE 83C152
3.7 Register Descriptions The length includes the two bit Begin Of Frame (BOP) .
flag in CSMA/CD but does not include the SDLC flag.
ADRO,I,2,3 (95H, OA5H, OB5H, OC5H) - Address In SDLC mode, the BOF is an SDLC flag, otherwise it
Match Registers 0,1,2,3 - Contains the address match is two consecutive ones. Zero length is not compatible
values which determines which data will be accepted as in CSMA/CD mode. The user software is responsible
valid. In 8 bit addressing mode, a match with any of the for setting or clearing these bits.
four registers will trigger acceptance. In 16 bit address-
ing mode a match with ADR1:ADRO or ADR3:ADR2 GMOD.3 (CT) - CRC Type - If set, 32 bit AUTODIN-
will be accepted. Addressing mode is determined in lI-32 is used. If cleared, 16 bit CRC-CCITT is used.
GMOD (AL). The user software is responsible for setting or clearing
this flag.
AMSKO,1 (OD5H, OE5H) - Address Match Mask 0,1 -
Identifies which bits in ADRO,1 are "don't care" bits. GMOD.4 (AL) - Address Length - If set, 16 bit ad-
Writing a one to a bit in AMSKO,1 masks out that dressing is used. If cleared, 8 bit addressing is used. In 8
corresponding bit in ADDRO,l. bit mode a match with any of the 4 address registers
will be accepted (ADRO, ADR1, ADR2, ADR3).
BAUD (94H) - GSC Baud Rate Generator - Contains "Don't Care" bits may be masked in ADRO and ADRI
the value of the programmable baud rate. The data rate with AMSKO and AMSKI. In 16 bit mode, addresses
will equal (frequency of the oscillator)/«BAUD + 1) are matched against "ADR1:ADRO" or "ADR3:
X (8)). Writing to BAUD actually stores the value in a ADR2". Again, "Don't Care" bits in ADR1:ADRO
reload register. The reload register contents are copied can be masked in AMSK1:AMSKO. A received address
into the BAUD register when the Baud register decre- of all ones will always be recognized in any mode. The
ments to OOH. Reading BAUD yields the current timer user software is responsible for setting or clearing this
value. A read during GSC operation will give a value flag.
that may not be current because the timer could decre-
ment between the time it is read by the CPU and by the GMOD.5,6 (MO,Ml) - Mode Select - Two test modes,
time the value is loaded into its destination. an optional "alternate backoff" mode, or normal back-
off can be enabled with these two bits. The user soft-
BKOFF (OC4H) - BackoffTimer - The backofftimer is ware is responsible for setting or clearing the mode bits.
an eight bit count-down timer with a clock period equal
to one slot time. The backoff time is used in the Ml MO Mode
CSMA/CD collision resolution algorithm. The user 0 0 Normal
software may read the timer but the value may be inval- 0 1 Raw Transmit
id. as the timer is clocked asynchronously to the CPU. 1 0 Raw Receive
Writing to OC4H will have no effect. 1 1 Alternate Backoff
8-41
HARDWARE DESCRIPTION OF THE 83C152
8-42
HARDWARE DESCRIPTION OF THE 83C152
RFIFO (OF4H) - Receive FIFO - RFIFO is a 3 byte had been loaded into the receive FIFO in CSMA/CD
buffer that is loaded each time the GSC receiver has a mode. In SDLC mode, RCABT indicates that 7 consec-
byte of data. Associated with RFIFO is a pointer that is utive ones were detected prior to the end flag but after
automatically updated with each read of the FIFO. A data has been loaded into the receive FIFO. The status
read of RFIFO fetches the oldest data in the FIFO. of this flag is controlled by the GSC.
RSTAT (OESH) - Receive Status Register RSTAT.7 (OVR) - Overrun - If set, indicates that the
76543210 receive FIFO was full and new shift register data was
written into it. The setting of this flag is controlled by
IORIRCABTIAElcRCEIRDNIRFNEIGRENIHABENI the GSC and it is cleared by user software.
Figure 3.16. RSTAT
SLOTTM (OBH) - Slot Time - Determines the length of
RSTAT.O (HABEN) - Hardware Based Acknowledge the slot time used in CSMAlCD. A slot time equals
Enable - If set, enables the hardware based acknowl- (256 - SLOTTM) X (I / baud rate). A read of
edge feature. The user software is responsible for setting SLOTTM will give the value of the slot time timer but
or clearing this flag. the value may be invalid as the timer is clocked asyn-
chronously to the CPU. Loading SLOTTM with 0 re-
RSTAT.I (GREN) - Receiver Enable - When set, the sults in 256 bit times.
receiver is enabled to accept incoming frames. This also
clears RDN, CRCE, AE, RCABT, and the receive TCDCNT (OD4H) - Transmit Collision Detect Count -
FIFO. It is cleared by the receiver at the end of a recep- Contains the number of collisions that have occurred if
tion or if any errors occurred. The user software is re- probabilistic CSMAlCD is used. The user software
sponsible for setting this flag and the GSC or user soft- must clear this register before transmitting a new frame
ware can clear it. The status of GREN has no effect on so that the GSC backoff hardware can accurately dis-
whether the receiver detects a collision in CSMAlCD tinguish a new frame from a retransmit attempt.
mode as the receiver input circuitry always monitors
the receive pin. In deterministic backoff mode, TCDCNT is used to
hold the maximum number of slots.
RSTAT.2 (RFNE) - Receive FIFO Not Empty - If set,
indicates that the receive FIFO contains data. The re- TFIFO (S5H) - GSC Transmit FIFO - TFIFO is a 3
ceive FIFO is a three byte buffer into which the receive byte buffer with an associated pointer that is automati-
data is loaded. A CPU read of the FIFO retrieves the cally updated for each write by user software. Writing a
oldest data and automatically updates the FIFO point- byte to TFIFO loads the data into the next available
ers. Setting GREN to a one will clear the receive FIFO. location in the transmit FIFO. Setting TEN clears the
The status of this flag is controlled by the GSC. It is transmit FIFO so the transmit FIFO should not be
cleared if user empties receive FIFO. written to prior to setting TEN. If TEN is already set
transmission begins as soon as data is written to TFI-
RSTAT.3 (RDN) - Receive Done - If set, indicates the FO.
successful completion of a receiver operation. Will not
be set if a CRC, alignment, abort, or FIFO overrun TSTAT (ODS) - Transmit Status Register
error occurred. The status of this flag is controlled by 76543210
the GSC.
LNI I NOACK I UR I TCDT I TDN I TFNF I TEN I DMA I
RSTAT.4 (CRCE) - CRC Error - If set, indicates that a Figure 3.17. TSTAT
properly aligned frame was received with a mismatched
CRC. The status of this flag is controlled by the GSC. TSTAT.O (DMA) - DMA Select - If set, indicates that
DMA channels are used to service the GSC FIFO's and
RSTAT.5 (AE) - Alignment Error - If set, indicates GSC interrupts occur on TDN and RDN, and also en-
that the line went idle when the receiver shift register ables UR to become set. If cleared, indicates that the
was not full and the resulting CRC was bad in the GSC is operating in its normal mode and interrupts
CSMAlCD mode. If a correct CRC was valid. then AE occur on TFNF and RFNE. For more information On
is not set. In SDLC mode, AE indicates that a non- DMA servicing please refer to the DMA section on
byte-aligned flag was received. The status of this flag is DMA serial demand mode (4.2.2.3). The user software
controlled by the GSC. is responsible for setting or clearing this flag.
8-43
HARDWARE DESCRIPTION, OF THE 83C152
TSTAT.l (TEN) - Transmit Enable - When set causes 3.8 Serial Backplane VS. Network
TDN,UR, TCDT, and NOACK flag to be ,reset and Environment
the TFIFO cleared. The transmitter will clear TEN af-
ter a successful transmission, a collision during the The C152 GSC port is intended to fulfill the needs of
data, CRC, or end flag. The user software is responsible both serial backplane environment and the serial com-
for setting but the GSC or user software may clear this munication network environment. The serial backplane
flag. If cleared during a transmission the GSC transmit is where typically, only processor to processor commu-
pin goes to a steady state high level. .This is the method nications take place within a self contained box. The
used to send an abort character in SDLC., Also DEN is' communication usually only encompasses those items
forced to a high level. The end of transmission occurs which are necessary to accomplish the dedicated task
whenever the TFIFO is emptied. for the box. In these types of applications there may not
be a need for line drivers as the distance between the
TSTAT.2 (TFNF) - Transmit FIFO not full - When transmitter and receiver is relatively short. The net-
set, indicates that new data may be written into the work environment; however, usually requires transmis-
transmit FIFO. The transmit FIFO is a three byte buff- sion of data over large distances and requires drivers
er that loads the transmit shift register with data. The and/or repeaters to ensure the data is received on both
status of this flag is controlled by the GSC. ends.
TSTAT.3 (TDN) - Transmit Done - When set, indi-
cates the successfu1.completion ofa frame transmission: 4.0 DMA Operation
If HABEN is set, TDN will not be set until ,the end of
the IFS following the, transmitted message, so that the The C152 contains DMA (Direct Memory Accessing)
acknowledge can be checked. If an acknowledge is ex- logic to peiform high speed data tran'sfers between any
pected and not received, TDN'is not set. An acknowl- two of
edge is not expected following a broadcast or multi-cast
packet. The status of this flag is controlled by the GSC. Internal Data RAM
Internal SFRs
TSTAT.4 (TCDT) - Transmit Collision Detect - If set, External Data RAM
indicates that the transmitter halted due to a collision.
It is set if a collision occurs during the data or CRC or If external ,RAM is involved, the Port 2 and Port 0 ~
ifthere are more than eight collisions. The status of this are used as the address/data bus, and RD and WR
flag is ~ontrolled by the GSC. signals are generated as required. '
TSTAT.5 (UR) - Underrun - If set, indicates that in Hardware is also implemented to generate a Hold Re-
DMA mode the last bit was shifted out of the transmit quest signal and await a Hold Acknowledge response
register and that the DMA byte count did not equal before commencing a DMA that involves external
zero. When an underrun occurs, the transmitter, halts RAM.
without sending the CRC or the end flag. The status of
this flag is controlled by the GSC. Alternatively, the Hold/Hold Acknowledge hardware
can be programmed to 'accept a Hold Request signal
TSTAT.6 (NOACK) - No Acknowledge - If set, indi- from an external device and generate a Hold Acknowl-
cates that no acknowledge was received fodhe previous edge signal in response, to indicate to the requesting
frame. Will be set only if HABEN is set and no ac- device that the C152 will not commence a DMA to or
knowledge is received prior to the end of the IFS. from external RAM while the Hold Request is active. ,
NOACK is not set following a broadcast or a multi-
cast packet. The status of this flag is controlled by the
GSC. ' 4.1 DMA with the 80C152
TSTAT. 7 (LNI) - Line tdle - If set, indicates' the re- The C152 contains two identical general purPose 8-bit
ceive line is idle. In SDLC protocol it is set if 15 consec- DMA channels with 16-bit addressability: DMAO and
utive 'ones are' received. In CSMA/CD protocol, line DMAI. DMA transfers can be executed by either chan-
idle is set if no transitio~s occ~r on GR X D for approx- nel independent of the other, but only by one channel at
imately 1.6 bit times after a r~uired transition. LNI is a time. During the time that a DMA transfer is being
cleared after a transition on GRXD.The status of this executed, program execution is suspended. A DMA
flag is controlledby the GSC. transfer takes one machine cycle (12 oscillator
8-44
intJ HARDWARE DESCRIPTION OF THE 83C152
DARHO I I DARlO
DESTINATION ADDRESS
I, .I DARH1 II DARL1
DESTINATION ADDRESS
I.
.I SARHO II
SOURCE ADDRESS
SARLO I. .I SARH1 I I
SOURCE ADDRESS
SARL1 I,
BCRHO II BCRlO I, BCRH1 II BCRL1 I.
BYTE COUNT BYTE COUNT
I DCONO I I DCON1 I
DMAO CONTROL DMA 1 CONTROL
PCON
'-'
"-- Two new bits In PCON control
Hold/Hold Acknowledge logic
270427-28
periods) per byte transferred, except when the destina- Two other bits in DCONn specify the physical source
tion and source are both in External Data RAM. In of the data to be transferred. These are SAS (Source
that case the transfer takes two 'machine cycles per Address Space) and ISA (Increment Source Address).
byte. The term DMA Cycle will be used to mean the If SAS = 0, the source is in data memory extern;i1 to
transfer of a single data byte, whether it takes 1 or 2 the CIS2. If SAS = 1, the source is internal. If SAS =
machine cycles. 1 and ISA = 0, the internal source is an SFR. If SAS
= 1 and ISA = 1, the internal source is in the 256-byte
Associated with each channel are seven SFRs, shown in data RAM.
Figure 4.1. SARLn and SARHn holds the low and high
bytes of the' source address. Taken together they form a In any case, if ISA = 1, the source address is automati-
16-bit Source Address Register. DARLn and DARHn cally incremented after each byte transfer. If ISA = 0,
hold the low and high bytes of the destination address, it is not.
and together form the Destination Address Register.
BCRLn and BCRHn hold the low and high bytes of the The functions of these four control bits are summarized
number of bytes to be transferred, and together form below:
the Byte Count Register. DCONn contains control and
flag bits. DAS IDA Destination Auto-Increment
External RAM no
Two bits in DCONn are used to specify the physical
destination of the data transfer. These bits are DAS
°° °1 External RAM yes
(Destination Address Space) and IDA (Increment Des- 1 0 SFR no
tination Address). If DAS = 0, the destination is in 1 1 Internal RAM yes
data memory external to the C152. If DAS = 1, the SAS ISA Source Auto-Increment
destination is internal to the CIS2. If DAS·= 1 and
0 External RAM no
IDA = 0, the internal destination is a Special Function
Register (SFR). If DAS = 1 and IDA = 1, the inter-
nal destination is in the 256-byte data RAM.
0 °1 External RAM yes
1 0 SFR no
1 1 Internal RAM yes
In any case, if IDA = 1, the destination address is
automatically incremented after each byte transfer. If
IDA = 0, it is not.
8-45
HARDWARE DESCRIPTION OF THE 83C152
There are four modes in which the DMA channel can dress. On-chip hardware then clears the flag (RI, TI,
operate. These are selected by the bits DM and TM RFNE, or TFNF) that initiated the DMA, and decre-
(Demand Mode and Transfer Mode) in DCONn: ments BCRn. Note that since the flag that initiated the
DMA is cleared, it will not generate an interrupt unless
OM TM Operating Mode DMA servicing is held off or the byte count equals O.
0 0 Alternate Cycles Mode DMA servicing may be held off when alternate cycle is
0 1 being used or by the status of the HOLD/HLDA logic.
Burst Mode
In these situations the interrupt for the LSC may occur
1 0 Serial Port Demand Mode
before the DMA can clear the RI or TI flag. This is
1 1 External Demand Mode because the LSC is serviced according to the status of
RI and TI, whether or not the DMA channels are being
The operating modes are described below. used for the transferring of data. The GSC does not use
RFNE or TFNF flags when using the DMA channels
so these do not need to be disabled. When using the
4.1.1 ALTERNATE CYCLE MODE DMA channels to service the LSC it is recommended
that the interrupts (RI and TI) be disabled. If the dec-
In Alternate Cycles Mode the DMA is initiated by set-
remented BCRn is OOOOH, on-chip hardware then
ting the GO bit in DCONn. Following the instrnction
clears the GO bit and sets the DONE bit. The DONE
that set the GO bit, one more instruction is executed,
bit flags an interrupt.
and then the first data byte is transferred from the
source address to the destination address. Then another
instruction is executed, and then another byte of data is 4.1.4 EXTERNAL DEMAND MODE
transferred, and so on in this manner.
In External Demand Mode the DMA is initiated by
Each time a data byte is transferred, ,BCRn (Byte one of the External Interrupt pins, provided the GO bit
Count Register for DMA Channel n) is decremented. is set. INTO initiates a Channel 0 DMA, and INTI
When it reaches OOOOH, on-chip hardware clears the initiates a Channel 1 DMA.
GO bit and sets the DONE bit, and the DMA ceases.
The DONE bit flags an interrupt. If the external interrupt is configured to be transition-
activated, then each I-to-O transition at the interrupt
pin sets the corresponding external interrupt flag, and
4.1.2 BURST MODE generates one DMA Cycle. Then, BCRn is decrement-
ed. No more DMA Cycles take place until another
Burst Mode differs from Alternate Cycles mode only in
I-to-O transition is seen at the external interrupt pin. If
that once the data transfer has begun, program execu-
the decremented BCRn = OOOOH, on-chip hardware
tion is entirely suspended until BCRn reaches OOOOH,
clears the GO bit and sets the DONE bit. If the exter-
indicating that all data bytes that were to be transferred
nal interrupt is enabled, it will be serviced.
have been transferred. The interrupt control hardware
remains active during the DMA, so interrupt flags may
If the external interrupt is configured to be level-acti-
get set, but since program execution is suspended, the
vated, then DMA Cycles commence when the interrupt
interrupts will not be serviced while the DMA is in
pin is pulled low, and continue for as long as the pin is
progress.
held low and BCRn is not OOOOH. If BCRn reaches 0
while the interrupt pin is still low, the GO bit is cleared,
4.i.3 SERiAL FORi DEiviAND MOCE the DONE bit is set, and the DMA ceases. If the exter-
nal interrupt is enabled, it will be serviced.
In this mode-the DMA can be used to service the Local
Serial Channel (LSC) or the Global Serial Channel If the interrupt pin is pulled up before BCRn reaches
(GSC). - OOOOH, then the DMA ceases, but the GO bit is still 1
and the DONE bit is still O. An external interrupt is not
In Serial Port Demand Mode the DMA is initiated by generated in this case, since in level-activated mode,
any of the following conditiollS, if the GO bit is set: pulling the pin to a logical 1 clears the interrupt flag. If
Source Address = SBUF .AND. AI = 1 the interrupt pin is then pulled low again, DMA trans-
Destination Address = SBUF .AND. TI = 1 fers will continue from where they were previously
stopped.
Source Address = AFIFO .AND. AFNE = 1
Destination Address = TFIFO .AND. TFNF = 1 The timing for the DMA Cycle in the transition-acti-
vated mode, or for the first DMA Cycle in the level-ac-
Each time one of the above conditions is met, one tivated mode is as follows: If the I-to-O transition is
DMA Cycle is executed; that is, one data byte is trans-
ferred from the source address to the destination ad-
8-46
HARDWARE DESCRIPTION OF THE 83C152
detected before the final machine cycle of the instruc- and RD and/or WR signals are generated as needed, in
tion in progress, then the DMA commences as soon as the same manner as in the execution of a MOVX
the instruction in progress is completed. Otherwise, one @DPTR instruction.
more instruction will be executed before the DMA
starts. No instruction is executed during any DMA Cy-
cle. 4.3 Hold/Hold Acknowledge
Two operating modes of Hold/Hold Acknowledge log-
4.2 Timing Diagrams ic are available, and either or neither may be invoked
by software. In one mode, the C152 generates a Hold
Timing diagrams for single-byte DMA transfers are Request signal and awaits a Hold Acknowledge re-
shown.in Figures 4.2 through 4.5 for four kinds of sponse before commencing' a DMA that involves exter-
DMA Cycles: internal memory to internal memory, in- nal RAM. This is called the Requester Mode.
ternal memory to external memory, external memory
to internal memory, and external memory to external In the other mode, the C152 accepts a Hold Request
memory. In each case we assume the Cl52 is executing signal from an external device and generates a Hold
out of external program memory. If the C152 is execut- Acknowledge signal in response, to indicate to the re-
ing out of internal program memory, then PSEN is in- questing device that the C 152 will not commence a
active, and the Port 0 and Port 2 pins emit PO and P2 DMA to or from external RAM while the Hold Re-
SFR data. If External Data Memory is involved, the quest is active. This is called the Arbiter mode,
Port 0 and Port 2 pins are used as the address/data bus,
""iN'ST1--- - - - - - - - -- - - - - -
PO ...,;;;;;;.,J __________________________________ ___ _
FLOAT - - - - - - -- - - -- -"\iPcl'FLOA~INST
~
- - - - - - 1 2 osc. PERIODS------li
1+1
ALE~_ _ _ _ _ _ _ _ _ -'f\.'_.___
'--
PO INST ::1.< DARLn X DMA DATA OUT
WR \1..._ _ _ _- - J1 ,
- - - - - - - D M A C Y C L E - - - - - - - . ! - RESUME PROGRAM
EXECUTION
270427-30
8-47.
HARDWARE DESCRIPTION OF THE 83C152
I'WlJ '---
P2 ~...._ _ _ _ _ _ _S_AR_H_n_ _ _ _ _ _ _'X PCH
\'-----~/
- - I . - - - - - - O M A CYCLE _ _ _ _ _ _ _ 1 RESUME PROGRAM
,- , - EXECUTION
270427-31
ALE
'-
P2~~_ _ _ _~SA...R...
Hn~_ _ _ _Jx~ _____..... . ~ R...
Hn~_ ___JX~ __...Pc...H___
\ ....------1/
\ .....-----...1/
f-I,----------OMA CyCLE------------I- RES~~E~~~g~RAM
270427-32
ry, it first generates a Hold Request signal, HLD, and device which is to drive the DMA sends a Hold Re-
waits for a Hold Acknowledge signal, HLDA, before quest signal, HLD, to the C152. If the C152 is current-
. commencing the DMA operation. Note that program ly performing a DMA to or from External Data Memo-
execution continues while HLDA is awaited. The ry, it will complete this DMA before responding to the
DMA is not begun until a logical 0 is detected at the Hold Request. When the C152 responds to the Hold
HLDA pin. Then, once the DMA has begun, it goes to Request, it 'does so by activating a Hold Acknowledge
completion regardless of the logic level at HLDA. signal, HLDA. This indicates that the C152 will not
commence a new DMA to or from External Data
The protocol is activated only for DMAs (not for pro- Memory while HLD remains active.
gram fetches or MOVX operations), and only for
DMAs to or from External Data Memory. If the data Note that in the Arbiter Mode the C152 does not sus-
destination and source are both internal to the C152, pend program execution at all, even if it is executing
the HLD/HLDA protocol is not used. from external program memory. It does not surrender
use of its own bus.
The HLD output is an alternate function of port pin
P1.5, and the HLDA input is an alternate function of The Hold Request input, HLD, is at P1.5. The Hold
port pin 1>1.6. Acknowledge output, HLDA, is at P1.6. This
,8-48
inter HARDWARE DESCRIPTION OF THE 83C152
.. Vee
A l8Xl0kll
PO
83C152
ARB P2
.--
..- Viii 7
r- RD
ALE I - -
U •
§I-
HLD HLDA
r-v 3
7
3
~
~
ALE
HLD HLDA SWITCH
ALE
83C152
REa
I'- Viii PO
~ RD P2 l-
DATA
.P
LOW HIGH
, '------'
OE SHARED ADDR
WE RAM
270427-33
8-49
intJ HARDWARE DESCRIPTION OF THE 83C152
LOCAL BUS
ROM
PO \ r - - - ; - - ,
BOC152
REQ
P2
ViR PSEN
rrn ALE
SHARED BUS"
HLD HLDA
, ).- ...
\
\
\
,
, LOW
,
,
: ADDR~
I ,
~-~--~
I HIGH
,
,
I
, I
I
I
I
I
,,,
I
,
t-......-OE ,
WE ,'
\
... ~
I
THLDA T,
SYSTEM ARBITER
270427-35
8-50
inter HARDWARE DESCRIPTION OF THE 83C152
WR signal, is used to control the direction of the trans- Figure 4.9 shows the three tasks to which the internal
ceiver. This is to ensure that the transceiver will not try bus of the CI52 can be dedicated. In this figure, In-
to drive the local bus before the DMA has actually struction Cycle means the complete execution of a sin-
begun. gle instruction, whether it takes 1,2 or 4 machine cy-
cles. DMA Cycle means the transfer of a single data
RD from the Requester is ~cally ANDed with RD byte from source to destination, whether it takes 1 or 2
from the Arbiter to activate OE to the RAM. WR from machine cycles. (It takes 2 machine cycles.jf the desti-
the Requester can normally be hard-wired to WR from nation and source are both external to the CI52.) On-
the Arbiter to activate WE to the RAM. chip arbitration logic determines which type of cycle is
executed, according to the. following rules.
270427-36
8-51
HARDWARE DESCRIPTION OF THE 83C152
3. Channel 0 is in External .Demand Mode and an IDA (Increment Destination Address) If IDA = 1, the
External Demand flag is up; destination address' is automatically incremented after
4. Channel 0 is ·in Alternate Cycles Mode and Chan- each byte transfer. IfiDA =0, it is not..
nel 1 isn't, and the previous cycle was not a DMA
Cycle; SAS specifies the Source Address Space. If SAS = 0,
the source is in External Data Memory. If SAS = 1
5. Channel 0 and Channell are both in Alternate and ISA = 0, the source is an SFR. If SAS = 1 and
Cycles Mode, and the previous cycle was not a ISA = 1, the source is Internal Data RAM.
DMA Cycle, and the previous DMA Cycle was
not a DMAO cycle. ' ISA (Increment Source Address) If ISA = 1, the
• A DMAI Cycle is called for if GOI = 1 and no source address is automatically incremented after each
condition for a DMAO Cycle is satisfied, and any of byte transfer. If ISA.= 0, it is not.
the following conditions are satisfied:
1. Channel 1 Burst Mode is selected; DM (Demand Mode) If DM = 1, the DMA Channel
operates in Demand Mode. .In Demand Mode the
2~ Channel 1 is in SP Demand Mode and a SP De- DMA is initiated either by an external signal or by a
mand flag is up (but see "*); Serial Port flag, depending on the value of the TM bit.
3. Channel 1 is in External Dem~nd Mode and an If DM = 0, the DMA is requested by setting the GO
External Demand flag is up; bit in software.
4. Channel 1 is in Alternate Cycles Mode and Chan-
nel 0 isn't, and the previous cyCle was not a DMA TM (Transfer'Mode) If DM = 1 then TM selects
Cycle; whether a DMA is initiated by an external signal (TM
= I) or by a Serial Port flag (TM = 0). If DM = 0
5. Channel 1 and Channel 0 are both in Alternate then TM selects whether the data transfers are to be in
, Cycles Mode, and the previous cycle was not a bursts (TM = 1) or in alte~ate cycles (TM = 0).
DMA Cycle, and the previous DMA Cycle was
not a DMAI cycle. DONE indicates the completion of a DMA operation
"If a DMA Cycle is not called for, then an Instruc- and flags an interrupt. It is set to 1 by on-chip hardware
tion Cycle is executed. when BeRn = 0, and is cleared to 0 by on-chip hard-
*. A Special Case: Because of internal timing conflicts, ware when the interrupt is vectored to. It can also be
set or cleared by software.
a SP Demand Mode DMA Cycle in which the desti-
nation address is TFIFO will not be generated un-
less the previous cycle was an Instruction Cycle. GO is the enable bit for the DMA Channel itself. The
DMA Channel is inactive if GO = O.
Note that any time conditions are satisfied for a DMAO PCON I SMOD I ARB I REQ I GAREN I XRCLK I GFIEN I PDN IIDL I
Cycle, the DMAO Cycle will be executed, even if the
DMAI Channel is active. That is not to say a DMAI ARB enables the DMA logic to detect HLD and gener-
Cycle will be interrupted once it has begun. However, ate HLDA. After it has activated HLDA, the CI52 will
once a cycle has begun, be it,an'Instruction Cycle or a not begin a new DMA to or from External Data Mem-
DMA Cycle, it will be completed without interruption. ory as long as HLD is seen to be active. This logic is
disabled when ARB = 0, and enabled when ARB = 1.
If the HLD/HLDA logic is not disabled (either ARB
= i or REQ = i), then the HoidiHoid Acknowiedge
REQ enables the DMA logic to generate HLD and de-
protocol will also be observed, as previously described, tect HLDA before performing a DMA to or from Ex-
for DMAs to or from external RAM. ternal Data Memory. After it has activated HLD, the
C152 will not begin the DMA until HLDA is seen to be
active. This logic is disabled when REQ = 0, and en-
4.5 Summary of DMA Control Bits abled when REQ = 1.
DCONn I DAS I IDA I SAS liSA I OM I TM I DONE I GO I
8-52
inter HARDWARE DESCRIPTION OF THE 83C152
data on the GSC. If the address matches the SFR, then DCI - D.C. Jam, see MYSLOT.
the ClS2 accepts that frame. If in 8 bit addressing
mode, a match with any of the four registers will trigger DCONO/I (092H,093H)
acceptance. In 16 bit addressing mode, a match with 76543210
ADRl:ADRO or ADR3:ADR2 will be accepted. Ad-
dress length is determined, by GMOD, (AL).
AE - Alignment Error, see RSTAT. The DCON registers control the operation of the DMA
channels by determining the source of data to be trans-
AL - Address Length, see GMOD. ferred, the destination of the data to be transfer, and the
various modes of operation.
AMSKO,l (ODSH, OESH) - Address Match Mask 0,1 -
Identifies which bits in ADRO,l are "don't care" bits. DCON.O (GO) - Enables DMA Transfer - When set it
Setting a bit to 1 in AMSKO,l identifies the corre- enables a DMA channel. If block mode is set then
sponding bit in ADDRO,1 as not to be examined when DMA transfer starts as soon as possible under CPU
comparing addresses. control. If demand mode is set then DMA transfer
starts when a demand is asserted and recognized.
BAUD - (94H) Contains the programmable value for
the baud rate generator for the GSC. The baud rate will DCON.l (DONE) - DMA Transfer is Complete -
equal (fosc)/«BAUD+ 1) X 8). When set the DMA transfer is complete. It is set when
BCR equals 0 and is automatically reset when the
BCRLO,l (OE2H, OF2H) - Byte Count Register Low DMA vectors to its interrupt routine. If DMA inter-
0,1 - Contains the lower byte of the byte count. Used rupt is disabled and the user software executes a jump
during DMA transfers to identify to the DMA chan- on the DONE bit, then the user software must also
nels when the transfer is complete. . reset the done bit. If DONE is not set, then the DMA
transfer is not complete.
BCRHO,l (OE3H, OF3H) - Byte Count Register High
0,1 - Contains the upper byte of the byte. count. DCON.2 (TM) - Transfer Mode - When set, DMA
burst transfers are used if the DMA channel is config-
BKOFF (OC4H) - Backoff Timer - The backoff timer is ured in block mode or external interrupts are used to
an eight bit count-down timer with a clock period equal initiate a transfer if in Demand Mode. When TM is
to one slot time. The backoff time is used in the cleared, Alternate Cycle Transfers are used if DMA is
CSMA/CD collision resolution algorithm. in the Block Mode, or Local Serial channel/GSC inter-
rupts are used to initiate a transfer if in Demand Mode.
BOF - Beginning of Frame flag -. A term commonly
used when dealing with packetized data. Signifies the DCON.3 (DM) - DMA Channel Mode - When set,
beginning of a frame. Demand Mode is used and when cleared, Block Mode
is used.
CRC - Cyclic Redundancy Check - An error checking
routine that mathematically manipulates a value depen- DCON.4 (ISA) - Increment Source Address - When
dent on the incoming data. The purpose is to identify set, the source address registers are automatically incre-
when a frame has been received in error. mented during each transfer. When cleared, the source
address registers are not incremented.
CRCE - CRC Error, see RSTAT.
DCON.S (SAS) - Source Address Space - When set, the
CSMA/CD - Stands for Carrier Sense, Multiple Ac- source of data for the DMA transfers is internal data
cess, with Collision Detection. memory if autoincrement is also set. If autoincrement is
not set but SAS is, then the source for data will be one
CT - CRC Type, see GMOD. of the Special Function Registers. When SAS is cleared,
the source for data is external data memory.
DARLO/l (OC2H, OD2H) - Destination Address Reg-
ister Low 0/1 - Contains the lower byte of the destina- DCON.6 (IDA) -' Increment Destination Address
tions' address when performing DMA transfers. Space - When set, destination address registers are in-
cremented once after each byte is transferred. When
DARHO/I (OC3H, OD3H) - Destination Address Reg- cleared, the destination address registers are not auto-
ister Low 0/1 - Contains the upper byte of the destina- matically incremented.
tions' address when performing DMA transfers.
8-53
inter HARDWARE DESCRIPTION OF THE 83C152
8-54
inter HARDWARE DESCRIPTION OF THE 83C152
transmit clock. The input clock is applied to Pl.3 IE.2 (EXl) - Enables the external interrupt INTI on
(TxC). The user software is responsible for setting or P3.3.
clearing this flag. External receive clock is enabled by
setting PCON.3. IB.3 (ETI) - Enables the Timer 1 interrupt.
GO - DMA Go bit, see DCONO. IE.4 (ES) - Enables the Local Serial Channel interrupt.
GRxD - GSC Receive Data input, an alternate function IE.7 (EA) - The global interrupt enable bit. This bit
of one of the port I pins (P 1.0). This pin is used as the must be set to a 1 for any other interrupt to be enabled.
receive input for the GSC. PLO must be programmed
to a 1 for this function to operate. IENl - (OCSH)
76 5 4 3 2 1 0
GSC - Global Serial Channel - A high-level, multi-pro-
tocol, serial communication controller added to the IIIEGSTEIEDMA11EGSTVIEDMAOIEGSREIEGSRVI
SOC5lBH core to accomplish high-speed transfers of
packetized serial data. Interrupt enable register for DMA and GSC interrupts.
A 1 in any bit position enables that interrupt.
GTxD - GSC Transmit Data output, an alternate func-
tion of one of the port I pins (P 1.1). This pin is used as IENI.O (EGSRV) - Enables the GSC valid receive in-
the transmit output for the GSC. Pl.l must be pro- terrupt.
grammed to a I for this function to operate.
IEN1.1 (EGSRE) - Enables the GSC receive error in-
HBAEN - Hardware Based Acknowledge Enable, see terrupt.
RSTAT.
IENl.2 (EDMAO) - Enables the DMA done interrupt
HLDA - Hold Acknowledge, an alternate function of for Channel O.
one of the port 1 pins (Pl.6). This pin is used to per-
form the "HOLD ACKNOWLEDGE" function for IEN1.3 (EGSTV) - Enables the GSC valid transmit in-
DMA transfers. HLDA can be an input or an output, terrupt.
depending on the configuration of the DMA channels.
PI.6 must be programmed to a 1 for this function to IENl.4 (EDMAl) - Enables the DMA done interrupt
operate. for Channel 1.
HOLD - Hold, an alternate function of one of the port IEN1.5 (EGSTE) - Enables the GSC transmit error in-
1 pins (P1.5). This pin is used to perform the "HOLD" terrupt
function for DMA transfers. HOLD can be an input or
an output, depending on the configuration of the DMA IFS - (OA4H) Interframe Space, determines the number
channels. Pl.5 must be programmed to a 1 for this of bit tiflles separating transmitted frames.
function to operate.
IP (OBSH)
IDA - Increment Destination Address, see DCONO.
7 6 5 4 3 2 1 0
IE (OASH) I PS I PT1 I PX1 PTO PXO
765432 0
EA I ES I ET1 I EX1 I ETO EXO Allows the user software two levels of prioritization to
be assigned to each of the interrupts in IE. A 1 assigns
the corresponding interrupt in IE a higher interrupt
Interrupt Enable SFR, used to individually enable the than an interrupt with a corresponding O.
Timer and Local Serial Channel interrupts. Also con~
tains the global enable bit which must be set to a 1 to IP.O (PXO) - Assigns the priority of external interrupt,
enable any interrupt to be automatically recoguized by INTO. .
the CPU.
IP.1 (PTO) - Assigns the priority of Timer 0 interrupt,
IE.O (EXO) - Enables the external interrupt INTO on TO.
P3.2.
IP.2 (PXI)- Assigns the priority of external interrupt, Determines which type of Jam is used, which backoff
INTl. algorithm is used, and the DCR slot address for the
GSC. .
IP.3 (PTl) - Assigns the priority of Timer I interrupt,
Tl. MYSLOT.O,I,2,3,4,5 (SAO,I,2,3,4,5) - These bits deter-
mine which slot address is assigned to the CI52 when
IP.4 (PS) - Assigns the priority of the LSC interrupt, using deterministic backoff during CSMA/CD opera-
SBUF. tions on the GSC. Maximum slots available is 63. An
address of OOH prevents that station from participating
IPNI - (OFSH) in the backoff process.
76 5 4 3 2 1 0
I I I PGSTE I PDMA1 I PGSTV I PDMAO I PGSRE I PGSRV I MYSLOT.6 (DCR) - Determines which collision reso-
lution algorithm is used. If set to a I, then the determi-
Allows the user software two levels of prioritization to nistic backoff is used. If cleared, then a random slot
be assigned to each of the interrupts in IENl. A I as- assignment is used.
signs the corresponding interrupt in IENI a higher in-
terrupt than an interrupt with a corresponding O. MYSLOT.7 (DCJ) - Determines the type of Jam used
during CSMA/CD operation when a collision occurs.
IPNl.O (PGSRV) - Assigns the priority ofGSC receive If set to a I then a low D.C. level is used as the jam
valid interrupt. signal. If cleared, then CRC is used as the jam signal.
The jam is applied for a length of time equal to the
IPNl.l (PGSRE) - Assigns the priority of GSC error CRC length.
receive iriterrupt.
NOACK - No Acknowledgment error bit, see TSTAT.
IPN1.2 (PDMAO) - Assigns the priority of DMA done
interrupt for Channel O. NRZI - Non-Return to Zero inverted, a type of data
encoding where a 0 is represented by a change in the
IPNl.3 (pGSTV) - Assigns the priority of GSC trans- level of the serial link. A I is represented by no change.
mit viilid interrupt.
OVR - Overrun error bit, see RSTAT.
IPNl.4 (PDMAI) - Assigns the priority ofDMA done
interrupt for Channel 1. PR - Protocol select bit, see GMOD. PCON (S7H)
76543210
IPNI.5 (pGSTE) - Assigns the priority of GSC trans-
mit error interrupt. ISMoolARSIREOIGARENIXRCLKIGFIENlpollOLI
ISA - Increment Source Address, see DCONO. PCON.O (IDL) -Idle bit, used to place the CI52 into
the idle power saving mode.
LNI - Line Idle, see TSTAT.
PCON.I (PD) - Power Down bit, used to place the
LSC - Local Serial Channel - The as¥nchronous serial CI52 into the power down power saving mode.
port found onL'__
__ .l __
0_ ~_:' _ _
MCS-51
all __ devices. Uses start/stop bits
1._ 1 L __ ... _ _ ... _ ...: __ _
i1UU t,;UU UUUMCJ UJUY 1 UyLC ilL i1 LlIUt:. FCON.2 (GFIEN) - GSC Fiag Idie Enabie bit, when
set, enables idle flags (01111110) to be generated be-
MO - One of two GSC mode bits, see TMOD. tween transmitted frames in SDLC mode.
MI - One of two GSC mode bits, see TMOD PCON.3 (XRCLK) - External.Receive Clock bit, used
to enable an external clock to be used for only the re-
MYSLOT - (OF5H) ceiver portion of the GSC.
76543210
PCON.4 (GAREN) - GSC Auxiliary Receive Enable
bit, used to enable the GSC to receive back-to-back
SDLC frames. This bit has no effect in CSMA/CD
mode.
8-56
HARDWARE DESCRIPTION OF THE 83C152
PCON.5 (REQ) - Requester mode bit, set to a I when RFIFO - (F4H) RFIFO is a 3-byte FIFO that contains
CI52 is to be operated as the requester station during the receive data from the GSC.
DMA transfers.
RSTAT (OE8H) - Receive Status Register
PCON.6 (ARB) - Arbiter mode bit, set to a I when 76543210
CI52 is to be operated as the arbiter during DMA
transfers.
PCON.7 (SMOD) - LSC mode bit, used to double the RSTAT.O (HBAEN) - Hardware Based Acknowledge
baud rate on the LSC. Enable - If set, enables the hardware based acknowl-
edge feature.
PDMAO - Priority bit for DMA Channel 0 interrupt,
see IPNl. ' RSTAT.I (GREN) - Receiver Enable - When set, the
receiver is enabled to accept incoming frames. This also
PDMAI - Priority bit for DMA Channel I interrupt, clears RDN, CRCE, AE, RCABT and the receive
see IPNl. FIFO. It is cleared by the receiver at the end of a recep-
tion or if any errors occurred: The status of GREN has
PGSRE - Priority bit for GSC Receive Error interrupt, no effect on whether the receiver detects a collision in
see IPNl. CSMA/CD mode as the receiver input circuitry always
monitors the receive pin.
PGSRV - Priority bit for GSC Receive Valid interrupt,
see IPNl. RSTAT.2 (RFNE) - Receive FIFO Not Empty - If set,
indicates that the receive FIFO contains data. The re-
PGSTE - Priority bit for GSC Transmit Error inter- ceive FIFO is a three byte buffer into which the receive
rupt, see IPNl. data is loaded. A CPU read of the FIFO retrieves the
oldest data and automatically updates the FIFO point-
PGSTV - Priority bit for GSC Transmit Valid inter- ers. Setting GREN t9 a one will clear the receive FIFO.
rupt, see IPNl. The status of this flag is controlled by the GSC. This bit
is cleared if user S/W empties receive FIFO.
PLO - One of two bits that determines the Preamble
Length, see GMOD. RSTAT.3 (RDN) - Receive Done - If set, indicates the
successful completion of a receiver operation. Will not
PLI - One of two bits that determines the Preamble be set if a CRC, alignment, abort, or FIFO overrun
Length, see GMOD. error occurred.
PRBS - (OE4H) Pseudo-Random Binary Sequence, gen- RSTATA (CRCE) - CRC Error - Ifset, indicates that a
erates the pseudo-random number to be used in properly aligned frame was received with a mismatched
CSMA/CD backoff algorithms. CRC.
PS - Priority bit for the LSC service interrupt, see IP. RSTAT.5 (AE) - Alignment Error - If set, indicates
that the line went idle when the receiver shift register
PTO - Priority bit for Timer 0 interrupt, see IP. was not full and the resulting CRC was bad in the
CSMA/CD mode. If a correct CRC was valid then AE
PTl - Priority bit for Timer I interrupt, see IP. is not set. In SDLC mode, AE indicates that a non-
byte-aligned flag was received.
PXO - Priority bit for External interrupt 0, see IP.
RSTAT.6 (RCABT) - Receiver Collision/Abort Detect
PXI - Priority bit for External interrupt I, see IP. - If set, indicates that a collision was detected after data
had been loaded into the receive FIFO in CSMA/CD
RCABT - GSC Receiver Abort error bit, see RSTAT. mode. In SDLC mode, RCABT indicates that 7 consec-
utive ones were detected prior to the end flag but after
RDN - GSC Receiver Done bit, see RSTAT. data has been loaded into the receive FIFO.
GREN - GSC Receiver Enable bit, see RSTAT. RSTAT.7 (OVR) - Overrun - If set, indicates that the
receive FIFO was full and new shift register data was
RFNE - GSC Receive FIFO Not Empty bit, see written into it. It is cleared by user S/W.
RSTAT.
8-57
inter HARDWARE DESCRIPTION OF THE 83C152
SARHO (OA3H) - Source Address Register High 0, SP (OSIH) - Stack Pointer, an eight bit pointer register
contains the high byte of the source address for DMA used during a PUSH, POP, CALL, RET, or RETI.
Channel O.
TCDCNT - (OD4H) Contains the number of collisions
SARHI (OB3H) - Source Address Register High I, in the current frame if using probabilistic CSMA/CD
contains the high byte of the source address for DMA and contains the maximum number of slots in the de-
Channell. terministic mode.
SARLO (OA2H) - Source Address Register Low 0, con- TCDT - Transmit Collision Detect, see TSTAT.
tains the low. byte of the source address for DMA
Channel O. TCON(OSSH)
76543210
SARLI (OB2H) - Source Address Register Low I, con-
tains the low byte of the source address for DMA I TF1 I TA1 I TFO I TAO IIE1 IIT1 I lEO liTO I
Channell.
TCON.O (ITO) - Interrupt 0 mode control bit.
SAS - Source Address Space bit, see DCONO.
TCON.I (lEO) - External interrupt 0 edge flag.
SBUF (099H) - Serial Buffer, both the receive and
transmit SFR location for the LSC. TCON.2 (IT!) - Interrupt I mode control bit.
SCON(09SH) TCON.3 (lEI) - External interrupt I edge flag.
76543210
TCON.4 (TRO) - Timer 0 run controi bit.
I SMO I SM1 15M2 I AENI TB8 I AB8 I TI I AI I
CON.5 (TFO) - Timer 0 overflow flag.
SCON.O (RI) - Receive Interrupt flag.
TCON.6 (TRI) - Timer I run control bit.
SCON.I (TI) - Transmit Interrupt flag.
TCON.7 (TFI) - Timer I overflow flag.
SCON.2 (RBS) - Receive Bit S, contains the ninth bit
that was received in Modes 2 and 3 or the stop bit in TDN.- Transmit Done flag, see TSTAT.
Mode I if SM20. Not used in Mode O.
TEN - Transmit Enable bit, see TSTAT.
SCON.3 (TBS) - Transmit Bit S, the ninth bit to be
transmitted in Modes 2 and 3. . TFNF - Transmit FIFO Not Full flag, see TSTAT.
SCON.4 (REN) - Receiver Enable, enables reception TFIFO - (S5H) TFIFO is a 3-byte FIFO that contains
for the LSC. the transmission data for the GSC.
SCON.5 (SM2) - Enables the multiprocessor communi- THO (OSCH) - Timer 0 High byte, contains the high
cation feature in Modes 2 and 3 for the LSC. byte for timer/counter O.
ScON.6 (SMI) - LSC mode specifier. THI (OSDH) - Timer I High byte, contains the high
byte for timer/counter 1. .
SCON.7 (SM2) - LSC mode specifier.
TI - Transmit Interrupt, see SCON.
SDLC - Stands for Synchronous Data Link Communi-
cation and is a protocol developed by IBM. TLO (OSAH) - Timer 0 Low byte, coptains the low byte
for timer/counter O.
SLOTTM - (OB4H) Determines the length of the slot
time in CSMA/CD. TLI (OSBH) - Timer I Low byte, contains the low byte
for timerlCounter 1.
8-58
inter HARDWARE DESCRIPTION OFTHE 83C152
TMOD.O (MO) - Mode selector bit for Timer O. TSTAT.3 (TDN) - Transmit Done - When set, indi-
cates the successful completion of a frame ttansmission.
TMOD.l (Ml) - Mode selector bit for Timer O. If HBAEN is set, TDN will not be set until the end of
the IFS following the transmitted message, so that the
TMOD.2 (CIf) - Timer/Counter selector bit for acknowledge can be checked. If an acknowledge is ex-
TimerO. pected and not received, TDN is not set. An acknowl-
edge is not expected following a broadcast or multi-cast
TMOD.3 (GATE) - Gating Mode bit for Timer O. packet.
TMOD.4 (MO) - Mode selector bit for Timer 1. TSTAT.4 (TCDT) - Transmit Collision Detect - If set,
indicates that the transmitter halted due to a collision.
TMOD.5 (Ml) - Mode selector bit for Timer 1. It is set if a collision occurs during the data or CRC or
if there are more than eight collisions.
TMOD.6 (C/T) - Timer/Counter selector bit for
Timer L TSTAT.5 (UR) - Underrun - If set, indicates that in
DMA mode the last bit was shifted out of the transmit
TMOD.7 (GATE) - Gating Mode bit for Timer 1. register and that the DMA byte count did not equal
zero. When an underrun occurs, the transmitter halts
TSTAT (ODS) - Transmit Status Register without sending the CRC or the end flag.
7 6 5 4 32 1 0 TSTAT.6 (NOACK) - No Acknowledge - If set, indi-
ILNII NOACK I UR I TCOT ITON I TFNF I TEN IOMA I cates that no acknowledge was received for the previous
frame. Will be set only if HBAEN is set and no ac-
knowledge is received prior to the end of the IFS.
TSTAT.O (DMA) - DMA Select - If set, indicates that NOACK is not set following a broadcast or a multi-
'DMA channels are used to service the GSC FIFO's and cast packet.
GSC interrupts occur on TDN and RDN, and also en-
ables UR to become set. If cleared, indicates that the TSTAT.7 (LNI) - Line Idle - If set, indicates the re-
GSC is operating in it normal mode and interrupts oc- ceive line is idle. In SDLC protocol it is set if 15 consec-
cur on TFNE and RFNE.For more information on utive ones are received. In CSMA/CD protocol, line
DMA servicing please refer to the DMA section on idle is set if no transitions occur on GR X D for 1.6 bit
DMA serial demand mode (4.2.2.3). times after a required transition. LNI is cleared after a
transition on GRXD.
TSTAT.l (TEN) - Transmit Enable - When set causes
TDN, UR, TCDT, and NOACK flags to be reset and TxC - External Clock input for GSC transmitter.
the TFIFO cleared. The transmitter will clear TEN af-
ter a successful transmission, a collision during the UR - Underrun flag, see TSTAT.
data, CRC, or end flag. If cleared during a transmission
the GSC transmit pin goes to a steady state high level. XRCLK - External GSC Receive Clock Enable bit, see
This is the method used to send an abort character in· peON.
SDLC. Also DEN is forced to a high level. The end of
transmission is occurs whenever the TFIFO is emptied. XTCLK - External GSC Transmit Clock Enable bit,
seeGMOD.
8-59
MCS® . . 51 Programmer's Guide 9
and Instruction Set
MCS®-S1 PROGRAMMER'S GUIDE
AND INSTRUCTION SET
The information presented in this chapter is collected from the previous MCS®-51 chapters of this book. The
material has been selected and rearranged to form a quick and convenient reference for the programmers of the
MCS-51. This guide pertains specifically to the 8051, 8052 and 80C51.
The following list should make it easier to find a subject in this chapter.
Memory Organization
Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-2
Data Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-3
Direct and Indirect Address Area ........................................................ 9-5
Special Function Registers ............... ................................................. 9-7
Contents of SFRs after Power-On. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-8
SFR Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-9
Program Status Word (PSW). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-10
Power Control Register (PCON) . . :. . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . .. 9-10
Interrupts. . .. .. . .. .. .. . ... .. . . .. .. . .. .. .. . . . . . . . .. . ... .. . . .. .. .. .. . .. .. . . . .. .. .. ... . . . ... 9-11
Interrupt Enable Register (IE) ............................................................. : 9-11
Assigning Priority Level .......................... "......................................... 9-12
Interrupt Priority Register . ..................................................... , .. ... . . . . .. 9-12
Timer/Counter Control Register (TCON) ................................................... 9-13
Timer/Counter Mode Control Register {TMOD} ............................................. 9-13
Timer Set-Up . ....................... ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-14
Timer/Counter 0 .............................................. ...... ; ................... 9-14
Timer/Counter 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-15
Timer/Counter 2 Control Register (T2CON). . . ... .. . . .. .. .. .. .. . . . . .. .. . .. .. . .. .. .. ... ...... 9-16
Timer/Counter 2 Set-Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-17
Serial Port Control Register. . . . . . .. .... . . . . . . .. .. .. . . .. .. .. .. .. . . .. . . . .... . .. .. . . ... ... ... 9-18
Serial Port Set-Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-18
Generating Baud Rates ................................................................... 9-19
MCS-51 Instruction Set . ...... "................ ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 9-20
Instruction Definitions .................................................................... 9-24
9-1
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MEMORY ORGANIZATION
PROGRAM MEMORY
The 8051 has separate address spaces for Program Memory and Data Memory. The Program Memory can be up to
64K bytes long. The lower 4K (8K for the 8052) may reside on-chip.
Figure I shows a map of the 8051 program memory, and Figure 2 shows a map of the 8052 program memory.
FFFF r - - - - - - - - - - - . , "FFr-----------~
&OK
BYTES
EXTERNAL
14K
-OR BYTES
EXTERNAL
1~~---------~
AND
4KBYTES
INTERNAL
0000 ~---------~
270249-1
9-2
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
56 K
BYTES
EXTERNAL
64K
--OR-.....,..... BYTES
EXTERNAL
~~--------------~
AND
1 F F F r - - - - - - - - - - -....
8KBYTES
INTERNAL
~L-----------------~
0000 L-_________ ..J
270249-2
Data Memory:
The 8051 can address up to 64K bytes of Data Memory to the chip. The "MOVX" instruction is used to access the
external data memory. (Refer to the MeS-51 Instruction Set, in this chapter, for detailed description of instructions).
The 8051 has 128 bytes of on-chip RAM (256 bytes in the 8052) plus a number of Special Function Registers (SFRs).
The lower 128 bytes of RAM can be accessed either by direct addressing (MOV data addr) or by indirect addressing
(MOV @Ri). Figure 3 shows the 8051 and the 8052 Data Memory organization.
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
OFFFr------------------,
INTERNAL
FF..-------------,
84K
SFR. BYTES
DIRECT EXTERNAL
ADDRESSING
ONLY
~~--------~
7F - - AND -----l.,..
DIRECT.
INDIRECT
ADDRESSING
oo~--------~ ooooL-------------~
270249-3
FFFFr--------------------,
INTERNAL
f
INDIRECT
ADDRESSING ONLY
1,---1------, '"
FF
~HTOFFH
FF..---=-~------......,
84K
SFR. BYTES
DIRECT EXTERNAL
ADDRESSING
1-
ONLY
--AND . . . . . . .
~
7Fr--------------------i
DIRECT.
J
INDIRECT
ADDRESSING
oo~--------~
270249-4
9·4'
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOV 80H,#OAAH
writes OAAH to Port 0 which is one of the SFRs and the instruction
MOV RO,#80H
MOV @RO,#OBBH
writes OBBH in location 80H of the data RAM. Thus, after execution of both of the above instructions Port 0 will
contain OAAH and location 80 of the RAM will contain OBBH.
1. Register Banks 0-3: Locations 0 through IFH (32 bytes). ASM-51 and the device after reset default to register
bank O. To use the other register banks the user must select them in the software (refer to the MeS-5l Micro
Assembler User's Guide); Each register bank contains 8 one-byte registers, 0 through 7.
Reset initializes the Stack Pointer to location 07H and it is incremented once to start from location 08H which is the
first register (RO) of the second register bank. Thus, in order to use more'than one register bank, the SP should be
intialized to a different location of the RAM where it is not used for data storage (ie, higher part of the RAM).
2. Bit Addressable Area: 16 bytes have been assigned for this segment, 20H-2FH. Each one of the 128 bits of this
segment can be directly, addressed (0-7FH). '
The bits can be referred to in two ways both of which are acceptable by the ASM-51. One way is'to refer to their
addresses, ie. 0 to 7FH. The other way is with reference to bytes 20H to 2FH. Thus, bits 0-7 can also be referred to
as bits 20.0-20.7, and bits 8-FH are the same as 21.0-21.7 and so on. '
3. Scratch Pad Area: Bytes 30H through 7FH are available to the user as data RAM. However, if ~he stack pointer
has been initialized to this area, enough number of bytes should be left aside to prevent SP data destruction.
9-5
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
II-------8BylW
11....... - - - - - - - 1...1
78 7F
70 77
88 6F
60 67
SCRATCH
58 5F
PAD
50 57
AREA
48 4F
40 47
38 , 3F
30 37
28 ... 7F 2F BIT
ADDRESSABLE
20 O••• 27 SEGMENT
18 3 1F
10 2 17 REGISTER
08 1 OF BANKS
0 07
270249:"5
9-6
infef MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Comparing Table 1 and Figure 5 shows that all of the SFRs that are byte and bit addressable are located on the first
column of the diagram in Figure 5.
Table 1
9-7
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
9-8
MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
FB FF
FO B F7
EB EF
EO ACC E7
DB DF
DO PSW D7
CB T2CON RCAP2L RCAP2H TL2 TH2 CF
CO C7
BB IP BF
BO P3 B7
AB IE AF
AO P2 A7
98 SCON SBUF 9F
90 P1 97
B8 TCON TMOD TLO TL1 THO TH1 BF
BO PO SP DPL DPH PCON B7
t Figure 5
Bit
Addressable
9-9
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Those SFRs that have their bits assigned for various functions are listed in this section. A brief description of each bit
is provided for quick reference. For more detailed information refer to the Architecture Chapter of this book.
SMOD Double baud rate bit. If Timer I is used to generate baud rate and SMOD = I, the baud rate is doubled
when the Serial Port is used in modes I, 2, or 3.
Not implemented, reserved for future use.'
Not implemented, reserved for future use.'
Not implemented, reserved for future use.'
GFI General purpose flag bit.
GFO General purpose flag bit.
PD Power Down bit. Setting this bit activates Power Down operation in the 80CSIBH. (Available only in
CHMOS).
IDL Idle Mode bit. Setting this bit activates Idle Mode operation in the 80CSIBH. (Available only in CHMOS).
9-10
infef MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
INTERRUPTS:
In order to use any of the interrupts in the MCS-SI, the following three steps must be taken.
1. Set the EA (enable all) bit in the IE register to 1.
2. Set the corresponding individual interrupt enable bit in the IE register to 1.
3. Begin the interrupt service routine at the corresponding Vector Address of that interrupt. See Table below.
Interrupt Vector
Source Address
lEO 0003H
TFO OOOBH
IE1 0013H
TF1 001BH
RI&TI 0023H
TF2 & EXF2 002BH
In addition, for external interrupts, pins INTO and INTI (P3.2 and P3.3) must be set to I, and depending on whether
the interrupt is to be level or transition activated, bits ITO or ITI in the TCON register may need to be set to 1.
9-11
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Remember"that while an interrupt service is in progress, it cannot be interrupted tJy a lower or same level interrupt.
lEO
TFO
lEI
TFI
RI or TI
TF2 or EXF2
• :.0\
9-12
MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
M1 MO Operating Mode
o o o 13-bit Timer (MCS-48 compatible)
o 1 1 16-bit Timer/Counter
o 2 8-bit Auto-Reload TimerlCounter
1 3 (Timer 0) TLO is an 8-bit Timer/Counter controlled by the standard Timer 0
control bits, THO is an 8-bit Timer and is controlled by Timer 1 control bits.
3 (Timer 1) Timer/Counter 1 stopped.
9-13
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
TIMER SET·UP
Tables 3 through 6 give some values for TMOD which can be used to set up Timer 0 in different modes.
It is assumed that only one timer is being used at a time. If it is desired to run Timers 0 and 1 simultaneously, in any
mode, the value in TMOD for Timer 0 must be ORed .with the value shown for Timer 1 (Tables 5 and 6).
For example, if it is desired to run Timer 0 in mode 1 GATE (external control), and Timer 1 in mode 2 COUNTER,
then the value that must be loaded into TMoD is 69H (09H from Table 3 ORed with 60H from Table 6).
Moreover, it'is assumed that the user, at this point,. is not ready to tum the timers on and will do that at a different
point in the program by setting bit TRx (in TCON) to 1.
TIMER/COUNTER 0
As a Timer:
Table 3
TMOD
TIMER 0 INTERNAL EXTERNAL
MODE
FUNCTION CONTROL CONTROL
(NOTE 1) (NOTE 2)
0 13-bit Timer OOH 08H
1 16-bit Timer 01H 09H
2 8-bit Auto-Reload 02H OAH
3 two 8-bit Timers 03H OSH
As a Counter:
Table 4
TMOD
COUNTER 0 INTERNAL EXTERNAL
MODE
FUNCTION CONTROL CONTROL
(NOTE 1) (NOTE 2)
0 13-bit Timer 04H OCH
1 16-bit Timer 05H ODH
2 8-bit Auto-Reload OSH OEH
3 one 8-bit Counter 07H OFH
NOTES:
1. The Timer is turned ON/OFF by setting/clearing bit TRO in the software.
2. The Timer is turned ON/OFF by the 1 to 0 transition on INTO (P3.2) when TRO = 1
(hardware control).
9-14
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
TIMER/COUNTER 1
As a Timer:
TableS
TMOD
TIMER 1 INTERNAL EXTERNAL
MODE
FUNCTION CONTROL CONTROL
(NOTE 1) (NOTE 2)
0 13-bit Timer OOH BOH
1 16-bit Timer 10H 90H
2 B-bit Auto-Reload 20H AOH
3 does not run 30H BOH
As a Counter:
TableS
TMOD
COUNTER 1 INTERNAL EXTERNAL
MODE
FUNCTION CONTROL CONTROL
(NOTE 1) (NOTE 2)
0 13-bit Timer 40H COH
.1 16-bit Timer 50H DOH
2 B-bit Auto-Reload 60H EOH
3 not available - -
NOTES:
1. The Timer is turned ON/OFF by setting/clearing bit TR1 in the software.
2. The Timer is turned ON/OFF by the 1 to 0 transition on INT1 (P3.3) when TR1 = 1
(hardware control).
9-15
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
8052 Only
1 TF2 1 EXF2 RCLK TCLK .1 EXEN2 TR2 C/T2.1 CP/RL2
TF2 T2CON.7 Timer 2 overflow flag set by hardware and cleared by software. TF2 cannot be set when
either RCLK = I or CLK = I .
EXF2 T2CON. 6 Timer 2 externa!. flag set when either a capture or reload is caused by a negative transition on
T2EX, and EXEN2= 1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU
to vector to the Timer 2 interrupt routine. EXF2 must be cleared by software.
RCLK nCON. 5 Receive clock flag. When set, causes the Serial Port to use Timer 2 overflow pulses for its
receive clock in modes I & 3. RCLK = 0 causes Timer I overflow to be used for the receive
clock.
TLCK T2CON. 4 Transmit clock flag. When set, causes the Serial Port to use Timer 2 overflow pulses for its
transmit clock in modes I & 3. TCLK = 0 causes Timer I overflows to be used for the
transmit clock.
EXEN2 T2CON. 3 Timer 2 external enable flag. When set,' allows a capture or reload to occur as a result of
negative transition on T2EX if Timer 2 is not being used to clock the Serial Port.
EXEN2 = 0 causes Timer 2 to ignore events at T2EX.
TR2 T2CON.2 Software START/STOP control for. Timer 2. A logic I starts the Timer.
C/T2 T2CON. 1 Timer or Counter select.
o = Internal Timer. I = External Event Counter (falling edge triggered).
CP/RL2 T2CON.O Capture/Reload flag. When set, captures will occur on negative transitions at T2EX if
EXEN2 = 1. When cleared, Auto-Reloads will occur either with Timer 2 overflows or
negative transitions at T2EX when' EXEN2 = 1. When either RCLK = 1 or TCLK = I,
this bit is ignored and the Timer is forced to Auto-Reload on Timer 2 overflow.
9-16
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
TIMER/COUNTER 2 SET-UP
Except for the baud rate generator mode, the values given for T2CON do not include the setting of the TR2 bit.
Therefore, bit TR2 must be set, separately, to turn the Timer on.
As a Timer:
Table 7
T2CON
As a Counter:
TableS
TMOD
NOTES:
1. Capture/Reload occurs only on Timer/Counter overflow.
2. Capture/Reload occurs on Timer/Counter overflow and a 1 to 0 transition on T2EX
(P1.1) pin except when Timer 2 is used in the baud rate generating mode.
9-17
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Osc Freq
Baud Rate = - - -
12
B d R te = K x Oscillator Freq.
au a 32 x 12 x [256 - (TH111
If SMOD = 0, then K = 1.
If SMOD = I, then K = 2. (SMOD is the PCON register).
Most of the time the user knows the baud rate and needs to know the reload value for THI.
Therefore, the equation to calculate THI can be written as:
THI must be an integer value. Rounding off THI to the nearest integer may not produce the desired baud rate. In
this case, the user may have to choose another crystal frequency.
Since the PCON register is not bit addressable, one way to set the bit is logical ORing the PCON register. (ie, ORL
PCON,#80H). The address of PCON is 87H.
Osc Freq
Baud Rate = 32 x [65536 - (RCAP2H, RCAP2L))
To obtain the reload value for RCAP2H and RCAP2L the above equation can be rewritten as:
In this mode none of the Timers are used and the clock co~es from the internal phase 2 clock.
9-19
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
9-20
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
9-21
inter MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
9-22
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
9-23
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
INSTRUCTION DEFINITIONS
ACALL addr11
at location OI23H, SP will contain 09H, internal RAM locations OSH and 09H will contain
25H and OIH, respectively, and the PC will contain 0345H.
Bytes: 2
Cycles: 2
Operation: ACALL
(PC) - (PC) + 2
(SP) - (SP) + 1
«SP» - (PC7-O)
(SP) - (SP) + 1
«SP» - (PCIS-S)
(PCw_o) - page address
9-24
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Function: Add
Description: ADD adds the byte variable indicated to the Accumulator, leaving the result in the Accumula-
tor. The carry and auxiliary-carry flags are set, respectively, if there is a carry-out from bit 7 or
bit 3, and cleared otherwise. When adding unsigned integers, the carry flag indicates an
overflow occured..
OV is set if there is a carry-out of bit 6 but not out of bit 7, or a carry-out of bit 7 but not bit 6;
otherwise OV is cleared. When adding signed integers, OV indicates a negative number pro-
duced as the sum of two positive operands, or a positive sum from two negative operands.
Four source operand addressing modes are allowed: register, direct, register-indirect, or imme-
diate.
Example: The Accumulator holds OC3H (llOOOO1IB) and register 0 holds OAAH (10 10 10 lOB). The
instruction,
ADD A,RO
will leave 6DH (01 101 101B) in the Accumulator with the AC flag cleared and both the carry
flag and OV set to I.
ADD A,Rn
Bytes:
Cycles:
Encoding: I0 o 1 0 1 r r r
Operation: ADD
(A) ~ (A) + (Rn)
ADD A,direct
Bytes: 2
Cycles:
Operation: ADD
(A) ~ (A) + (direct)
9-25
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
ADD A,@RI
Bytes:
Cycles:
Operation: ADD
(A) - (A) + «R0)
ADD A,#data
Bytes: 2
Cycles:
Encoding:
1 00 1 0 o1 0 0 immediate data
Operation: ADD
(A)-(A) + # data
OV is set if there is a carry-out of bit 6 but not out of bit 7, or a carry-out ofbit.7 but not out of
bit 6; otherwise OV is cleared. When adding signed integers, OV indicates a negative number
produced as the sum of two positive operands or a positive sum from two negative operands.
Four source operand addressing modes are allowed: register, direct, register-indirect, or imme-
diate.
Example: The Accumulatpr holds OC3H (1 100001 IB) and register 0 holds OAAH (lOlOlOlOB) with the
carry flag set. The instruction,
ADDC A,RO
will leave 6EH (01101 1lOB) in the Accumulator with AC cleared and both the Carry flag and
OV set to 1. .
9-26
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
ADDC A,Rn
Bytes:
Cycles:
Encoding: 1,--0_O_l_-,--_l_r_r_r--l1
Operation: ADDC
(A) ~ (A) + (C) + (Rn)
AD DC A,direct
Bytes: 2
Cycles:
Operation: ADDC
(A) ~ (A) + (C) + (direct)
ADDC A,@Ri
Bytes:
Cycles:
Encoding: 10 0 1 1 0 1 1 i
Operation: ADDC
(A) ~ (A) + (C) + «Ri»
AD DC A,#data
Bytes: 2
Cycles:
9-27
inter MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
AJMP addr11
AJMP JMPADR
Cycles: 2
Encoding: I a10 a9 a8 0 0 0 0 1 a7 a6 a5 a4 a3 a2 a1 aO
Operation: AJMP
(PC) +- (PC) + 2
(PCIO-O) +- page address
The two operands allow six addressing mode combinations. When the destination is the Accu-
mulator, the source can use register, direct, register-indirect, or immediate addressing; when
the destination is a direct address, the source can be the Accumulator or immediate data.
Note: When this instruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.
Example: If the Accumulator holds OC3H (110000 11 B) and register 0 holds 55H (OlOlOlOlB) then the
instruction,
"A...NL LA..,RO
When the destination is a directly addressed byte, this instruction will clear combinations of
bits in any RAM location or hardware register. The mask byte determining the pattern of bits
to be cleared would either be a constant contained in the instruction or a value computed in
the Accumulator at run-time. The instruction, '
ANL Pl,#OlllOOllB
9-28
intJ MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
ANL A,Rn
Bytes:
Cycles:
Encoding:
1 01
o1 1 r r r
Operation: ANL
(A) ~ (A) A (Rn)
ANL A,direct
Bytes: 2
Cycles:
Operation: ANL
ANL A,@Ri
Bytes:
Cycles:
Encoding:
1 01
o1 o1 1
. Operation: ANL
ANL A, # data
Bytes: 2
Cycles:
Encoding:
1 01
o1 o10 0 immediate data
Operation: ANL
(A) ~ (A) A #data
ANL direct,A
Bytes: 2
Cycles:
Encoding: 1 01
o1 001 0 direct address
Operation: ANL
(direct) ~ (direct) A (A)
9-29
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Operation: ANL
(direct) +- (direct) " #data
ANL C,<src-bit>
ANL C,bit
Bytes: 2
Cycles: 2
Operation: ANL
(C) +- (C) " (bit)
ANL C,/bit
Bytes: 2
Cycles: 2
Operation: ANL
(C) +- (C) " I (bit)
9-30
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
sets the carry flag anc;l branches to the instruction at label NOT_EQ. By testing the carry flag,
this instruction determines whether R 7 is greater or less than 60H.
If the data being presented to Port I is also 34H, then the instruction,
clears the carry flag and continues with the next instruction in sequence, since the Accumula-
tor does equal the data read from Pl. (If some other value was being input on PI, the program
will loop at this point until the PI data changes to 34H.)
CJNE A,direct,rel
Bytes: 3
Cycles: 2
9-31
infef MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
CJNE A,#data,rel
Bytes: 3
Cycles: 2
CJNE Rn,#data,rel
Bytes: 3
Cycles: 2
CJNE @Ri,#data,rel
Bytes: 3
Cycles: 2
9-32
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
CLR A
CLR A
Encoding: 11 1 1 0 1 0 0
Operation: CLR
(A)~O
CLR bit
CLR P1.2
CLR C
Bytes:
Cycles:
Encoding: 11 0 0 0 0 1 1
Operation: CLR
(C)~O
CLR bit
Bytes: 2
Cycles:
Operation: CLR
(bit) ~O
9-33
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
CPL A
CPL A
Encoding: I1 1 1 0 1 0 0
Operation: CPL
(A) ..... -, (A)
CPL bit
Note: When this instruction is used to modify an output pin, the value used as the original data
will be read from the output data latch, not the input pin.
Example: Port 1 has previously been written with 5BH (Ol011101B). The instruction sequence,
CPL Pl.l
CPL P1.2
CFL C
Bytes:
Cycles:
Encoding: I1 0 1 1 0 0 1 1
Operation: CPL
(C) ..... -, (C)
9-34
intJ MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
CPL bit
Bytes: 2
Cycles:
Operation: CPL
(bit) - -, (bit)
DA A
If Accumulator bits 3-0 are greater than nine (xxxx 10 IO-xxxxi II 1), or if the AC flag is one,
six is added to the Accumulator producing the proper BCD digit in the low-order nibble. This
internal addition would set the carry flag if a carry-out of the low-order four-bit field propagat-
ed through all high-order bits, but it would not clear the carry flag otherwise.
If the carry flag is now set, or if the four high-order bits now exceed nine (1OIOxxxx-l1 lxxxx),
these high-order bits are incremented by six, producing the proper BCD digit in the high-order
nibble. Again, this would set the carry flag if there was a carry-out of the high-order bits, but
wouldn't clear the carry. The carry flag thus indicates if the sum of the original two BCD
variables is greater than 100, allowing multiple precision decimal addition. OV is not affected.
All of this occurs during the one instruction cycle. Essentiilily, this instruction performs the
decimal conversion by adding OOH, 06H, 60H, or 66H to the Accumulator, depending on
initial Accumulator and PSW conditions.
Note: DA A cannot simply convert a hexadecimal number in the Accumulator to BCD nota-
tion, nor does DA A apply to decimal subtraction.
9-35
inter MCS®·S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Example: The Accumulator holds the "value 56H (01010110B) representing the packed "BCD digits of the
decimal number 56. Register 3 contains the value 67H (OllOOllIB) representing the packed
BCD digits of the decimal number 67. The carry flag is set. The instruction sequence.
ADDC A,R3
DA A
will first perform a standard twos-complement binary addition, resulting in the value OBEH
(10111110) in the Accumulator. The carry and auxiliary carry flags will be cleared.
The Decimal Adjust instruction will then alter the Accumulator to the value 24H
(OOI00I00B), indicating "the packed BCD digits of the decimal number 24, the low-order two
digits of the decimal sum of 56, 67, and the carry-in. The carry flag will be set by the Decimal
Adjust'instruction, indicating that a decimal overflow occurred. The true sum 56, 67, and "1 is
124.
BCD variables can be incremented or decremented by adding 01H or 99H. If the Accumulator
initially holds 30H (representing the digits of 30 decimal), then the instruction sequence,
ADD A,#99H
DA A
will leave the carry set and 29H in the Accumulator, since 30 + 99 = 129. The low-order
byte of the sum can be interpreted to mean 30 - 1 = 29.
Bytes:
Cycles:
Encoding: I1 1 0 1 0 1 0 0
Operation: DA
-contents of Accumulator are BCD
IF [[(A3-O) > 9] V [(AC) = III
THEN(A3_0) +- (A3-0) + 6
AND
9-36
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
DEC byte
Function: Decrement
Description: The variable indicated is decremented by 1. An original value of DOH will underflow to OFFH.
No flags are affected. Four operand addressing modes are allowed: accumulator, register,
direct, or register-indirect. .
Note: When this instruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.
Example: °
Register contains 7FH (01111111B). Internal RAM locations 7EH and 7FH contain DOH
and 4OH, respectively. The instruction sequence,
DEC @RO
DEC RO
DEC @RO
DEC A
Bytes:
Cycles:
Encoding: _O_O_O_..L.0_ 1_ O
L...I _ 0--l
Operation: DEC
(A) +- (A) - 1
DEC Rn
Bytes:
Cycles:
Encoding: I °°°1 1 rr r
Operation: DEC
(Rn) +- (Rn) - 1
9-37
inter MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
DEC direct
Bytes: 2
Cycles:
Operation: DEC
(direct) - (direct) - 1
DEC @RI
Bytes:
Cycles:
Encoding: 1 000 1 o 11
Operation: DEC
«Ri» - «Ri» - 1
DIV AB
Function: Divide
Description: DIV AB divides the unsigned eight-bit integer in the Accumulator by the unsigned eight-bit
integer in register B. The Accumulator receives the integer part of the quotient; register B
receives the integer remainder. The carry and OV flags will be cleared.
Exception: if B had originally contained OOH, the values returned in the Accumulator and B-
register will be undefined and the overflow flag will be set. The carry flag is cleared in any
case.
Example: The Accumulator contains 251 (OFBH or 1111101lB) and B contains 18 (l2H or 0OOI00lOB).
The instruction,
DIV AB
will leave 13 in the Accumulator (ODH or 0000llOlB) and the value 17 (11H or 00010001B) .
in B, since 251 = (13 X 18) + 17. Carry and OV will both be cleared.
Bytes:
Cycles: 4
Encoding: 11 0 0 0 0 1 0 0 I·
Operation: DIV
(Ah5-8 _ (A)/(B)
(Bh.o
9-38
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Note: When this instruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.
Example: Internal RAM locations 40H, SOH, and 60H contain the values 01H, 70H, and ISH, respec-
tively. The instruction sequence,
DJNZ 40H,LABEL_l
DJNZ 50H,LABEL_2
DJNZ 60H,LABEL_3
will cause a jump to the instruction at label LABEL_2 with the values OOH, 6FH, and ISH in
the three RAM locations. The first jump was not taken because the result was zero.
This instruction provides a simple way of executing a program loop a given number of times,
or for adding a moderate time delay (from 2 to 512 machine cycles) with a single instruction.
The instruction sequence,
MOV R2,#8
TOGGLE: CPL P1.7
DJNZ R2,TOGGLE
will toggle Pl.7 eight times, causing four output pulses to appear at bit 7 of output Port 1.
Each pulse will last three machine cycles; two for DJNZ and one to alter the pin.
DJNZ Rn,rel
Bytes: 2
Cycles: 2
Operation: DJNZ
(PC) +- (PC) + 2
(Rn) +- (Rn) - 1
IF (Rn) > 0 or (Rn) < 0
THEN
(PC) +- (PC) + rei
9-39
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
DJNZ direct,rel
Bytes: 3
Cycles: 2
Operation: DJNZ
(PC) - (PC) + 2
(direct) - (direct) - 1
IF (direct) > 0 or (direct) < 0
THEN
(PC) - (PC) + rei
INC <byte>
Function: Increment
Description: INC increments the indicated variable by 1. An original value ofOFFH will overflow to OOH.
No flags are affected. Three addressing modes are allowed: register, direct, or register-indirect.
Note: When this instruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.
Example: Register 0 contains 7EH (011 11 11 lOB). Internal RAM locations 7EH and 7FH contain OFFH
and 4OH, respectively. The instruction sequence,
INC @RO
INC RO
INC @RO
will leave register 0 set to 7FH and internal RAM locations 7EH and 7FH holding (respective-
ly) OOH and 4lH.
INC A
Bytes:
Cycles:
I I
Encoding: I0 0 0 0 I 0 1 0 0
Operation: INC
(A) - (A) + 1
9-40
inter MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
INC Rn
Bytes:
Cycles:
Encoding: I 00 0 0 I 1 r r r
Operation: INC
(Rn) ~ (Rn) + 1
INC direct
Bytes: 2
Cycles:
Operation: INC
(direct) ~ (direct) +
INC @Ri
Bytes:
Cycles:
INC DPTR
INC DPTR
INC DPTR
INC DPTR
Encoding: I1 0 1 0 0 0 1 1
Operation: INC
(DPTR) ~ (DPTR) + 1
9-41
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
JB blt,rel
JB P1.2,LABELl
JB ACC.2,LABEL2
Operation: JB
(PC) - (PC) + 3
/
IF (bit) = 1
THEN
(PC) - (PC) + rei
JBC bit,rel
Note: When this instruction is used to test an output pin, the value used as the original data
will be read from the output data latch, not the input pin.
Example: The Accumulator holds 56H (0 10 10 1l0B). The instruction sequence,
JBC ACC.3,LABELl
JBC ACC.2,LABEL2
will cause program execution to continue at the instruction identified by the label LABEL2,
with the Accumulator modified to 52H (0 10 1OOlOB).
9-42
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
Bytes: 3
Cycles: 2
Operation: mc
(PC) <E- (PC) + 3
IF (bit) = I
THEN
(bit) <E- °
(PC) <E- (PC) + rei
JC rei
JC LABELl
CPL C
JC LABEL 2
will set the carry and cause program execution to continue at the instruction identified by the
label LABEL2.
Bytes: 2
Cycles: 2
Operation: JC
(PC) <E- (PC) + 2
IF (C) = I
THEN
(PC) <E- (PC) + rei
9-43
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
JMP @A+DPTR
MOV DPTR,#JMP_TaL
JMP @A+DPTR
AJMP LABELO
AJMP LABELl
AJMP LABEL2
AJMP LABE;L3
If the Accumulator equals 04H when starting this sequence, execution will jump to label
LABEL2. Remember that AJMP is a two-byte -instruction, so the jump instructions start at
every other address.
Bytes:
Cycles: 2
Encoding: I0 1 1 0 0 1 1
Operation: JMP
(PC) +-- (A) + (DPTR)
9-44
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
JNB bit,rel
JNB P1.3,LABELI
JNB ACC.3,LABEL2
Operation: JNB
(PC) +- (PC) + 3
IF (bit) = °
THEN (PC) +- (PC) + reI.
JNC reI
JNC LABELl
CPL C
JNC LABEL2
will clear the carry and cause program execution to continue at the instruction identified by
the label LABEL2.
Bytes: 2
Cycles: 2
EncodIng: 1-1_0_ _
0_1--,-_0_0_0_0-, reI. address
Operation: JNC
(PC) +- (PC) + 2
IF (C) = °
THEN (PC) +- (PC) + rei
9-45
inter MCS®~51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
JNZ rei
JNZ LABELl
INC A
JNZ LABEL2
Cycles: 2
JZ rei
JZ LABELl
DEC A
JZ LABEL2
will change the Accumulator to OOH and cause program execution to continue at the instruc-
tiori identified by the label LABEL2.
Bytes: 2
Cycles: 2
Encoding: 1 ° ° °°°°
1 1 reI. address
Operation: JZ
(PC) ~ (PC) + 2
IF (A) = 0
THEN (PC) ~ (PC) + rei
9-46
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
LCALL addr16
LCALL SUBRTN
at location 0123H, the Stack Pointer will contain 09H, internal RAM locations OSH and 09H
will contain 26H and OIH, and the PC will contain 1234H.
Bytes: 3
Cycles: 2
Encoding: ..._O_O_O_->-_O_O_1_0...J
1 addr15-addrB addr7-addrO
Operation: LCALL
(PC) ~ (PC) + 3
(SP) ~ (SP) + I
«SP» ~ (PC7-0)
(SP) ~ (SP) + I
«SP» ~ (PCI5-S)
(PC) ~ addrl5_0
LJMP addr16
UMP JMPADR
Encoding: 1 ° °0·1 °° °
0 1 addr15-addrB addr7 -addrO
Operation: LJMP
(PC) ~ addft5_0
9-47
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
This is by far the most flexible operation. Fifteen combinations of source and destination
addressing modes are allowed.
Example: Internal RAM location 30H holds 40H. The value of RAM location 40H is IOH. The data
present at input port I is 1100 10 lOB (OCAH).
leaves the value 30H in register 0, 40H in both the Accumulator and register 1, lOR in register
B, and OCAR (llOOIOIOB) both in RAM location 40R and output on port 2.
MOV A,Rn
Bytes:
Cycles:
Encoding: 11 1 1 0 1 r r r
Operation: MOY
(A) -(Rn)
·MOV A,dlrect
Bytes: 2
Cycles:
Operation: MOY
(A) - (direct)
9-48
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOV A,@Ri
Bytes:
Cycles:
Encoding: I1 1 1 0 o1
Operation: MOV
(A) -- «Ri»
MOV A, # data
Bytes: 2
Cycles:
Operation: MOV
(A) -- #data
MOV Rn,A
Bytes:
Cycles:
Encoding: I 1 111 1 r r r
Operation: MOV
(Rn) -- (A)
MOV Rn,direct
Bytes: 2
Cycles: 2
Operation: MOV
(Rn) -- (direct)
Encoding:
1 01
11 1 r r r immediate data
Operation: MOV
(Rn) -- #data
9-49
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOV dlrect,A
Bytes: 2
Cycles:
Operation: MOV
(direct) +- (A)
MOV direct,Rn
Bytes: 2
Cycles: 2
Operation: MOV
(direct) +- (Rn)
MOV dlrect,direct
Bytes: 3
Cycles: 2
Operation: MOV
(direct) +- (direct)
MOV direct,@Ri
Bytes: 2
Cycles: 2
Operaiiuii: 1I.'1"'\.T.7
IVIVY
(direct) +- «Ri»
MOV direct,#data
Bytes: 3
Cycles: 2
Operation: MOV
(direct) +- #data
9-50
inter MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOV @Ri,A
Bytes:
Cycles:
Operation: MOV
«Ri» ~ (A)
MOV @RI,dlrect
Bytes: 2
Cycles: 2
Operation: MOV
«Ri» ~ (direct)
MOV @Ri,#data
Bytes: 2
Cycles:
Operation: MOV
«RI» ~ #data
MOV pl.3,e
MOV e,P3.3
MOV p1.2,e
will leave the carry cleared and change Port 1 to 39H (OOlllOOlB).
9-51
inter MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOV C,bit
Bytes: 2
Cycles: . 1
Operation: MOV
(C) +- (bit)
MOV bit,C
Bytes: 2
Cycles: 2
Operation: MOV
. (bit) +- (C)
MOV DPTR,#data16
will load the value 1234H into the Data Pointer: DPH will hold 12H and DPL will hold 34H.
Bytes: 3
Cycles: 2
Operation: MOV
(DPTR) +- #data15.0
DPH 0 DPL +- #data15_8 0 #data7.Q
9-52
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
REL_PC: INC A
MOVC A,@A+PC
RET
DB 66H
DB 77H
DB 88H
DB 99H
If the subroutine is called with the Accumulator equal to OlH, it will return with 77H in the
Accumulator. The INC A before the MOVC instruction is needed to "get around" the RET
instruction above the table. If several bytes of code separated the MOVe from the table, the
corresponding number would be added to the Accumulator instead ..
MOVC A,@A+DPTR
Bytes:
Cycles: 2
Encoding: I1 0 0 1 0 0 1 1
Operation: MOVC
(A) +- «A) + (DPTR»
MOVC A,@A + PC
Bytes:
Cycles: 2
Encoding: I1 0 0 0 0 0 1 1
Operation: MOVC
(PC) +- (PC) + 1
(A) +- «A) + (PC»
9-53
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
In the first type, the contents of Rq or Rl in the current register bank provide an eight-bit
address multiplexed with data on PO. Eight bits are sufficient for external I/O expansion
decoding or for a relatively small RAM array. For somewhat larger arrays, any output port
pins can be used to output higher-order address bits. These pins would be controlled by an
, .output instruction preceding the MOVX.
In the second type of MOVX instruction, the Data Pointer generates a sixteen-bit address. P2
outputs the high-order eight address bits (the contents of DPH) while PO multiplexes the low-
order eight bits (DPL) with data., The P2 Special Function Register retains its previous con-
tents while the P2,output buffers are emitting the contents of DPH. This form is faster and
more efficient when accessing very large data arrays (up to 64K bytes), since no additional ,
instructions are needed to set up the output ports.
It is possible in some situations to mix the two MOVX types. A large RAM array with its
high-order address lines driven by P2 can be addressed via the Data Pointer, or with code to
, output high-order address bits to P2 followed by a MOVX instruction using RO or Rl.
Example: An external 256 byte RAM using multiplexed address/data lines (e.g., an Intel 8155 RAM/
I/O/Timer) is connected to the 8051 Port O. Port 3 provides control lines for the external
RAM. Ports 1 and 2 are used for normal I/O. Registers 0 and' 1 contain 12H and 34H.
Location 34H,of the external RAM holds the value 56H. The instruction sequence,
MOVX A,@Rl
MOVX @RO,A
copies the value 56H into both the Accumulator and external RAM location 12H.
9-54
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
MOVX A,@Ri
Bytes:
Cycles: 2
Operation: MOVX
(A) - «Ri»
MOVX A,@DPTR
Bytes:
Cycles: 2
Operation: MOVX
(A) - «DPTR»
MOVX @Ri,A
Bytes:
Cycles: 2
Encoding: I1 1 1 1 001
Operation: MOVX
«Ri» - (A)
MOVX @DPTR,A
Bytes:
Cycles: 2
Encoding: I 1 1 1 1 o0 0 0
Operation: MOVX
(DPTR)-(A)
9-55
inter MCS®-S1 PROGRAMMER'S GUIDE AND INSTRUCTION SET
NOP
Function: No Operation
Description: Execution continues at the following instruction. Other than the PC, no registers or flags are
affected. .
Example: It is desired to produce a low-going output pulse on bit 7 of Port 2 lasting exactly 5 cycles. A
simple SETB/CLR sequence would generate a one-cycle pulse, so four additional cycles must
be inserted. This may be done (assuming no interrupts are enabled) with the instruction
sequence,
CLR P2.7
NOP
NOP
NOP
NOP
SETB P2.7
Bytes:
Cycles:
Encoding: 1 0 0 0 0 1- 0 0 0 0 1
Operation: NOP
(pC)-(PC) +
MUL AB
Function: Multiply
Description: MUL AB multiplies the unsigned eight-bit integers in the Accumulator and register B. The
low-order byte of the sixteen-bit product is left inthe Accumulator, and the high-order byte in
B. If the product is greater than 255 (OFFH) the overflow flag is set; otehrwise it is cleared.
The carry flag is always cleared.
Example: Originally the Accumulator holds the value 80 (50H). Register. B holds the value 160 (OAOH).
The instruction,
MUL AB
will give the product 12,800 (32ooH), so B is changed to 32H (ooIIOOlOB) and the Accumula-
tor is cleared. The overflow flag is set, carry is cleared.
Bytes:
Cycles: 4
Encoding: 1 1 0 1 0 0 1 0 0
Operation: MUL
(Ah-o - (A) X (B)
(BhS-8
9-56
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
The two operands allow six addressing mode combinations. When the destination is the Accu-
mulator, the source can use register, direct, register-indirect, or immediate addressing; when
the destination is a direct address, the source can be the Accumulator or immediate data.
Note: When this instruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.
Example: If the Accumulator holds OC3H (l 100001 IB) and RO holds 55H (OlOlOIOIB) then the in-
struction,
ORL A,RO
When the destination is a directly addressed byte, the instruction can set combinations of bits
. in any RAM location or hardware register. The pattern of bits to be set is determined by a
mask byte, which may be either a constant data value in the instruction or a variable computed
in the Accumulator at run-time. The instruction,
ORL, PI,#OOIIOOIOB
ORL A,Rn
Bytes:
Cycles:
Encoding: I0 1 0 0 1 r r r
Operation: ORL
(A) ~ (A) V (Rn)
9-57
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
ORL A,dlrect
Bytes: 2
Cycles:
Operation: ORL
(A) - (A) V (direct)
ORL A,@Ri
Bytes:
Cycles:
Encoding: 1 01
00 o1 1 i
Operation: ORL
(A) - (A) V «Ri»
ORL A, # data
. Bytes: 2
Cycles:
".
Encoding: I0 1 o0 I o 1 0 0 immediate data
I
Operation: ORL
(A) - (A) V #data
ORL dlrect,A
Bytes: 2
Cycles:
Operation: ORL
(direct) - (direct) V (A)
Encoding: 1 01
o0 001 1 direct addr. immediate data
Operation: ORL
(direct) - (direct) V #data
9-58
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
ORL C,<src-blt>
ORL C,bit
Bytes: 2
Cycles: 2
Operation: ORL
(C) -- (C) V (bit)
ORL C,Ibit
_ Bytes: 2
Cycles: 2
Operation: ORL
(C) -- (C) V (bit)
9-59
intJ MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
POP direct
POP DPH
POP DPL
will leave the Stack Pointer equal to the value 30H and the Data Pointer set to 0123H. At this
point the instruction,
POP SP
will leave the Stack Pointer set to 20H. Note that in this special case the Stack Pointer was
decremented to 2FH before being loaded with the value popped (20H).
Bytes: 2
Cycles: 2
Operation: POP
(direct) -+-- «SP»
(SP) -+-- (SP) - 1
PUSH direct
PUSH DPL
PUSH DPH
will leave the Stack Pointer set to OBH and store 23H and OlH in internal RAM locations
OAH and OBH, respectively.
Bytes: 2
Cycles: 2
Operation: PUSH
(SP) -+-- (SP) + 1
«SP» -+-- (direct)
9-60
inter MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
RET
RET
will leave the Stack Pointer equal to the value 09H. Program execution will continue at
location 0123H.
Bytes:
Cycles: 2
Encoding: I0 0 1 0 0 0 1 0
Operation: RET
(PCIS-S) +- «SP»
(SP) +- (SP) - 1
(PC7-0) +- «SP»
(SP) +- (SP) - 1
RETI
RET!
will leave the Stack Pointer equal to 09H and return program execution to location 0123H.
Bytes:
Cycles: 2
Encoding: _ _~_O_O_1_0--,
,-1_O_O
Operation: RET!
(PCIS-S) +- «SP»
(SP) +- (SP) - 1
(PC7-0) +- «SP»
(SP) +- (SP) - 1
9-61
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
RL A
RLA
leaves the Accumulator holding the value 8BH (IOOOlOllB) with -the carry unaffected.
Bytes:
Cycles:
Encoding: I °0 1 0 0 0 1 1
Operation: RL
(An + I) - (An) n = 0 - 6
(AO) - (A7)
RLC A
RLC A
leaves the Accumulator holding the value 8BH (IOOOIOlOB) with the carry set.
Bytes:
Cycles:
Encoding: LI_o_O_1_--,-_O_O_1_1....J
Operation: RLC
(An + 1) - (An) n = 0 -:- 6
(AO) - (C)
(C) -(A7)
9-62
intJ MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTIO!ll SET
RR A
RR A
leaves the Accumulator holding the value OE2H (11 1000 lOB) with the carry unaffected.
Bytes:
Cycles:
Encoding: I0 0 0 0 I0 0 1 1
Operation: RR
(An) +- (An + I) n = 0 - 6
(A7)+- (AO)
RRC A
RRC A
.leaves the Accumulator holding the value 62 (01 1000 lOB) with the c!lrry set.
Bytes:
Cycles:
Encoding: I0 0 0 1 O. 0 1 1
Operation: RRC
(An) +- (An t I) n = 0 - 6
(A7) +- (C)
(C) +- (AO)
9-63
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
SETB <bit>
SETB C
SETB Pl.O
wi11leave the carry flag set to 1 and change the data output on Port 1 to 3SH (OOllOlOlB).
SETB C
Bytes:
Cycles:
SETB bit
Bytes: 2,
Cycles:
Operation: SETB
(bit) +- 1
9-64
MCS®·51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
SJMP rei
SJMP RELADR
will assemble into location OlOOH. After the instruction is executed, the PC will contain the
value 0123H.
(Note: Under the above conditions the instruction following SJMP will be at 102H. Therefore,
the displacement byte of the instruction will be the relative offset (OI23H-OI02H) = 21H. Put
another way, an SJMP with a displacement ofOFEH would be a one-instruction infinite loop.)
Bytes: 2
Cycles: 2
Operation: SJMP
(PC) +- (PC) + 2
. (PC) +- (PC) + rei
,9-65
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
SUBB A,<src-byte>
When subtracting signed integers OV indicates a negative number produced when a negative
value is subtracted from a positive value, or a positive result when a positive number is
subtracted from a negative number.
The source operand allows four addressing modes: register, direct, register-indirect, or imme-
diate.
Exarriple: The Accumulator holds OC9H (llOOlOOlB), register 2 holds S4H (0 10 10 1OOB), and the carry
flag is set. The instruction,
SUBB A,R2
will leave the value 74H (01 110100B) in the accumulator, with the carry flag and AC cleared
but OV set.
Notice that OC9H minus S4H is 7SH. The difference between this and the above result is due
to the carry (borrow) flag being set before the operation. If the state of the carry is not known
before starting a single or multiple-precision subtraction, it should be explicitly cleared by a
CLR C instruction. .
SUBB A,Rn
Bytes:
Cycles:
Encoding: LI_1_0_0_1...J.._1_r_r_r..j
Operation: SUBB
(A) ~ (A) - (C) - (Rn)
9-66
intJ MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
SUBB A,direct
Bytes: 2
Cycles:
Operation: SUBB
(A) - (A) - (C) - (direct)
SUBB A,@Ri
Bytes:
Cycles:
Operation: SUBB
(A) - (A) - (C) - «Ri»
SUBB A, # data
Bytes: 2
Cycles:
SWAP A
SWAP A
Encoding: I1 1 0 0 0 1 0 0
Operation: SWAP
(A3-O) ~ (A7-4)
9-67
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
XCH A,<byte>
XCH A,@RO
will leave RAM location 20H holding the values 3FH (0011 11 11 B) and 75H (Ol1lOlOlB) in
the accumulator.
XCH A,Rn
Bytes:
Cycles:
Encoding: 1 1 100 1, r r r
Operation: , XCH
(A) -;. (Rn)
XCH A,direct
Bytes: 2
Cycles:
Operation: XCH
(A) -;. (direct)
XCH A,@Ri
Bytes:
Cycles:
Operation: XCH
(A) -;. «Ri»
9-68
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
XCHD A,@RI
XCHD A,@RO
will leave RAM location 20H holding the value 76H (Oil 101 lOB) and 35H (OOllOlOlB) in the
Accumulator.
Bytes:
Cycles:
Encoding: _1_1_0_1--,-_0_1_1--,
LI
Operation: XCHD
(A3.Q) ~ «Ri3.Q»
XRL <dest-byte>,<src-byte>
The two operands allow six addressing mode combinations. When the destination is the Accu-
mulator, the source can use register, direct, register-indirect, or immediate addressing; when
the destination is a direct address, the source can be the Accumulator or immediate data.
(Note: When this illstruction is used to modify an output port, the value used as the original
port data will be read from the output data latch, not the input pins.)
Example: If the Accumulator holds OC3H (IlOOOOllB) and register 0 holds OAAH (10 1010 lOB) then
the instruction, .
XRL A,RO
When the destination is a directly addressed byte, this instruction can complement combina-
tions of bits in any RAM location or hardware register. The pattern of bits to be complement-
ed is then determined by a mask byte, either a constant contained in the instruction or a
variable computed in the Accumulator at run-time. The instruction,
XRL Pl,#OOllOOOlB
9-69
MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
XRL A,Rn
Bytes:
Cycles:
Operation: XRL
(A) +- (A) ¥ (Rn)
XRL A,direct
Bytes: 2
Cycles:
Operation: XRL
(A) +- (A) ¥ (direct)
XRL A,@RI
Bytes:
Cycles:
Encoding: I0 1 1 0 o1 1 i
Operation: XRL
(A) +- (A) ¥«Ri»
XRL A,#data
Bytes: 2
Cycles:
Encoding:
1 01 1 0 o1 0 0 immediate data
I
Operation: XRL
(A) +- (A) ¥ #data
XRL dlrect,A'
Bytes: 2
Cycles:
Operation: XRL
(direct) +- (direct) ¥ (A)
9-70
inter MCS®-51 PROGRAMMER'S GUIDE AND INSTRUCTION SET
XRL direct,#data
Bytes: 3
Cycles: 2
Operation: XRL
(direct) <E- (direct) V #data
9-71
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
MCS® . . 51 Data Sheets,
Application Notes,
10
Development Support
Tools and Index
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
intJ MCS®-51
8-BIT CONTROL-ORIENTED MICROCOMPUTERS
8031/8051
8031 AH/8051 AH
8032AH/8052AH
8751H/8751H-8
• High Performance HMOS Process
• Boolean Processor
• 2-Level
Internal Timers/Event Counters
• Programmable
Bit-Addressable RAM
• 32 I/O Lines
Interrupt Priority Structure
• Full Duplex Serial
The 8751H is an EPROM version of the 8051AH; that is, the on-chip Program Memory can be electrically
programmed, and can be erased by exposure to ultraviolet light. It is fully compatible with its predecessor, the
8751-8, but incorporates two new features: a Program Memory Security bit that can be used to protect the
EPROM against unauthorized read-out, and a programmable baud rate modification bit (SMOD). The 8751H-8
is identical to the 8751 H but only operates up to 8 MHz.
October 1987
10-1 Order Number: 270048-003
inter MCS®"51
POD PO 1 P2~P21
r----~-----·~~~ .~~~------------~,
Vcc
y==-l .
~
= I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I r---.,---.
PHii
ALE
Ei
RST~
I L.....---r....L..--I
I
I
I
I
L
XTAll
o P1.0-Pl." P3.0-P3.7
~
270048-1
PIN DESCR!PT!ONS Port 0 pins that have 1S written to them float, and in
that state can be used as high-impedance inputs.
10-2
intJ MCS®-51
270048-2
Pin
10-3
intJ
RST Note, however, that if the Security Bit in the EPROM
devices is programmed, the device will not fetch
Reset input. A high on this pin for two machine cy- code from any location in external Program Memory.
cles while the oscillator is running resets the device.
This pin also receives the 21 V programming supply
voltage (VPP) during programming of the EPROM
ALE/PROG parts.
OSCILLATOR CHARACTERISTICS
XTAL 1 and XTAl2 are the input and output, respec-
Program Store Enable is the read strobe to external tively, of an inverting amplifier which can be config-
Program Memory. ured for use as an on-chip oscillator, as shown in
Figure 3. Either a quartz crystal or ceramic resonator .
When the device is executing code from external may be used. More detailed information concerning
Program Memory, PSEN is activated twice each ma- the use of the on-chip oscillator is available in Appli-
chine cycle, except that two PSEN activations are cation Note AP-155,"Oscillators for Microcontrol-
skipped during each access to external Data Memo: lers."
ry.
To drive the device from an external clock source,
XTAl1 should be grounded, while XTAl2 is driven,
EA/VPP as shown in Figure 4. There are no requirements on
the duty cycle of the external clock Signal, since the
External Access enable EA must be strapped to input to the internal clocking circuitry is through a
VSS in order to enable any MeS-51 device to fetch divide-by-two flip-flop, but minimum and maximum
code froiT) external Program memory locations 0 to high and low times specified on the Data Sheet must
OFFFH (0 to 1FFFH, in the 8032AH and 8052AH). be observed. .
r--11
C2
, I XTAL2
EXTERNAL
OSCILLATOR
SIGNAL
---i XTAL2
-L
D
____--I XTAL 1
XTAL1
Cl
270048-4 270048-5
Cl , C2 ~ 30 pF ± 10 pF for Crystals
~ 40 pF ± 10 pF for Ceramic Resonators Figure 4. External Drive Configuration
Figure 3. Oscillator Connections
10-4
inter MCS®·51
ABSOLUTE MAXIMUM RATINGS· "Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias ...... O·C to 70·C age to the device. This is a stress rating only and
Storage Temperature .......... - 65·C to + 150·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAIVpp Pin to Vss ... -0.5V to + 21.5V tional sections of this specification is not implied Ex-
Voltage on Any Other Pin to Vss .... - 0.5V to + 7V posure to absolute maximum rating conditions for
Power Dissipation ..............•........... 1.5W extended periods may affect device reliability.
D.C. CHARACTERISTICS TA = ,
0·Ct070·C·Vee = 5V ±10%;Vss = ov
Symbol Parameter Min Max Units Test Conditions
VIL Input Low Voltage (Except EA Pin of -0.5 0.8 V
8751 H & 8751 H-8)
VIL1 Input Low Voltage to EA Pin of 0 0.7 V
8751 H & 8751H-8
VIH Input High Voltage (Except XTAL2, 2.0 Vee + 0.5 V
RST)
VIH1 Input High Voltage to XTAL2, RST 2.5 Vee + 0.5 V XTAL1 = VSS
VOL Output Low Voltage (Ports 1, 2, 3)" 0.45 V IOL = 1.6 mA
VOL1 Output Low Voltage (Port 0, ALE, PSEN)*
8751 H, 8751 H-8 0.60 V IOL = 3.2mA
0.45 V IOL = 2.4 mA
All Others 0.45 V IOL = 3.2mA
VOH Output High Voltage (Ports 1, 2, 3, ALE, PSEN) 2.4 V IOH = -80/LA
VOH1 Output High Voltage (Port 0 in 2.4 V IOH = -400/LA
External Bus Mode)
IlL Logical 0 Input Current (Ports 1, 2, 3,
RST) 8032AH, B052AH -800 /LA VIN = 0.45V
All Others -500 /LA VIN = 0.45V
11L1 Logical 0 Input Current to EA Pin of -15 mA
B751 H & 8751 H-8 Only
1112 Logical 0 Input Current (XTAL2) -3.2 mA VIN = 0.45V
III Input Leakage Current (Port 0)
B751 H & 8751 H-8 ±100 /LA 0.45 s VIN s Vee
All Others ±10 /LA 0-45 s VIN s Vee
IIH Logical 1 Input Current to EA Pin Qf 500 /LA
8751 H & 8751 H-B
IIH1 Input Current to RST to Activate Reset 500 /LA VIN < (Vee - 1.5V)
Icc Power Supply Current:
8031/8051 160 mA
8031AH/8051AH 125 mA All Outputs
8032AH/B052AH 175 mA Disconnected;
8751 H/8751 H-8 250 mA EA = Vee
Cia Pin CapaCitance 10 pF Test freq = 1 MHz
• NOTE:
Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports 1
and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins make .1-to-O
transitions during bus operations. In the worst cases (capacitive loading > 100 pF), the noise pulse on the ALE line may
exceed o.av. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
10-5
inter MCS®·51
NOTE:
'This table does not include the B751-BAC. characteristics (see next page).
10-6
intJ MCS®·51
10-7
inter MCS®-S1
ALE
PORTO
PORT 2
270048-6
10-8
inter MCS®·51
ALE
1 - - - - - T L L O y ------<~
PORTO
270048-7
ALE
TLLWL-<~·"o----TWLWH---"""'~
Tavwx
I+-_I-':':;;'~ 1--+---TaVWH----~
270048-8
10-9
inter
SERIAL PORT TIMING-SHIFT REGISTER MODE
= O·C to 70·C; VCC = 5V ±10%; VSS = OV;
Test Conditions: TA Load Capacitance = 80 pF .
12 MHz Oscillator Variable Oscillator
Symbol Parameter Units
Min Max Min Max
TXLXL Serial Port Clock Cycle Time 1.0 12TCLCL ,...s
TQVXH Output Data Setup to Clock Rising 700 1OTCLCL -133 ns
Edge
TXHQX Output Data Hold after Clock 50 2TCLCL-117 ns
Rising Edge
TXHDX Input Data Hold after Clock Rising 0 0 ns
Edge
TXHDV Clock Rising Edge to Input Data 700 1OTCLCL -133 ns
Valid ..
1-4-'OVI!H+1 ~UHQII I·
-------r\----~X X~~~X~___JX~__~X~~-JX~·---JX~--~7
I j .. t
~
SETlI
t
~
SET AI
ClUA __ r
270048-9
10-10
inter MCS®-51
I.------TCLCL -------<~
270048-10
2.4=X >
045
20
0.8
TEST POINTS < 2.0
08
)C
270048-11
A.C. Tesling: Inputs are driven at 2.4V for a Logic "1" and 0.45V
for a Logic "0". Timing measurements are made at 2.0V for a
Logic "1" and 0.8V for a Logic "0".
10-11
MCS®-51
EPROM CHARACTERISTICS
Table 3 EPROM Programming Modes
Mode RST . PSEN ALE . EA P2.7 P2.6 P2.S P2.4
Program 1 0 O· VPP 1 0 X X
Inhibit 1 0 1 X 1 0 X X
Verify 1 0 1 1 0 0 X X
Security Set 1 0 O· VPP 1 1 X X
NOTE.
"1" = logic high for that pin "VPP" = + 21V ± 0.5V
"0" = logic low for that pin ·ALE is pulsed low for 50 ms.
"X" = "don't care"
Programming the EPROM Note that the EAIVPP pin must not be allowed to go
above the maximum specified VPP level of 21.5V for .
To be programmed, the part must be running with a any amount of time. Even a narrow glitch above that
4 to 6 MHz oscillator. (The reason the oscillator voltage level can cause permanent damage to the
needs to be running is that the internal bus is being device. The VPP source should be well regulated
used to transfer address and program data to appro- and free of glitches.
priate internal registers.) The address of an EPROM
location to be programmed is applied to Port 1 and
pins P2.0-P2.3 of Port 2, while the code byte to be Program Verification
programmed into that location is applied to Port o.
If the Security Bit has not been programmed, the on-
The other Port 2 pins, and RST, PSEN, and EA
chip Program Memory can be read out for verifica-
should be held at the "Program" levels indicated in
tion purposes, if desired, either during or after the
Table 3. ALE is pulsed low for 50 ms to program the
programming operation. The address of the Program
code byte into the addressed EPROM location. The
Memory location to be read is applied to Port 1 and
setup is shown in Figure 5.
pins P2.0-P2.3. The other pins should be held atthe
"Verify" levels indicated in Table 3. The contents of
Normally EA is held at a logic high until just before
the addressed location will come out on Port O. Ex-
ALE is to be pulsed. Then EA is raised to + 21 V,
ternal pullups are required on Port 0 for this opera-
ALE is pulsed, and then EA is returned to a logic
tion.
high. Waveforms and detailed timing specifications
are shown in later sectio,ns of this data sheet. The setup, which is shown in Figure 6, is the· same
as for programming the EPROM except that pin P2.7
is held at a logic low, or may be used as an active-
+SV
low read strobe.
+5V
8751H
PH
P2.S
P2.6
P2.7
.--_---1 XTAL2
L--'+-H XTAL1
VSS
VSS
270048-12
10-12
inter MCS®-51
10-13
inter MCS@·51
PROGRAMMING VERIFICATION
Pl.0-fll.7 "\.
ADDRESS ADDRESS
P2.0-fl2.3 /
PORTO DATA IN
- _TAVQV
DATA OUT
TDVGL I- _ .• _TGHDX
TAVGL ~ I- TGHAX
'LE/PROG
,~
TSHGL TGHSL
TGLGH
21V:t .SV
\
Ei./vpp ~ TTL HIGH TTL HIGH TTL HIGH
, --
TEHSH
I- TELQV_ _TEHQZ
P2.7
(ENABLE)
J J
270048-15
For programming conditions see Figure 5. For verification conditions see Figure 6.
10-14
8051AHP
MCS®-51 FAMILY
8-BIT CONTROL-ORIENTED MICROCONTROLLER
WITH PROTECTED ROM
• High Performance HMOS Process • .Boolean Processor
• Internal Timers/Event Counters • Bit-Addressable RAM
• 2-Level Interrupt Priority Structure • Programmable Full Duplex Serial
• 32 I/O Lines (Four 8-Bit Ports) Channel
The MCS®-51 products are optimized for control applications. Byte-processing and numerical operations on
small data structures are facilitated by a variety of fast addressing modes for accessing the internal RAM. The
instruction set provides a convenient menu of 8-bit arithmetic instructions, including multiply and divide instruc-
tions. Extensive on-chip support is provided for one-bit variables as a separate data type, allowing direct bit
manipulation and testing in control and logic systems that require Boolean processing.
The 8051AHP is identical to the 8051AH with the exception of the Protection Feature. To incorporate this
Protection Feature, program verification has been disabled and external memory accesses have been limited
to 4K.
September 1987
10-15 Order Number: 270279-002
8051AHP
PQ O-PO 1 P2o-P21
Yee
r --- - -- - ---~tttt;- rl±!t~- - - ----------,
I
~ I
.tiI I
I
I I
I I
I I
I I
I I
I I
I I
I I
I I
I
I
I
I
I
I
I
I
I r-----,,----,
"E.
ALE
PI.D-P1.1 P3.0-P37
270279-1
Port 0 Port 1
Port 0 is an a-bit open drain bidirectional 1/0 port. As Port 1 is an a-bit bidirectional I/O port with internal
an output port each pin can sink a LS TTL inputs. pullups. The Port 1 output buffers can sink source 4
LS TTL inputs. Port 1 pins that have 1s written to
Port 0 pins that have 1s written to them float, and in
that state can be used as high-impedance inputs.
10-16
intJ 8051AHP
P1.0 vee
Pl.l PO.O ADO
P1.2 PO.l ADI
P1.3 PO.2 AD2
Pl.4 PO.3 AD3
P1.S PO.4 AD4
Pl.6 PO.S ADS
P1.7 PO.6 AD6
RST PO.7 AD7
RXD P3.0 10 EAlVpp
TXD P3.1 11 ALE'PROG
INTO P3.2 12 PSEN
INTI P3.3 13 P2.7 AIS
TO P3.4 P2.6A14
TI P3.S P2.S A13
WR P3.6 P2.4 A12
Rii P3.7 P2.3 Al1
XTAL2 P2.2 Al0
XTALI P2.1 A9
VSS P2.0 AS
270279-2
Pin
Figure 2. MCS®-51 Connections
them are pulled high by the internal pullups, and in Port 3
that state can be used as inputs. As inputs, Port 1
pins that are externally being pulled low will source Port 3 is an S-bit bidirectional I/O port with internal
current (IlL, on the data sheet) because of the inter- pullups. The Port 3 output buffers can sink/source 4
nal pullups. LS TTL inputs. Port 3 pins that have 1s written to
them are pulled high by the internal pullups, and in
that state can be used as inputs. As inputs, Port 3
Port 2 pins that are externally being pulled low will source
current (IlL on the data sheet) because of the pull-
Port 2 is an S-bit bidirectional I/O port with internal ups.
pullups. The Port 2 output buffers can sink/source 4
LS TTL inputs. Port 2 pins that have 1s written to Port 3 also serves the functions of various special
them are pulled high by the internal pullups, and in features of the MCS-51 Family, as listed below:
that state can be used as inputs. As inputs, Port 2
pins that are externally being pulled low will source
current (IlL on the data sheet) because of the inter- Port
Alternative Function
nal pullups. Pin
P3.0 RXD (serial input port)
Port 2 emits the high-order address byte during
P3.1 TXD (serial output port)
fetches from external Program Memory and during
accesses to external Data Memory that use 16-bit P3.2 INTO (external interrupt 0)
'addresses (MOVX @DPTR). In this application it P3.3 INT1 (external interrupt 1)
uses strong internal pullups when emitting 1s. Bits P3.4 TO (Timer 0 external input)
P2.4 through P2.7 are forced to 0, effectively limiting P3.5 T1 (Timer 1 external'input)
external Data and Code space to 4K each in the P3.6 WR (external data memory write strobe)
S051AHP during external accesses'. During access- P3.7 RD (external data memory read strobe)
es to external Data Memory that use S-bit addresses
(MOVX @Ri), Port 2 emits the contents of the P2
Special Function Register.
10-17
B051AHP
RST XTAL1
Reset input. A high on this pin for two machine cy- Input to the inverting oscillator amplifier.
cles while the oscillator is running resets the device.
XTAL2
ALE/PROG
Output from the inyerting oscillator amplifier.
Address Latch Enable output pulse for latching the
low byte of the' address during accesses to external
memory. OSCILLATOR CHARACTERISTICS
In normal operation ALE is emitted at a constant XTAL 1 and XTAL2 are the input and output, respec-
rate of % the oscillator frequency, and may be used tively, of an inverting amplifier which can be config-
for external timing or clocking purposes. Note, how- ured for use as an on-chip oscillatbr, as shown in
ever, that one ALE pulse is skipped during each ac- Figure 3. Either a quartz crystal or ceramic resonator
cess to external Data Memory. may be used. More detailed information concerning
the use of the on-chip oscillator is available in Appli-
cation Note AP-155, "Oscillators for Microcontrol-
lers."
Program Store Enable is the read strobe to external To drive the device from an external clock source,
Program Memory. XTAL 1 should be grounded, while XTAL2 is driven,
as shown in Figure 4. There are no requirements on
When the device is executing code from external the duty cycle 'of the external clock Signal, since the
Program Memory, PSEN is activated twice each ma- input to the internal clocking circuitry is through a
chine cycle, except that two PSEN activations are divide-by-two flip-flop, but minimum ,and maximum
skipped during each access to external Data Memo- high and low times specified on the Data Sheet must
ry. be observed.
EA/Vpp EXTERNAL
OSCILLATOR ---...,.....f ,XTAL2
External Access enable EA should be strapped to SIGNAL
Vee for internal program executions. EA must be
strapped to Vss in order to enable any MeS-51 de-
vice to fetch code from external Program memory
locations 0 to OFFFH.
~ XTAL1
C2
rl T
..L
IXTAL2 ....-...,.....f vss
0 270279-5
10-18
inter 8051AHP
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O'C to + 70'C age to the device. This is a stress rating only and
Storage Temperature .......... - 65'C to + 150'C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAlVpp Pin to Vss ... -0.5V to + 21.5V
tional sections of this specification is not implied. Ex-
Voltage on Any Other Pin to Vss .... -0.5V to + 7V posure to absolute maximum rating conditions for
Power Dissipation .......................... 1.5W extended periods may affect device reliability.
VIH Input High Voltage (Except XTAL2, RST) 2.0 Vee + 0.5 V
VIH1 Input High Voltage to XTAL2, RST 2.5 Vee + 0.5 V XTAL1 = Vss
VOL Output Low Voltage (Ports 1, 2, 3)' 0.45 V IOL = 1.6 mA
Vou Output Low Voltage (Port 0, ALE, PSEN)* 0.45 V IOL = 3.2 mA
VOH Output High Voltage (Ports 1, 2, 3, ALE, PSEN) 2.4 V IOH = -80 p.A
VOH1 Output High Voltage (Port 0 in External Bus Mode) 2.4 V IOH = - 400 p.A
IlL Logical 0 Input Current -500 p.A VIN = 0.45V
IIL2 Logical 0 Input Current (XTAL2) -3.2 mA VIN = 0.45V
III Input Leakage Current (Port 0) ±10 p.A 0.45 S; VIN S; Vee
IIH Input Current to RST to Activate Reset 500 p.A VIN < (Vee - 1.5V)
Icc Power Supply Current 125 mA All Outputs
Disconnected;
EA = VCC
CIO Pin Capacitance 10 pF Test freq = 1 MHz
'NOTE:
Capacitive loading on Ports a and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports 1
and 3. The noise is due to external bus capacitance discharging into the Port a and Port 2 pins when these pins make 1·to-0
transitions during bus operations. In the worst cases (capacitive loading> 100 pF), the noise pulse on the ALE line may
exceed 0.8V. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
10-19
8051AHP
10-20
inter 8051AHP
ALE
PORTO
PORT 2
270279-6
""-_~TLHLL
ALE
f4-----TLLDY - - - - . - j
--I.---TRLRH +----1
PORTO
I-~----TAYDY ------t
PORT 2 P2.0-P2.7 OR A8-A 15 FROM DPH A8-A 15 FROM PCH
270279-7
8051AHP
TWHLH
ALE
TLLW·L--I~".""---TWLWH -----<~
TQVWX
~-'~--~~-+-----TQVWH------~
270279-8
10-22
inter 8051AHP
'~fXLIL~
-------,
t"4-,QVIH ... 1 ~TlHQ. I
\ X X X~ __~X~__~X~__~X~__~x~__~1
~
. I
""D' ~
j I-""D'
t
SET II
,
WAITE TO SBUF
I""UT OA'..
_____ J~_J'~~
t
SET RI
CLEAR RI
270279-9
10-23
inter 8051AHP
....- - - - T C l C l - - - - - . . - j
270279-10
. . .> < x=
A.C. TESTING INPUT, OUTPUT WAVEFORM
u=x
Program Verification
2.0 2.0
The program verification test mode has been elimi-
nated on the 8051 AHP. It is not possible to verify the
TEST POINTS
ROM contents using this mode, the way EPROM
0.8 0.8
0.45 programmers typically do. Also, the ROM contents
270279-11 cannot be verified by a program executing out of
external program memory due to the restricted ad--
A.C. Testing: Inputs are driven at 2.4V for a Logic "'1" and 0.45V
. for a Logic "0". Timing measurements are made at 2.0V for a
dressing on the 8051AHP.
Logic "1" and 0.8V for a Logic "0".
10-24
8031 AH/8051 AH
8032AH/8052AH
8751 H/8751 H-8
EXPRESS
• Extended Temperature Range • Burn-In
The Intel EXPRESS system offers enhancements to the operational specifications of the MCS®-51 family of
microcontrollers. These EXPRESS products are designed to meet the needs of those applications whose
operating requirements exceed commercial standards.
The EXPRESS program includes the commercial standard temperature range with burn-in, and an extended
temperature range with or without burn-in.
With the commercial standard temperature range operational characteristics are guaranteed over the temper-
ature range of O·C to 70·C. With the extended temperature range option, operational characteristics are
guaranteed over the range of - 40·C to + 85·C.
The optional burn-in is dynamic, for a minimum time of 160 hours at 125·C with Vee = 5.5V ± 0.25V, following
guidelines in MIL-STD-883, Method 1015.
Package types and EXPRESS versions are identified by a one- or two-letter prefix to the part number. The
prefixes are listed in Table 1.
For the extended temperature range option, this data sheet specifies the parameters which deviate from their
commercial temperature range limits. The commercial temperature range data sheets are applicable for all
parameters not listed here.
October 1987
10-25 Order Number: 270007-002
intJ MCS®·51 EXPRESS
Please note:
• Commercial temperature range is O·C to 70·C. Extended temperature range is .,..40·C to +85·C.
• Burn-in is dynamic, for a minimum time of 160 hours at 125·C, Vee = 5.5V ±0.25V, following guidelines in
MIL-STD-883 Method 1015 (Test Condition D).
• The following devices are not available in ceramic packages:
8051AH,8031AH
8052AH, 8032AH
• The following devices are not available in extended temperature range:
8751 H, 8751 H-8
Examples: P8031AH indicates 8031AH in a plastic package and specified for commercial temperature range,
without burn-in. LD8051 AH indicates 8051 AH in a cerdip package and specified for extended temperature
range with burn-in.
10-26
intJ 8751BH
SINGLE-CHIP 8-BIT MICROCOMPUTER
WITH 4K BYTES OF EPROM PROGRAM MEMORY
• Program Memory Lock • Two 16·Bit Timer/Counters
• 128 Bytes Data Ram • 5 Interrupt Sources
• Quick Pulse Programming™ Algorithm • Programmable Serial Channel
• 12.75 Volt Programming Voltage • 64K External Program Memory Space
• Boolean Processor • 64K External Data Memory Space
• 32 Programmable I/O Lines
~~
r---------- ~
Vss
.... ~
-----------,
-:F
PSEN
ALE/1'IW1l
D/Vpp
RST
Pl.0-P1.7 P3.0-P3.7
270248-1
Figure 1. 8751BH Block Diagram
August 1987
10-27 Order Number: 270248-002
inter 8751BH
PIN DESCRIPTIONS inputs, Port 1 pins that are externally being pulled
low will source current (I,L, on the data sheet) be-
cause of the internal pullups.
PLO Vee Port 1 also receiveS! the low-order address bytes
PLI PO.O (ADO) during EPROM programming and program verifica-
PL2 PO.l (AD1) tion.
PL3 PO.2 (AD2)
PL4 PO.3 (AD3) Port 2: Port 2 is an 8-bit bidirectional liD port with
PLS PO.4 (AD4) internal pull ups. The Port 2 output buffers can sinkl
PL6 PO.S (ADS)
source 4 LS TIL inputs. Port 2 pins that have 1s
written to them are pulled high by the internal pull-
PL7 PO.6 (AD6)
ups, and in that state can be used as inputs. As
RESET PO.7 (AD7)
inputs, Port 2 pins that are externally being pulled
(RXD) P3.0 EA!VPP low will' source current (I,L, on the data sheet) be-
(TXD) P3.1 ALE/PROG cause of the internal pullups.
(INTO) P3.2 PSEN
(iNTl) P3.3 P2.7 (A1S) Port 2 emits the high-order address byte during
(TO) P3.4 P2.6 (AI4) fetches from external Program Memory and during
(Tl ) P3.S P2.S (AI3) accesses to external Data Memory'that use 16-bit
(Wil) P3.6 P2.4 (AI2) addresses (MOVX @DPTR). In this application it
(iID) P3.7
uses strong internal pullupswhen emitting 1s. Dur-
P2.3 (All)
ing accesses to external Data Memory that use 8-bit
XTAL2 P2.2 (Al0)
addresses (MOVX @Ri), Port 2 emits the contents of
XTALI P2.1 (A9) the P2 Special Function Register.
VSS P2.0 (AB)
10-28
inter 8751BH
ALE/PROG: Address Latch Enable output pulse for To drive the device from an external clock source,
latching the low byte of the address during accesses XTAL 1 should be grounded, while XTAL2 is driven,
to external memory. Thi~ pin is also the program as shown in Figure 4. There are no requirements on
pulse input (PROG) during EPROM programming. the duty cycle of the external clock signal, since the
input to the internal clocking circuitry is through a
In normal operation ALE is emitted at a constant divide-by-two flip-flop, but minimum and maximum
rate of 1/6 the oscillator frequency, and may be high and low times specified on the Data Sheet must
used for external timing or clocking purposes. Note, be observed.
however, that one ALE pulse is skipped during each
access to external Data Memory.
C2
PSEN: Program Store Enable is the Read strobe to I - - p - - - j XTAL2
External Program Memory.
er.
Figure 4. External Clock Drive Configuration
10-29
intJ 8751BH
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .......... - 65·C to + 150·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAlVpp Pin to Vss .•. - 0.5V to + 13.0V
tional sections of this specification is not implied Ex-
Voltage on Any Other Pin to Vss .. ;. -0.5V to + 7V posure to absolute maximum rating conditions for
Power Dissipation ..•....................... 1.5W extended periods may affect device reliability.
(based on PACKAGE heat transfer limitations, not
device power consumption) NOTICE Specifications contained within the
following tables are subject to change.
I'H1 Input Current to RST 500 tJo A Y,N < (Vcc - 1.5V)
to Activate Reset
Icc Power Supply Current 175 rnA All Outputs Disconnected
C,O Pin Capacitance 10 pF Test Freq = 1MHz
NOTES:
1. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE/PROG
and Ports 1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins
make 1·to-O transitions during bus operations. In the worst cases (capacitive loading > 100pF), the noise pulse on the ALEI
PROG pin may exceed O.8V. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch
with a Schmitt Trigger STROBE input.
2. ALE/PROG refers to a pin on the 8751BH. ALE refers to a timing signal that is output on the ALE/PROG pin.
10-30
inter 8751BH
A.C. CHARACTERISTICS (TA = O°C to + 70°C; Vee = 5V ± 10%; VSS = OV); Load Capacitance for
Port 0, ALE/PROG, and PSEN = 100 pF; Load Capacitance for All Other Outputs = 80 pF)
10-31
inter 8751BH
ALE _ _J
PORT 0
---
PORT 2 _ _ _J
270248-5
ALE
PSEN
i-----TLLDV 'I
- - - < - t - - - TRLRH -----+I
PORTO INSTR. IN
270248-6
ALE-{ \
-TLHLL- ....i-TWHLH
PSEN 1
~TLLWL TWLWH
,.
- TAVLL I--TLLAX- ~
TQVWH -
J
I-TWHQX
PORTO
:::r FRol~i~~ DPL
TAVWL
DATA OUT K AO-A7 FROM PCL INSTR. IN
PORT2
=> P2.0-P2.7 OR AB-A15 FROM DPH AB-A 15 FROM PCH
270248-7
10-32
infef 8751BH
TEST CONDITIONS (TA = O·C to + 70·C; Vee = 5V ± 10%; Vss = OV; Load Capacitance = 80 pF)
12MHzOsc Variable Oscillator
Symbol Parameter Units
Min Max Min Max
TXLXL Serial Port Clock Cycle Time 1.0 12TCLCL f-Ls
TOVXH Output Data Setup to 700 1OTCLCL - 133 ns
Clock Rising Edge
TXHOX Output Data Hold After 50 2TCLCL-117 ns
Clock Rising Edge
TXHDX Input Data Hold After 0 0 ns
Clock Rising Edge
TXHDV Clock Rising Edge to 700 1OTCLCL -133 ns
Input Data Valid
INSTRUCTION I 0 2 3 4 5 6 7 8
ALE
CLOCK
~j-TXHQX
OUTPUT DATA \ 0 IX 1 IX 2 X 3 X 4 X 5 X ·6 X 7 I
I
WRITE TO SBUF
j.TXHDV I:-IrTXHDX t
SET TI
INPUT DATA - - - -......r.:'AL~,.....W:ALI~D.-""'Y::::ALI:-::D,.,..-I:';A':':'U:v-.r.:'~,....."\I:';~.-""'Y~,.,..-r.:':~
ALID ALID ALID ALID
I t
CLEAR RI SET RI
270248-8
_--TCLCL--~
270248-9
10·33
8751BH
Symbol
TCHCX
Parameter
1/TClCl Oscillator Frequency 3.5
High Time
Min Max Units
20
12 MHz
ns
2.4=X
0.45 V
.
-
2.0
O.B TEST POINTS
2.0'
O.B
-
)C
270248-10
TClCX low Time 20 ns AC inputs during testing are driven at 2.4V for a logic "1" and
0.45V for a logic "0". Timing measurements are made at 2.0V for
TClCH Rise Time 20 ns a logic "1" and 0.8V for a logic "0".
EPROM CHARACTERISTICS a
amount of time. Even narrow glitch above that volt-
age level can cause permanent damage to the de-
vice. The Vpp source should be well regulated and
Programming the EPROM free of glitches.
gram the code byte into the addressed EPROM lo- --+ P3.7
cation. The setup is shown in Figure 5. ,..-......- - 1 XTAL 2
10-34
8751BH
NOTES:
"1" = Valid high for that pin
"0" = Valid low for that pin
"Vpp" = + 12. 75V ± 0.25V
• ALE/PROG is pulsed low for 100 uS for programming. (Quick-Pulse Programming™)
QUICK-PULSE PROGRAMMINGTM tents of the addressed location will come out on Port
O. External pullups are required on Port 0 for this
ALGORITHM operation. (If the Encryption Array in the EPROM
The 8751 BH can be programmed using the Quick- has been programmed, the data present at Port 0
Pulse Programming Algorithm for microcontrollers. will be Code Data XNOR Encryption Data. The user
The features of the new programming method are a . must know the Encryption Array contents to manual-
lower Vpp (12.75 volts as compared to 21 volts) and ly "unencrypt" the data during verify.)
a shorter programming pulse. It is possible to pro-
gram the entire 4K Bytes of EPROM memory in less The setup, which is shown in Figure 6, is the same
than 13 seconds with this algorithm as for programming the EPROM except that pin P2.7
is held at a logic low, or may be used as an active
To program the part using the new algorithm, Vpp low read strobe.
must be 12.75 ±0.25 Volts. ALE/PROG is pulsed
low for 100 ftseconds, 25 times. Then, the byte just
programmed may be verified. After programming,
the entire array should be verified. The Program
Lock features are programmed using the same ADDR.
PGM DATA
OOOOH/OFFF
method, but with the setup as shown in Table 3. The (USE 10K
PULLUPS)
only difference in programming Lock features is that
the Lock features cannot be directly verified. In-
stead, verification of programming is by observing SEE
that their features are enabled. TABLE 3 8751BH
VIH
_P3.7
PROGRAM VERIFICATION
...--..---1 XTAL 2
If the Lock Bits have not been programmed, the on- '--"'-+--IXTAL 1 VIHI
chip Program Memory can be read out for verifica- Vss
tion .purposes, if desired, either during or after the
programming operation. The address of the Program 270248-12
Memory location to be read is applied to Port 1 and
pins P2.0 - P2.3. The other pins should be held at Figure 6. Verifying the EPROM
the "Verify" ,levels indicated in Table 3. The con-
10-35
inter 8751BH
PROGRAM MEMORY LOCK Erasing the EPROM also erases the Encryption Ar-
ray and the Lock Bits, returning the part to full un-
The two-level Program Lock system consists of 2 locked functionality.
Lock bits and a 32-byte Encryption Array which are
used to protect the program memory against soft- To ensure proper functionality of the chip, the inter-
ware piracy. nally latched value of the EA pin must agree with its
external state.
ENCRYPTION ARRAY
ERASURE CHARACTERISTICS
Within the EPROM array are 32 bytes of Encryption
Array that are initially unprogrammed (all 1s). Every Erasure of the EPROM begins to occur when the
time that a byte is addressed during a verify, 5 ad- chip is exposed to light with wavelengths shorter
dress lines are used to select a byte of the Encryp- than approximately 4,000 Angstroms. Since sunlight
tion Array. This byte is then exclusive-NORed and fluorescent lighting have wavelengths in this
(XNOR) with the code byte, creating an Encrypted range, exposure to these light sources over an ex-
Verify byte. The algorithm, with the array in the un- tended time (about 1 week in sunlight, or 3 years in
programmed state (all 1s), will return the code in its room-level fluorescent lighting) could cause inadver-
original, unmodified form. tent erasure. If an application subjects the device to
this type of exposure, it is suggested that an opaque
It is recommended that whenever the Encryption Ar- label be placed over the window.
ray is used, at least one of the Lock Bits be pro-
grammed as well. The recommended erasure procedure is exposure
to ultraviolet light (at 2537 Angstroms) to anintegrat-
ed dose of at lease 15. W-sec/cm. Exposing the
LOCK BITS· EPROM to an ultraviolet lamp of 12,000 !J-W/cm rat-
ing for 20 to 30 minutes, at a distance of about 1
Also included in the,EPROM Program Lock scheme inch, should be sufficient.
are two Lock Bits which function as shown in Table
4. Erasure leaves the array in an all 1s state.
10-36
inter 8751BH
PROGRAMMING VERIFICATION
PI.O-PI.7
P2.0-P2.3
-----{=:::!AO~D~R~ES~S~ ADDRESS
-TAVQV
ALE/PROG ------,,1
10-37
8052BH
SINGLE-CHIP 8-BIT MICROCOMPUTER
WITH FACTORY MASK-PROGRAMMABLE ROM
8032BH .
SINGLE-CHIP 8-BIT CONTROL-ORIENTED
CPU WITH RAM AND I/O
8032BH-ROMless
8052BH-8K Bytes of Factory Mask-Programmed ROM
• 256 Bytes Data Ram • Programmable Serial Channel
• Boolean Processor • Separate Transmit/Receive Baud Rate
Capability
• 32 Programmable I/O Lines
• Three 16-Blt Timer/Counters • 64K External Program Memory Space
• 6 Interrupt Sources • 64K External Data Memory Space .
PO.O-PO.7 P2.0-P2.7
v~
r----------
. ~~~
-----------,
~
PORT 0 PORT 2
DRIVERS DRIVERS
I'ml
'L~~
RST
October 1987
10-38 Order Number: 270192-1103
inter 8052BH/8032BH
PIN DESCRIPTIONS In addition, P1.0 and P1.1 serve the functions of the
following speCial features of the MCS®-51 Family:
(T2) PI.O
Port Pin Alternate Function
Vee
(T2EX) PI.I PO.O (ADO) P1.0 T2 (Timer/Counter 2 External Input)
PI.2 PO.I (ADI) P1.1 T2EX (Timer/Counter 2
PI.3 PO.2 (AD2)
Capture/Reload Trigger)
PI.4 PO.3 (AD3)
PI.S PO.4 (AD4)
PI.6 PO.S (ADS) Port 2: Port 2 is an a-bit bidirectional I/O port with
PI.7 PO.6 (AD6) internal pullups. The Port 2 output buffers can sink/
RESET 9 PO.7 (AD7) source 4 LS TTL inputs. Port 2 pins that have 1s
(RXD) P3.0 written to them are pulled high by the internal pull-
(TXD) P3.1 ALE ups, and in that state can be used as inputs. As
(INTO) P3.2 PSEN inputs, Port 2 pins that are externally being pulled
(INTI) P3.3 P2.7 (AIS) low will source current (IlL, on the data sheet) be-
(TO) P3.4 P2.6 (AI4) cause of the internal pullups.
(TI) P3.S P2.S (AI3)
(ViR) P3.6 P2.4 (AI2) Port 2 emits the high-order address byte during
(iW) P3.7 P2.3 (All) fetches from external Program Memory and during
XTAL2 P2.2 (AIO) accesses to external Data Memory that use 16-bit
XTAL1 P2.1 (A9) addresses (MOVX @DPTR). In this application it
VSS P2.0 (AS) uses strong internal pullups when emitting 1s. Dur-
270192-2 ing accesses to external Data Memory that use a-bit
addresses (MOVX @Ri), Port 2 emits the contents of
Figure 2. Pin Connections the P2 Special Function Register.
Vee: Supply voltage. Port 3: Port 3 is an a-bit bidirectional I/O port with
internal pullups. The Port 3 output buffers can sink/
Vss: Circuit ground. source 4 LS TTL inputs. Port 3 pins that have 1s
written to them are pulled high by the internal pull-
Port 0: Port 0 is an a-bit open drain bidirectional I/O ups, and in that state can be used as inputs. As
port. As an output port each pin can sink a LS TTL inputs, Port 3 pins that are externally being pulled
inputs. Port 0 pins that have 1s written to them float, low will source current (IlL, on the data sheet) be-
and in that state can be used as high-impedance cause of the pullups.
inputs.
Port 3 also serves the functions of various special
Port 0 is also the multiplexed low-order address and' features of the MCS®-51 Family, as listed below:
data bus during accesses to external Program and
Data Memory; In this application it uses strong inter- Port Pin Alternate Function
nal pullups when emitting 1s, and can source and
sink a LS TTL.inputs. P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
Port 1: Port 1 is an a-bit bidirectional I/O port with P3.2 INTO (external interrupt 0)
internal pullups. The Port 1 output buffers can sink/ P3.3 INT1 (external interrupt 1)
source 4 LS TTL inputs. Port 1 pins that have 1s P3.4 TO (Timer 0 external input)
written to them are pulled high by the internal pull- P3.5 T1 (Timer 1 external input)
ups, and in that state can be used as inputs. As P3.6 WR (external data memory write strobe)
inputs, Port 1 pins that are externally being pulled
P3.7 RD (external data memory read strobe)
low will source current (IlL, on the data sheet) be-
cause of the internal pullups.
10-39
inter 8052BH/8032BH
RST: Reset input. A high on this pin for two machine Figure 3. Either a quartz crystal or ceramic resonator
cycles while the oscillator is running resets the de- may be used. More detailed information concerning
vice. the use of the on-chip oscillator is available in Appli-
cations Note AP-155, "O~cillators for Microcontrol-
ALE: Address Latch Enable output pulse for latching lers."
the low byte of the address during accesses to ex-
ternal memory; . To drive the device from an external clock source,
XTAL 1 should be grounded, while XTAL2 is driven,
In normal operation ALE is emitted at a constant as shown in Figure 4. There are no requirements on
rate of 1/6 the oscillator frequency, and may be the duty cycle of the external clock signal, since the
used for external timing or clocking purposes. Note, input to the internal clocking circuitry is through a
however, that one ALE pulse is skipped during each divide-by-two flip-flop, but minimum and maximum
access to external Data Memory. high and low times specified on the Data Sheet must
be observed. .
PSEN: Program Store Enable is the Read strobe to
External Program Memory.
C2
When the device is executing code from external 1 - -.....--1 XTAL2
Program Memory, PSEN is activated twice each ma-
chine cycle, except that two PSEN activations are
skipped during each access to External Data Memo-
o
ry. 1 - -.....--1 XTAL 1
OSCILLATOR CHARACTERISTICS
XTAL 1 and XTAL2 are the input and output, respec- 270192-4
tively, of an inverting amplifier which can be config-
uredfor use as an on-chip oscillator, as shown in
CiftllPA A Cvt"""'I!II1
I ."WI'"" ..... _ ...."" ••• u. 1"1ft,,...,
_1_"",", n.i
_ • •..
• .a.
__ =-_._ .. _..
t"ftftfi"'II.a.t;"""
........
10-40
intJ 8052BH/8032BH
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may cause permanent dam-
AmbientTemperature Under Bias .... O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature, .......... - 6S·C to + 1S0·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EA Pin
tional sections of this specification is not implied. Ex-
to Vss ...................... -O.SV to + 13.0V
posure to absolute maximum rating conditions for
Voltage on Any Other Pin to Vss .... -O.SV to + 7V extended periods may affect device reliability.
Power Dissipation .......................... 1.SW
(based on PACKAGE heat transfer limitations, not NOTICE' Specifications contained within the
device, power consumption) following tables are subject to change.
NOTES:
1. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins make 1-
to-O·transitions during bus operations. In the worst cases (capacitive loading> 100 pF), the noise pulse on the ALE 'pin may
exceed O.BV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use·an address latch with a Schmitt
Trigger STROBE input.
10-41
inter 8052BH/8032BH
A_C. CHARACTERISTICS (TA = O·C to 70·C; Vee = 5V ± 10%; Vss = OV); Load Capacitance for
Port 0, ALE and PSEN = 100 pF; Load Capacitance for All Other Outputs = 80 pF)
10-42
intJ 8052BH/8032BH
~LE _ _...J
PSEN _ _..I
TPXAV
TPXIZ
PORT 2
---- External Program Memory Read Cycle
AB-AI5
270192-5
ALE
PSEN
i-----TLLDV ' I
-----0-1---- TRLRH -----+l
RD ----+-----~ ~------------------
PORTO INSTR. IN
270192-6
ALE
, I J
-TLHLL- =L-TWHLH
~
~TLLWL
, TWLWH
-. TAVLL !-TLLAX- ~
TQVWH - '-TWHQX
PORTO
~ FRoll~i~h DPL
-
DATA OUT XAO-A7 FROM PCL INSTR. IN
TAVWL
PORT2
:::::> P2.0-P2.7 OR AB-A 15 FROM DPH AB-AI5 FROM PCH
270192-7
10-43
8052BH/8032BH
INSTRUCTION I 0 2 3 4 5 6 7 8
ALE
CLOCK
t I
CL~R RI SET RI
270192-8
-~-TCLCL---+I
270192-9
10-44
8052BH/8032BH
Symbol
TCHCX
Parameter
1/TCLCL Oscillator Frequency 3.5
High Time
Min Max Units
20
12 MHz
ns
2.4=X
0.4SV
2.0
o~
TEST POINTS
2.0
o~
)C
. .
270192-10
TCLCX Low Time 20 ns AC inputs during testing are driven at 2.4V for a logic 'T' and
0.45V for a logic "0". Timing measurements are made at 2.0V for
TCLCH Rise Time 20 ns a logic '"1" and O.BV for a logic "0".
It is recommended that whenever the Encryption Ar- To ensure proper functionality of the chip, the inter-
ray is used, at least one of the Lock Bits be pro- nally latched value of the EA pin must agree with its .
grammed as well. extern~l.state.
LOCK BITS
Also included in the Program Lock scheme are two
Lock Bits which function as shown in Table 1.
10-45
8752B'H
SINGLE-CHIP8-BIT MICROCOMPUTER,
WITH 8K BYTES OF EPROM PROGRAM,MEMORY
..'
• Program Memory Lock • 6 Interrupt Sources
• 256 Bytes Data Ram' • Programmable Serial Cliannel
• Quick Pulse Programming™ Algorithm • Separate Transmit/Receive Baud Rate
Capability
• .12:75 Volt Programming Voltage
.64K External Program Memory Space
• Boolean Processor
• 32 Programmable I/O Lines • 64K External Data Memory Space
• Three 16·Bit Timer/Counters
PO.O-PO.7 P2.0-P2.7
~~
Vss
r - - - - - -,- - - -
. p..~t..I.lI~ :--:---------,
-F
i'S£iI
AU:/1'RllC
£A'Yitr ::I~ CO'NTRO>L\
P1.0-Pl.7 P3.0-P3.7
270429-1
Figure 1. Block Diagram
October 1987
10-46 Order Number: 270429-001
inter 8752BH
(T2) PLO Vee In addition, P1.0 and P1.1 serve the functions of the
(T2EX) Pl.l, PO.O (ADO) following special features of the MCS®-S1 Family:
Pl.2 PO.l (AD1)
Pl.3 PO.2 (AD2) Port Pin Alternate Function
Pl.4 PO.3 (AD3) P1.0 T2 (Timer/Counter 2 External Input)
Pl.S PO.4 (AD4) P1.1 T2EX (Timer/Counter 2
Pl.S PO.S (ADS) Capture/Reload Trigger)
Pl.7 PO.S (ADS)
RESET PO.7 (AD7) Port 2: Port 2 is an a-bit bidirectional I/O port with
(RXD) P3.0 EA/Vpp internal pullups. The Port 2 output buffers can sink/
source 4 LS TTL inputs. Port 2 pins that have 1s
(TXD) P3.1 ALE/PROG
written to them are pulled high by the. internal pull-
(INTO) P3.2 PSEN ups, and in that state can be used as inputs. As
{lNT1) P3.3 P2.7 (A lS) inputs, Port 2 pins that are externally being pulled
(TO) P3.4 P2.S (A14) low will source current (IlL, on the data sheet) be-
(T1 ) P3.S P2.S (A13) cause of the internal pullups.
(WR) P3.S P2.4 (A12)
Port 2 emits the high-order address byte during
(RO) P3.7 P2.3 (All) fetches from external Program Memory and during
XTAL2 P2.2 (Al0) accesses to external Data Memory that use 16-bit
XTALl P2.1 (A9) addresses (MOVX @DPTR). In this application it
Vss P2.0 (A8) uses strong internal pullups when emitting 1s. Dur-
ing accesses to external Data Memory that use a-bit
270429-2 addresses (MOVX @Ri), Port 2 emits the contents of
the P2 Special Function Register.
Figure 2. Pin Connections
Port 2 also receives the high-order address bits dur-
Vee: Supply voltage. ing EPROM programming and program verification.
Vss: Circuit ground. Port 3: Port 3 is an a-bit bidirectional I/O port with
intermil pullups. The Port 3 output buffers can sink/
Port 0: Port 0 is an a-bit open drain bidirectional 110 source 4 LS TTL inputs. Port 3 pins that have 1s
port. As an output port each pin can sink a LS TTL written to them are pulled high by the internal pull-
inputs. Port 0 pins that have 1s written to them float, ups, and in that state can be used as inputs. As
and in that state can be used as high-impedance inputs, Port 3 pins that are externally being pulled
inputs. . low will source current (IlL, on the data sheet) be-
cause of the pull ups.
Port 0 is also the multipl~xed low-order address and
data bus during accesses to external Program and Port 3 also serves the functions of various special
Data Memory. In this application it uses strong inter- features of the MCS®-S1 Family, as listed below:
nal pullups when emittill9 1s, and can source and
sink a LS TTL input~ .. Port Pin Alternate Function
Port 0 also receives the code bytes during EPROM P3.0 RXD (serial input port)
programming, and outputs the code bytes during P3.1 TXD (serial output port)
program verification. External pullups are required P3.2 INTO (external interrupt 0)
during program verification. P3.3 INT1 (external interrupt 1)
P3.4 TO (Timer 0 external input)
Port 1: Port 1 is an a-bit bidirectional I/O port with
P3.S T1 (Timer 1 external input)
internal pullups. The Port 1 output buffers can sink/
source 4 LS TTL inputs. Port 1 pins that have 1s P3.6 WR (external data memory write strobe)
written to them are pulled high by the internal pull- P3.7 RD (external data memory read strobe)
ups, and in that state can be used as inputs. As
inputs, Port 1 pins that are externally being pulled RST: Reset input. A high on this pin for two machine
low will source current .(IIL' on the data sheet) be- cycles while the oscillator is running resets the de-
cause of the internal pullups. vice.
10-47
8752BH
ALE/PROG: Address Latch Enable output pulse for cations Note AP-155, "Oscillators for Microcontrol-
latching the low byte of the address during accesses lers."
to external memory. This pin is also the program
pulse input (PROG) during EPROM programming on To drive the device from an external clock source,
the 8752BH. XTAL 1 should be grounded, while XTAL2 is driven,
as shown in Figure 4. There are no requirements on
In normal operation ALE is emitted at a constant the duty cycle of the external clock signal, since the
rate of 1/6 the oscillator frequency, and may be input to the internal clocking circuitry is through a
used for external timing or clocking purposes. Note, divide-by-two flip-flop, but minimum and maximum
however, that one ALE pulse is skipped during each high and low times specified on the Data Sheet must
access to external Data Memory. be observed.
10-48
inter 8752BH
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias ...... ODC to 70DC age to the device. This is a stress rating only and
Storage Temperature .......... -6SDC to + 1S0DC functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAlVpp Pin to Vss ... -O.SV to + 13.0V
tional sections of this specification is not implied. Ex-
Voltage on Any Other Pin to Vss .... -O.SV to + 7V posure to absolute maximum rating conditions for
Power Dissipation .......................... 1.SW extended periods may affect device reliability.
(based on PACKAGE heat transfer limitations, not
device power consumption) NOTICE Specifications contained within the
fol/owing tables are subject to change.
NOTES:
1. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE/PROG
and Ports 1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins
make 1-\0-0 transitions during bus operations. In the worst cases (capacitive loading > 100 pF), the noise pulse on the
ALE/PROG pin may exceed O.SV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address
latch with a Schmitt Trigger STROBE input.
2. ALE/PROG refers to a pin on the device. ALE refers to a timing signal that is output on the ALE/PROG pin.
10-49
8752BH
A.C. CHARACTERISTICS (TA = O°C to + 70°C; Vcc. = 5V ± 10%; Vss = OV); Load Capacitance for
Port 0, ALE/PROG, and PSEN = 100 pF; Load Capacitance for All Other OutpLits = 80 pF)
10-50
8752BH
ALE _ _J
PSEN _ _J
]I--!----Ji"_____. TPXAV
TPXIZ
PORT a _ _J AO-A7
270429-5
ALE
PSEN
i------TLLDV 'I
--+--- TRLRH ---~
PORTO INSTR. IN
-1:.-TLHLL~
ALE I ~
4TWHLH
~TLLWL TWLWH
,
-
J
.- TAVLL -TLLAX- ~ --TWHQX
TQVWH
PORTO
:::r FRoIAA~i~~
TAVWL
DPL DATA OUT 1\ AO-A7 FROM PCL INSTR. IN
PORT2
:::::> P2.0-P2.7 OR AB-A 15 FROM DPH X AB-A 15 FROM PCH
270429-7
10-51
8752BH
TEST CONDITIONS TA = o·c to + 70·C; vee = 5V ± 10%; vss = OV; Load Capacitance = 80 pF
12MHzOsc Variable Oscillator
Symbol Parameter Units
Min Max Min Max
TXLXL Serial Port Clock Cycle Time .1.0 12TCLCL . /Ls
TOVXH Output Data Setup to 700 10rCLCL --.: 133. ns
Clock Rising Edge
TXHOX Output Data Hold After . 50 2TCLCL-117 ns
Clock Rising Edge
TXHDX Input Data Hold After 0 0 ns
Clock Rising Edge
TXHDV Clock Rising Edge to 700 10TCLCL-133 ns
Input Data Valid
INSTRUCTION I 0 ·1 2· 3 4 6 7 8
ALE
CLOCK
~!-TXHQX
OUTPUT DATA· \ 0 IX 1 2 X 3 X 4 X 5 X 6X 7/
t
WRITE TO SBUF
I
-l TXHDV r.: . ....
-lrTXHDX I
SET TI
INPUT DATA -.,.....----\r.:AJ~,....-w:AlI~·~-\r.:A-:-::U)J'"-,.r.:':AL'::!ID.;--V~AIJ~,...."'\r.~AIJ'="-\r.:AIJ":':D)J'"-,.r.:':":!J
t I
CLEAR RI SET RI.
270429-8
270429-9
10-52
inter 8752BH
Symbol Parameter
'1/TClCl Oscillator Frequency 3.5
Min Max Units
12 MHz 2 . 4 = X 2.0
O.B TEST POINTS
2.0
0.8
)C
TCHCX High Time 20 ns 0.45V - -
270429-10
TClCX low Time 20 ns AC inputs during testing are driven ,at 2.4V.for a logic "1" and
O.4SV for a logic "0". Timing measurements are made at 2.0V for
TClCH Rise Time 20 ns a logic "1" and O.BV for a logic "0".
+5V
8752BH
.--_--IXTAL2
L -......-+-IXTAL 1
Vss
270429-11
10-53
inter 8752BH
NOTES:
"1" = Valid high for that pin
"0" = Valid low for that pin
"Vpp" = + 12.75V ±0.25V
*ALE/PROG is pulsed low for 100 uS for programming. (Quick-Pulse Programming™)
11~, - - - - - - 2 5 PULSES
'I
ALE/PROG:~-----~
'----.---J .
10-54
8752BH
270429-13
10-55
8752BH
PROGRAMMING VERIFICAnON
PI.a-pI.7
p2.a-p2.4 ---:----{=:A~D~DR~ES~S~~=~--~-__;=:::!A~DD~RE~SS~J----
-TAVQV
PORT a ----H:=~~~:=H_-----:--_{~DA~TA~O~U~T::Jf-----:--
TDVGL
ALE/PROG -----""\1
TSHGLj--
_ _ _ TGLGH
fA/vpp ~lI---"'vp-p---'i!-----.ll'---:;::t,.:;::::::-_ _.f-____I - - - - -
270429-14
10-56
SOC51 BH/SOC51 BH-1 /SOC51 BH-2
CHMOS SINGLE-CHIP S-BIT MICROCOMPUTER
WITH FACTORY MASK-PROGRAMMABLE ROM
SOC31 BH/SOC31 BH-1/S0C31 BH-2
CHMOS SINGLE-CHIP S-BIT CONTROL-ORIENTED
CPU WITH RAM AND I/O
SOC51BH/SOC31BH-3.5 to 12 MHz, Vee = 5V ± 20%
SOC51BH-1/S0C31BH-1-3.5 to 16 MHz, Vee = 5V ±20%
SOC51BH-2/S0C31BH-2-0.5 to 12 MHz, Vee = 5V ± 20%
• Power Control Modes • High Performance CHMOS Process
• 128 x 8-Bit RAM • Boolean Processor
• 32 Programmable I/O Lines _ 5 Interrupt Sources
• Two 16-Bit Timer/Counters • Programmable Serial Port
• 64K Program Memory Space • 64K Data Memory Space
The MCS®-51 CHMOS products are fabricated on Intel's CHMOS III process and are functionally compatible
with the standard MCS-51 HMOS and EPROM products. CHMOS III is a technology which combines the high
speed and density characteristics of HMOS with the low power attributes of CHMOS. This combination ex-
pands the effectiveness of the powerful MCS-51 architecture and instruction set.
Like the MCS-51 HMOS versions, the MCS-51 CHMOS products have the following features: 4K byte of ROM
(80C51 BH/80C51 BH-1/80C51BH-2 only); 128 bytes of RAM; 32 I/O lines; two 16-bit timer/counters; a five-
source two-level interrupt structure; a full duplex serial port; and on-chip oscillator and clock circuitry. In
addition, the MCS-51 CHMOS products have two software selectable modes of reduced activity for further
power reduction-Idle and Power Down.
The Idle mode freezes the CPU while allowing the RAM, timer/counters serial port and interrupt system to
continue functioning. The Power Down mode saves the RAM contents but freezes the oscillator, causing all
other chip functions to be inoperative.
-IVSS~
- I
- I
I
270064-1
Figure 1. Block Diagram
September 1987
10-57 Order Number: 270064·005
inter 80C51BH, -1, -2/80C31BH, -1,-2
The control bits for the reduced power modes are in Port 2
the Special Function Register PCON.
Port 2 is an 8-bit bidirectional 1/0 port with'internal
NOTE: pullups. Port 2 pins that have 1s written to them are
For more detailed information on these reduced pulled high by the internal pullups, and in that state
power modes refer to Application Note AP-252, can be used as inputs. As inputs, Port 2 pins that are
"Designing with the 80C51 SH". externally being pulled low will source current (ilL,
on the data sheet) because of the internal pull ups.
Vee
Supply voltage during normal, Idle, and Power Down
operations.
Table 1. Status of the external pins during Idle and Power Down modes
Program
Mode ALE PSEN PORTO PORT 1 PORT 2 PORT 3
Memory
Idle Internal 1 1 Data Data Data Data
, Idle External 1 1 Float Data Address Data
Power Down Internal 0 0 Data Data Data Data
Power Down External 0 0 Float Data Data Data
10-58
intJ 80C51BH, -1, -2/80C31BH, -1,-2
INDEX
Pl.0 VCC CORNER
Pl.l PO.O
Pl.2 PO.l
Pl.3 PO.2
Pl.4 PO.3 P1.5 ~(~ ~~ PO.4
Pl.5 PO.4 Pl.6 )=~ :~ PO.S
Pl.6 PO.5 ' Pl.7 :.: ~ ~~! PO.6
Pl.7 PO.I RST !~1 ~H PO.7
RST PO.7
P3.0/RXD EA P3.0 H] ~~ EA
P3.1/TXD ALE NC 1~ ~ r~ NC
P3.2/iN'fii iiSEN P3.1 ~~~ ~~ ALE
P3.3INTl P2.7 P3.2 !! ~ ~}~ PSEN
P3.4/TO 'P2.6 r~! P2.7
P3.3 ~~!
P3.S/Tl P2.5
P3.6/WR P2.4
P3.4 !!; rM P2.6
P3.7/iii) P2.3 P3.S j!] r~ P2.S
XTAL2 P2.2 :~: ;~: :2: :;;: ;R: :A~ ::: r~; ;i: ;s;; :~:
XTALl P2.1
VSS P2.0
270064-2 270064-3
Pin Pad
Diagrams are for pin reference only.
Package sizes ,are not to scale.
Port 3 ALE
Port 3 is an S-bit bidirectional 110 port with internal Address Latch Enable output pulse for latching the
low byte of the address during accesses to external
pullups. Port 3 pins that have 1s written to them are
pulled high by the internal pullups, and in that state. memory.
can be used as inputs. As inputs, Port 3 pins that are
externally being pulled low will source current (ilL, In normal operation ALE is emitted at a constant
on the data sheet) because of the pullups. rate of 1/6 the oscillator frequency, and may be
used for external timing or clocking purposes. Note,
Port 3 also serves the functions of various special however,that one ALE pulse is skipped during each'
features of the MCS-51 Family, as listed below: access to external Data Memory.
10-59
inter 80C51BH, ~1, -2/80C31BH, -1,-2
When the 80C51 BH is executing code from external ured for use as an on-chip oscillator, as shown in
Program Memory, PSEN is activated twice each ma- Figure 3. More detailed information concerning the
chine cycle, except that two PSEN activations are use of the on-chip oscillator is available in Applica-
skipped during each access to external Data Memo- tion Note AP-155,. "Oscillator for Microcontr'ollers".
ry. PSEN is not activated during fetches from inter-
nal program memory. To drive the device from an external clock source,
XTAL1 should be driven, while XTAL2 is left uncon-
nected, as shown in Figure 4. There are no require-
EA ments on the duty cycle of the external clock signal,
External Access enable. EA must be strapped to since the input to the internal clocking circuitry is
Vss in order to enable the device to fetch code from through a divide~by-two flip"flop, but minimum and
external Program Memory locations· OOOOH to maximum high and low times specified on the Data
Sheet must be observed. .
OFFFH. If EA is strapped to Vee the device executes
from internal Program Memory unless the program
counter contains an address greater than. OFFFH.
Design Considerations
• At power on, the voltage on Vee and RST must
XTAL1 a
come up at the same time for proper start-up.
Input to the inverting oscillator amplifier and input to. • Before entering· the Power Down mode the con-
the internal clock generator circuits. tents oUhe Carry Bit and B.7 must be equal.
• When the Idle mode is terminated by a hardware
reset, the device normally resumes program exe-
XTAL2 cution, from where it .left off, up to two machine
Output from the inverting oscillator amplifier. cycles before the internal reset algorithm takes
control: On-chip hardware inhjbits access to inter-
nal RAM in this event, but access to the port pins
is, not inhibited. To elimin.ate the possibility of an
unexpected write when Idle is terminated by re-
30pF" set, the instruction following the .one that invokes
Idle should not be on~ that writes to a port pin or
to external memory. ..
t - - - - - - - - I vss
NC
270064-4 XTAL2
10-60
inter 80C51BH, -1, -2/80C31BH, -1,-2
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may caU.se permanent dam-
Ambient Temperature Under Bias .... o'e to + 70'e age to the device. This is a stress rating only and
Storage Temperature .......... - 65'e to + 150~e functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on any
tional sections of this specification is not implied Ex-
Pin to Vss ................ -0.5V to Vcc + 0.5V posure to absolute maximum rating conditions for
Voltage on Vcc to Vss ............. -0.5V to 6.5V extended periods may affect device reliability..
Power Dissipation ......................... 1.0W·
"This value is based on the maximum allowable die temperature and NOTICE Specifications contained within the
the thermal resistance of the package. following tables are subject to change.
VOH Output High Voltage 2.4 V IOH = -60 /LA Vee = 5V ±10%
(Ports 1, 2, 3, ALE, PSEN)
0.75 Vee V IOH = -25/LA
VOH1 Output High Voltage 2.4 V IOH = -800 /LA Vee = 5V ± 10%
(Port 0 in External Bus
0.75 Vee V IOH = -300/LA
Mode)
0.9 Vee V IOH = -80 /LA (2)
III Input Leakage Current ±10 /LA 0.45 < VIN < Vee
(PortO, EA)
10-61
80C51BH, -1, -2/80C31BH, -1, ~2
NOTES:
1. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the Vou; of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pil')s make 1-
to-O transitions during bus operations. In the worst cases (capacitive loading> 100 pF), the noise pulse on the ALE line may
exceed O.BV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input. , '
2. Capacitive loading on PO,rts 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall below the 0.9 Vcc
specification when the address bits are stabilizing.
a
3. "Typicals" are based on limited number of samples taken from early manufacturing lots and are not guaranteed. The
values listed are at room temperature,'5V. '
4. ICCMAX at other frequencies is given by
Active Mode: ICCMAX = 1.47'X FREQ + 2.35
Idle Mode: ICCMAX = 0.33 x FREQ + 1.05 ,
where FREQ is the external oscillator frequency in MHz. ICCMAX is given in mAo See Figure 5.
5. See Figures 6 through 9 for Icc test conditions.
XTAL2
XTAL1
10r---+-~___i-~+--~
vss
MAX
IDLE MODE 270064-15
FREQ AT XTAL 1
270064-13
XTAL2
XTALI
vss
270064-14
10-62
inter 80C51BH, -1, -2/80C31BH, -1,-2
Figure 8. Clock Signal Waveform for Icc Tests in Active and Idle Modes. TCLCH = TCHCL = 5 ns.
Vce
lee~
",---v-
ee... vce
PO
RST Eli
XTAL2
XTALl
vss
270064-17
Figure 9. Icc Test Condition, Power Down Mode. All other pins are disconnected. Vcc = 2V to 6V.
10-63
80C51BH, -1, -2/80C31BH, -1,-2
A.C. CHARACTERISTICS
(TA = O·C to 70·C, Vee =. 5V ± 20%, Vss = OV, Load Capacitance for Port 0, ALE, and PSEN = 100 pF,
Load Capacitance for All Other Outputs = 80 pF)
10-64
intJ 80C51BH, -1, -2/80C31BH, -1,-2
TWHLH
ALE
---- ---TLLDy----
--TLLWl.-!----TRLAH-t----
------~------, Ir-----------------
TAHDZ
- -TRLAZ TRHD. -
I
--::
PORTO DATA IN
------TAyDy-------
270064-6
ALE
-TAYLL- - - - - - T P l P H - - -
TLLPL
TLUV
TPXIZI--
TPIII- -
INSTR
POATD IN
PORT 2 AI-AtS
270064-7
10-65
intJ 80C51BH, "1, -2/80C31BH, -1,-2
TWHLH
ALE
-TLLWL--j----TWLWH-----
TWHQX
..L
PORTO DATA OUT INSTR
IN
270064-8
10-66
inter 80C51BH, -1, -2/80C31BH, -1,-2
. -
i
L
Wz
§ 0
...t.
cO
]-i!i ]-i
I
I!l
! :!
I
Shift Register Mode Timing Waveforms
10·67
intJ 80C51BH, -1, -2/80C31BH, -1, ~2
270064-10
vee- o.s
0.45 V
=>( 0.2 VCC·+O.9
0.2 VCC-O.l
-.-=:.::..------
. x=.
270064-11
FLOAT WAVEFORMS
TIMING REFERENCE
POINTS
VOH-O.l V
10-68
80C31 BH/80C51 BH
EXPRESS
• Extended Temperature Range • 3.5 to 12 MHz Vee = 5V± 20%
• Burn-In
The Intel EXPRESS system offers enhancements to the operational specifications of the MCS®-51 family of
microcontrollers. These EXPRESS, products are designed to meet the needs of those applications whose
operating requirements exceed commercial standards.
The EXPRESS program includes the commercial standard temperature range with burn-in and an extended
temperature range with or without burn-in.
With the commercial standard temperature range, operational characteristics are guaranteed over the temper-
ature range of O°C to 70°C. With the extended temperature range option, operational characteristics are
guaranteed over the range of - 40°C to + 85°C.
The optional burn-in is dynamic for a minimum time of 160 hours at 125°C with Vee = '6.9V ±0.25V, following
guidelines in MIL-STD-883, Method 1015.
Package types and EXPRESS versions are identified by a one- or two-letter prefix to the part number. The
prefixes are listed in Table 1.
For the extended temperature range option, this data sheelspecifies the parameters which deviate from their
commercial temperature range limits. The commercial temperature range data sheets are applicable for all
parameters not listed' here.
September 1987
10-69 Order Number: 270218-002
inter 80C31BH/80C51BH EXPRESS
NOTE:
• Commercial temperature range Is O'C to 70'C. Extended temperature range is -40'C to +85'C.
• Burn·in is dynamic for a minimum time of 160 hours at 125'C. Vee = 6.9V ±0.25V. following guidelines in MIL·STO·883 .
Method 1015 (Test Condition OJ.
Examples:
P80C31 BH indicates 80C31 BH in a plastic package and specified for commercial temperature range, without
burn·in.
LD80C51 BH indicates 80C51 BH in a cerdip package and specified for extended temperature range with burn·
in.
. 10·70
87C51/87C51-1/87C51-2
CHMOS SINGLE-CHIP 8-BIT MICROCONTROLLER
WITH 4K BYTES OF EPROM PROGRAM MEMORY
87CS1-3.S to 12 MHz, Vee = sv ± 10%
87CS1-1-3.S to 16 MHz, Vee = SV ± 10%
87CS1-2-0.S to 12 MHz, Vee = SV ± 10%
• High Performance CHMOS EPROM • Programmable Serial Channel
• Quick-Pulse Programming™ Algorithm • TTL- and CMOS-Compatible Logic
• 2-Level Program Memory Lock Levels
r----------
~
270147-1
Figure 1. MCS®-S1 Architectural Block Diagram
October 1987
10-71 Order Number: 270147-004
87C51/87C51-1/87C51-2
P"O vee
P", PO.O (AOO)
P"2 PO.l (ADI)
P,,3
P"4
PO.2 (AD2)
PO.3 (AD3)
INDEX
CORNER
"": "! "! "l u
ii: ii: ii: ii: ii: z > ~
g"l
g .. ..'"
N
d d
270147-2
.'" ..'"
..; ~ N
...J
~ ~
x x
>
::;
'"'" u
z
o "-:
'"
~ ~ N N ..
N
DIP 270147-21
LCC/PLCC
RST: Reset input. A logic high on this pin for two EXTERNAL
machine cycles while the oscillator is running resets OSCILLATOR ----I XTAL 1
SIGNAL
the device. An internal pulldown resistor permits a
power-on reset to be generated using only an exter-
nal capacitor to Vee.
Table 1 Status of the external pins during Idle and Power Down
Program
Mode ALE PSEN PORTO PORT1 PORT2 PORT3
Memory
Idle Internal 1 1 Data Data Data Data
Idle External 1 1 Float Data Address Data
Power Down Internal 0 0 Data Data Data Data
Power Down External 0 0 Float Data Data Data
NOTE:
For more detailed information on the reduced power modes refer to current Embedded Controller Handbook, and Applica-
tion Note AP-252, "Designing with the 80C51BH."
pins is not inhibited. To eliminate the possibility of an Lock Bits: Also on th'e chip are two Lock Bits which
unexpected write to a port pin when Idle is terminat- can be left unprogrammed (U) or can be pro-
ed by reset, the instruction following the one that grammed (P) to obtain the following additional fea-
invokes Idle should not be one that writes to a port tures:
pin or to external memory.
Bit 1 Bit2 Additional Features
In the Power Down mode the oscillator is stopped, P U • Externally fetched code can not
and the instruction that invokes Power Down is the access internal Program Memory.
last instruction executed. The on-chip RAM and • Further programming disabled.
Special Function Registers retain their values until U P (Reserved for Future definition.)
the Power Down mode is terminated.
P P • Externally fetched code can not
a
The only exit from Power Down is hardware reset. access internal Program Memory.
Reset redefines the SFRs but does not change the • Further programming disabled.
on-chip RAM. The reset should not be activated be- • Program verification is disabled.
fore VCC is restored to its normal operating level and
must be held active long enough to allow the oscilla-
tor to restart and stabilize. When Lock Bit 1 is programmed, the logic level at
the EA pin is sampled and latched during reset. If
the device is powered up without a reset, the latch
DESIGN CONSIDERATIONS initializes to a random value, and holds that value
until reset is activated. It is necessary that the
Exposure to light when the device is in operation
latched value of EA be in agreement with the current
may cause logic errors. For this reason, it is suggest-
logic level at that pin in order for the device to func-
ed that an opaque label be placed over the window
tion properly.
when the die is exposed to ambient light.
10-74
inter 87C51/87C51-1/87C51-2
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O°C to + 70°C age to the device. This is a stress rating only and
Storage Temperature , ......... - 65°C to + 150°C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAlVpp Pin to Vss ....... OV to + 13.0V
tional sections of this specification is not implied. Ex-
Voltage on Any Other Pin to Vss .. -0.5V to +6.5V posure to absolute maximum rating conditions for
Power Dissipation .......................... 1.5W extended periods may affect device reliability.
(Based on package heat transfer limitations, not de-
vice power consumption). NOTICE Specifications contained within the
following tables are subject to change.
NOTES:
1. "Typicals" are based on a limited 'number of samples taken from early manufacturing lots and are not guaranteed. The
values listed are at room temp. 5V.
2. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins make 1-
to-O transitions during bus operations. In the worst cases (capacitive loading> 100pF). the noise pulse on the ALE pin may
exceed O.BV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger. or use an address latch with a Schmitt
Trigger STROBE input. ' ,
3. Capacitive loading on Ports 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall below the 0.9Vcc specifi-
cation when the address bits are stabilizing.
4. Pins of Ports 1. 2. and 3 source a transition current when they are being externally driven from 1 to O. The transition
current reaches its maximum value when VIN is approximately 2V.
5. IccMAX at other frequencies is given by:
Active Mode: IccMAX = 0.94 x FREQ + 13.71
Idle Mode: IccMAX = 0.14 x FREQ + 2.31
where FREQ is the external oscillator frequency in MHz. IccMAX is given in mAo See Figure 5.
6. See Figures 6 through 9 for Icc test conditions.
10-75
87C51/87C51·1/87C51·2
30
IIAX
ACTIVE IIODE
25
RST
20
XTAL2
I XTALI
VSS
'"E
u
!.! 270147-18
10
Figure 7. Icc Test Condition, Idle Mode.
All other pins are disconnected.
5~--~~+---+---~
TYP(1)
~=±::::::::±:=:t:=J IDLE MODE
4_ SMHz 1211Hz 16MHz
FREQ AT XTAL1 .
270147-16
RST
270147-20
XTAL2
XTALI
Vss
270147-17
270147-19
10-76
inter 87C51/87C51-1/87C51-2
A.C. CHARACTERISTICS: (TA = O°C to + 70°C; Vee = 5V ± 10%; Vss = OV; Load Capacitance for
Port 0, ALE, and PSEN = 100 pF; Load Capacitance for All Other Outputs = 80 pF)
10-77
inter 87C51/87CS1-1/87C51-2
ALE _ _J
PSEiii
---
PORT 0
......._ - - '
PORT 2 _ _ _J AB-A15
270147-5
ALE
PSEN I------TLLDV----I'I
----I~--- TRLRH -----I
PORTO INSTR. IN
TAVDV
PORT2 P2.0-P2.7 OR AB-A15 FROM DPH AB-A15 FROM PCH
270147-6
ALE
PSEN
TLLWL ----1"'1---- TWLWH --'----I
PORTO -
FROM RI OR DPL DATA OUT INSTR. IN
~---TAVWL---~
10-78
intJ 87C51/87C51-1/87C51-2
INSTRUCTION I 4 5 7.
ALE
CLOCK
A.C. TESTING:
VCC-0.5~ 0.2Vcc+0.9
_ 0.2 Vce-0.1
>C
•
0.45V , ~.....;;.;.....-----....
270147-10 270147-11
For timing purposes a port pin is no longer floating when a 100
AC inputs during testing are driven at Vee - 0.5 for a Logic "1" mV change from load voltage occurs, and begins to float when a
and 0.45V for a Logic "0." Timing measurements are made at VIH 100 mV change from the loaded VOHIVOL level occurs. IOLlioH
min for a Logic "I" and VIL max for a Logic "0". ;, ±20 rnA.
10-79
inter 87C51/87C51-1/87C51-2
NOTES: ,
"1" = Valid high for that pin
"0" = Valid low for that pin
Vpp = 12.7SV ± 0.2SV
Vcc = SV ± 10% during programming and verification
*ALE/PROG receives 25 programming pulses while Vpp is held at 12.75V. Each programming pulse is low for 100 ILS{± 10
ILS) and high for a minimum of 10 ILS,
+5V
vee
AO-A7 Pl PO PGM DATA
XTAL2 P2.6 0
P2.0 A8-All
XTAL 1
-P2.3
Vss
270147-12
10-80
inter 87C51/87C51-1/87C51-2
,'------25 PULSES
1 .. "
ALE/PROG:~-----~
'-----'
100!:!s
1'-..
10}'s I.41N1 " :t 10}'s "
ALE/PROG:
aI n n 270147-13
Quick-Pulse Programming™ through 1FH, using the "Pgm Encryption Table" lev-
els. Don't forget that after the Encryption Table is
The setup for Microcontroller Quick-Pulse Program- programmed, verify cycles will produce only encrypt-
mingTM is shown in Figure 10. Note that the 87C51 ed data.
is running with a 4 to 6 MHz oscillator. The reason
the oscillator needs to be running is that the device To program the Lock Bits, repeat the 25-pulse pro-
is executing internal address and program data gramming sequence using the "Pgm Lock Bit" lev-
transfers. els. After one Lock Bit is programmed, further pro-
gramming of the Code Memory and Encryption Ta-
The address of the EPROM location to be pro- ble is disabled. However, the other Lock Bit can still
grammed is applied to Ports 1 and 2, as shown in be programmed.
Figure 10. The code byte to be programmed into
that location is applied to Port O. RST, PSEN, and Note that the EA/vpp pin must not be allowed to go
pins of Ports 2 and 3 specified in Table 2 are held at above the maximum specified Vpp level for any
the "Program Code Data" levels indicated in Table amount of time. Even a narrow glitch above that volt-
2. Then ALE/PROG is pulsed low 25 times as age level can cause permanent damage to the de-
shown in Figure 11. vice. The Vpp source should be well regulated and
free of glitches and overshoot.
To program the Encryption Table, repeat the 25-
pulse programming sequence for addresses 0
10-81
intJ 87C51/87C51-1/87C51-2
+sv
1---1-1' PGt.!
AO-A7 PI 1 - - - . / DATA
RST EA/Vpp
ALE/PROG
P3.6
PSEN 1+---0
B7CSI
P3.7
P2.7 ....- - 0 (ENABLE)
""''''-r-l XTAL 1
vSS
270147-14
10·82
inter 87C51/87C51-1/87C51-2
PROGRAMMING- VERIFICATION-
Pl.0-Plo7
ADDRESS ADDRESS
P2.D-P2.3
-TAVQY
TSHGL-~:"
ALE/Pi!OO
_TGHGL
- - TGLGH 1 _ TGHSL
J LOGIC I LOGIC 1
________ ~G~Q ____
----- ---- ------
P2.7
(ENABLE)
·1. -TEHSH
----,--If
TELQV-
- I-TEHQZ
270147-15
'FOR PROGRAMMING CONDITIONS SEE FIGURE 10.
FOR VERIFICATION CONDITIONS SEE FIGURE 12.
10-83
inter 87C51
EXPRESS
• Extended Temperature Range • 3.S MHz to 12 MHz Vee = SV ± 10%
• Burn-In
The Intel EXPRESS system offers enhancements to the operational specifications of the MCS®-51 family of
microcontrollers. These EXPRESS products are designed to meet the needs of those applications whose
operating requirements exceed commercial standards.
The EXPRESS program includes the commercial standard temperature range with burn-in and an extended
temperature range with or without burn-in.
With the commercial standard temperature range, operational characteristics are guaranteed over the temper-
ature range of O'C to + 70·C. With the extended temperature range option, operational characteristics are
guaranteed over the range' of - 40'C to + 85·C.
The optional burn-in is dynamic for a minimum time of 160 hours at 125'C with Vee = 6.0V ± 0.25V, following
guidelines in MIL-STD-883, Method 1015.
Package types and EXPRESS versions are identified by a one- or two-letter prefix to the part number. The
prefixes are listed in Table 1.
For the extended temperature range option, this data sheet specifies the parameters which deviate from their
commercial temperature range limits. The commercial temperature range data sheets are applicable for all
parameters not listed here.
October 1987
10-84 Order Number: 270430-001
87C51 EXPRESS
NOTE:
1. Vee = 4.5V-5.5V, Frequency Range = 3.5 MHz-12 MHz.
10-85
87C51 EXPRESS
NOTES:
2. Commercial temperature range is O'C to + 70'C. Extended temperature range is - 40'C to + 85'C.
3. Burn-in is dynamic for a minimum time of 160 hours at .+ 125'C, Vee = 6.0V ±0.25V, following guidelines in MIL-STD-
883 Method 1015 (Test Condition D).
Examples:
P87C51 indicates 87C51 in a plastic package and specified for commercial temperature range, without burn-in.
LD87C51 indicates 87C51 in a cerdip package and specified for extended temperature range with burn-in.
/
10-86
inter 87C51FA (87C252)
CHMOS SINGLE-CHIP 8-BIT MICROCONTROLLER WITH
PROGRAMMABLE COUNTER ARRAY, UP/DOWN
COUNTER, 8K BYTES USER PROGRAMMABLE EPROM
• High Performance CHMOS EPROM.
• 32 Programmable I/O Lines
• Boolean Processor
MEMORY ORGANIZATION
PROGRAM MEMORY: Up to 8K bytes of the program memory can reside in the on-chip EPROM. In addition
the device can address up to 64K of program memory external to the chip.
DATA MEMORY: This microcontroller has a 256 x 8 on-chip RAM. In addition it can address up to 64K bytes of
external data memory. .
The Intel 87C51 FA is a single-chip control oriented microcontroller which is fabricated on Intel's reliable
CHMOS II-E technology .. Being a member of the MCS®-51 family, the 87C51 FA uses the same powerful
instruction set, has the same architecture, and is pin for pin compatible with the existing MCS-51 products. The
87C51 FA is an enhanced version of the 87C51. It's added features make it an even more powerful microcon-
troller for applications that require Pulse Width Modulation, High Speed I/O, and up/down counting capabili-
ties such as motor control. It also has a more versatile serial channel that facilitates multi-processor communi-
cations.
October 1987
10-87 . Order Number: 270258-002
87C51FA
PO.0-PO.7
,.----------~~~..:..~ -------- ..
~~
VSS
..r
z
Pmi TIMING ~
~IC==~~=~====~:;:=~==::::===::;::~==J
p::
ALE/I'l!l!ll
£A/VPP AND ::>
RST CONTROL ~ ~
;:;
270258-1
10·88
inter 87C51FA
10-a9
intJ 87C51FA
Table 1. Status of the External Pins during Idle and Power Down
Program
Mode ALE PSEN PORTO PORT1 PORT2 PORT3
Memory
Idle Internal 1 1 Data Data Data Data
Idle External 1 1 Float Data Address Data
Power Down Internal 0 0 Data Data Data Data
Power Down External 0 0 Float Data Data Data
NOTE:
For more detailed information on the reduced power modes refer to current Embedded Controller Handbook, and Applica-
tion Note AP-252, "Designing with the 80C51BH."
10-91
inter 87C51FA
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O°C to + 70°C age t'o the device. This is a stress rating only and
Storage Temperature .......... - 65°C to + 150°C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on EAlVpp Pin to VSS ....... OV to + 13.0V
tional sections of this specification is not implied Ex-
Voltage on Any Other Pin to Vss .. - 0.5V to + 6.5V posure to absolute maximum rating conditions for
Power Dissipation .......................... 1.5W extended periods may affect device reliability.
(based on PACKAGE heat transfer limitations, not
device power consumption) NOTICE Specifications contained within the
. following tables are subject to change.
ADVANCED INFORMATION-CONTACT
. INTEL FOR DESIGN-IN INFORMATION
. .
NOTES:
1. Capacitive loading on Ports a and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port a and Port 2 pins when these pins make 1 to
a transitions during bus operations. In applications where capacitance loading exceeds 1aa pFs, the noise pulse on the ALE
signal may exceed a.BV. In these cases, it may be desirable to qualify ALE with a Schmitt Trigger. or use an Address Latch
with a Schmitt Trigger Strobe input.
2. Capacitive loading on Ports a and 2 cause the VOH on ALE and PSEN to drop below the a.9 Vee specification when the
address lines are stabilizing.
3. See Figures 6-9 for test conditions.
10-92
intJ 87C51FA
40mA
30mA
"'AX.
20mA
ACTIVE V RST
V_ V -
....
TYPICAL
B7C51FA
IOmA
OmA
-- r-'DLE MAX.
TYPICAL
XTAL2
XTALl
vss
OMHz 4t.1Hz StAHz 12MHz 16MHz
270258-5 270258-6
ICC Max at other frequencies is given by:
All other pins disconnected
Active Mode
TCLCH = TCHCL = 5 ns
Icc MAX = 2.2 X FREQ + 3.1
Idle Mode
Icc MAX = 0.49 x FREQ + 1.6 Figure 6. Icc Test Condition, Active Mode
Where FREQ is in MHz, IccMAX is given in rnA.
RST
B7C252
XTAL2
XTALf
Vss
270258-7 270258-8
All other pins disconnected All other pins disconnected
TCLCH = TCHCL = 5 ns
Figure 9. Icc Test Condition, Power Down Mode.
Figure 7. ICC Test Condition Idle Mode Vcc = 2.0V to 5.5V.
270258-19
Figure S. Clock Signal Waveform for Icc Tests In Active and Idle Modes. TClCH = TCHCl = 5 ns.
10-93
inter 87C51FA
A.C. CHARACTERISTICS (TA = o·C to + 70·C, Vee = 5V ± 10%, Vss = OV, Load Capacitance for
Port 0, ALE/PROG and PSEN = 100 pF, Load Capacitance for All Other Outputs = 80 pF)
10-94
inter 87C51FA
ALE _ _J
PSEN _ _J
PORT a
----'
PORT 2 _ _ _J AB-A15
270258-9
ALE
PSEN
1 - - - - - - TLLDV 'I
---0-1---- TRLRH _ - - - I
RD
PORTO INSTR. IN
ALE
TLLWL--~---TWLWH---I
I---+---TQVWH - - - - - i
],--~~-""""Ii.
PORTO DATA OUT INSTR. IN
270258-11
10-95
inter 87C51FA
270258-13
10-96
inter 87C51FA
>C
VCC-0.5-=::X: 0.2 VCC+0.9 VOH-D.l V
TIMING REFERENCE
POINTS
0.45 V 0.2 VCC-O.l VOL +0.1 V
270258-15
270258-14
For timing purposes a port pin is no longer floating when a
AC Inputs during testing are driven at Vee-0.5V for a Logic "1" 100 mV change from load voltage occurs, and begins to float
and 0.45V for a Logic "0". Timing measurements are made at V,H when a 100 mV change from the loaded VOHIVOl level occurs.
min for a Logic "1" and VOL max for a Logic "0". IOl/lOH ;, ± 20 mA.
EPROM CHARACTERISTICS
Table 2 shows the logic levels for programming the
Program' Memory, the Encryption Table, and the
Lock Bits and for reading the signature bytes.
NOTES:
"1" = Valid high for that pin
'0" = Valid low for that pin
"VPP" = +12.75V ±0.25V
• ALE/PROG is pulsed low for 100 /Jos for programming. (Quick·PulseProgramming™)
PROGRAMMING THE EPROM Normally EAIVpp is held at logic high un_!!!...iust be-
fore ALE/PROG is to be pulsed. Then EAIVpp is
To be programmed, the part must be running with a raised to Vpp, ALE/PROG is pulsed low, and then
4 to 6 MHz oscillator. (The reason the oscillator EAIVpp is returned to a valid high Voltage. The volt·
needs to be running is that the internal bus is being age on the EAIVpp pin must be at the valid EAIVpp
used to transfer address and program data to appro· high level before a verify is attempted. Waveforms
priate internal EPROM locations.) The address of an and detailed timing specifications are shown in later
EPROM location to be programmed is applied to sections of this data sheet.
Port 1 and pins P2.0 • P2.4 of Port 2, while the code
byte to be programmed into that location is applied Note that the EAIVpp pin must not be allowed to go
to Port O. The other Port 2 and 3 pins, RST PSEN, above the maximum specified Vpp level for any
and EAIVpp should be held at the "Program" levels amount of time. Even a narroW glitch above that volt-
indicated in Table 2. ALE/PROG is pulsed low to age level can cause permanent damage to the de·
program the code byte into the addressed EPROM vice. The Vpp source should be well regulated and
location. The setup is shown in Figure 10. free of glitches.
10·97
intJ 87C51FA
+5V
Vee
\
. XTAL 1. P2.0
-P2.4
Vss
270258-20
10-98
intJ 87C51FA
ALE/PROG:---:utJLllJt - - - - -
'--'
ULWu-
1 "-. 10}'! MIN1 I' !~~'t: 'I
ALE/PROG:---":o~I _ _ _ _ _ _... nL_____--In. .___
270258-21
Vee
I-_LJ\. PGM
AD-A7 PI PO
t - - - - . / DATA
RST EA/Vpp
ALE/PROG
P3.6
PSEN ....- - 0
87CSIFA
P3.7
P2.7 1 + - - 0 (ENABLE)
270258-22
10-99
87C51FA
10-100
inter 87C51FA
PROGRAMMING VERIFICATION
Pl.0-Pl.?
ADDRESS ADDRESS
P2.0-P2.4
-TAVQV
TSHGLr---
EIi/vpp
1
TGLGH
~.-:.-,,","
Vpp EA/HIGH
TEHQZ
P2.?
TELQVl
}
270258-18
10-101.
83C152A
UNIVERSAL COMMUNICATION CONTROLLER
8-BIT MICROCOMPUTER WITH FACTORY
MASK PROGRAMMABLE ROM
80C152A
UNIVERSAL COMMUNICATION CONTROLLER
8-BIT MICROCOMPUTER
• Superset of 80C51BH Architecture
• 64KB Data Memory Addressing
The 80C152, which is based on the MCS®-51 CPU, is a highly integrated single-chip 8-bit microcontroller
designed for cost-sensitive, high-speed, serial communications. It is well suited for implementing Integrated
Services Digital Networks (ISDN), emerging Local Area Networks, and user defined serial backplane applica-
tions. In addition to the multi-protocol communication capability, the 80C152 offers traditional microcontroller
features for peripheral 1/0 interface and control.
Silicon implementations are much more cost effective than multiwire cables found in board level parallel-to-se-
rial and serial-to-parallel converters. The 83C152 contains, in silicon, all the features needed for the serial-to-
parallel conversion. Other 83C152 benefits include: 1) better noise immunity through differential signaling or
fiber optic connections, 2) data integrity utilizing the standard, designed in CRC checks, and 3) better modulari-
ty of hardware and software designs. All of these-cost, network parameter and real estate improvements
apply to 83C152 serial links between boards or systems and 83C152 serial links on a single board.
(GRXO) no I
(GTDX) Pl.! 2
(DEN) P1.2 :3
(i'Xc) PI.3 04
(m) PI.4 5 P4.6
(RIB) P1.5 PO
(HLDA) PloG RESET 13 N.C.
P3.D 14
N.C.
P2.7
P3.S P2.6
P3.6 P2.S
P3.7
270188-3
270188-2
Figure 1. Connection Diagrams
September 1987
10-102 Order Number: 270188-003
r
P4.0-P4.7 P2.0-P2.7
-----" (
I SARL1
I SARHl
DARLl
I
DARHl
BCRL1
I
~
c...CD I CD
0
....
0
o m
~·o
~
oc.J :III"
n
I TLO IPNl
en
N
l>
.....
SBUf(RX) CD
Co)
THO IENl
C
iii· TL1 IP
~~~f~Tit~ ....0en
...
(Q
DI
THl IE
SCON
N
l>
3
~
'lEJ
aID
Iiiiil
ADRO-3
IF'
BAUD ~
_-.J ~
P1.0- P1.7 P3.0- P3.7 270188-1
~
aID
~
inter 80C152A/83C152A
NOTES:
1. N.C. pins on PLCC package may be connected to internal die and should not be used in customer applications.
2. It is recommended that both Pin 3 and Pin 33 be grounded for PLCC devices.
10-104
intJ 80C152A/83C152A
OSCILLATOR CHARACTERISTICS
XTAL2
XTAL 1 and XTAL2 are the input and output, respec-
tively, of an inverting amplifier which can be config- XTAL 1
ured for use as an on-chip oscillator, as shown in
Figure 3. t - - - - - - I Vss
270188-5
10-105
infef 80C152A/83C152A
Table 1. Status of the external pins during Idle and Power Down modes
,
Program
Mode . ALE PSEN PortO Port 1 Port 2 Port 3 Port 4
Memory
Idle Internal 1 1 Data Data Data Data Data
Idle External 1 1 Float Data Address Data Data
Power Down Internal 0 0 Data Data Data Data Data
Power Down External 0 0 Float' Data Data Data Data
NOTE:
For more detailed information on the reduced power modes refer to the Embedded Controller Handbook, and Application
Note AP-252, "DeSigning with the 80C51BH."
10-106
intJ 80C152A183C152A
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .......... - 6S·C to + 1S0·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on Any pin to Vss .. - O.SV to (Vee + O.SV)
tional sections of this specification is not implied. Ex-
Voltage on Vee to VSS ........... -O.SVto +6.SV posure to absolute maximum rating conditions for
Power Dissipation ....................... 1.0 W(7) extended periods may affect device reliability.
Typ
Symbol Parameter Min Max Unit Test Conditions
(Note 1)
V,L Input Low Voltage -O.S 0. 2Vee- 0.1 V
(All Except EA)
V,L1 Input Low Voltage - -O.S 0.2Vee- 0.3 V
(EA)
V,H Input High Voltage 0.2Vee+ 0.9 Vee+ O.S V
(Except XTAL 1, RST)
V,H1 Input High Voltage 0.7Vee Vee+ O.S V
(XTAL 1, RST)
VOL Output Low Voltage 0.45 V IOL = 1.6 mA
(Ports 1, 2, 3, 4) (Note 2)
VOL1 Output Low Voltage 0.45 V IOL =3.2mA
(Port 0, ALE, PSEN) (Note 2)
VOH Output High Voltage 2.4 V IOH = -60p..A
(Ports 1, 2, 3, 4, Vee = SV ±10%
ALE, PSEN)
0.9Vee • V IOH = -10 p..A
VOH1 Output High Voltage 2.4 V IOH = -400 p..A
(Port 0 in External Vee = SV ±10%
Bus Mode)
0.9Vee V IOH = -40 p..A (Note 3)
I,L Logical 0 Input -so p.A V,N = O.4SV
Current (Ports 1, 2, 3, 4)
ITL Logical 1 to 0 -6S0 p.A V,N = 2V
Transition Current
(Ports 1, 2, 3, 4)
III Input Leakage ±10 p.A O.4S<V,N <Vee
(PortO, EA)
RRST Reset Pullup Resistor 40 k!l
10-107
80C152A/83C152A
NOTES:
1. "Typicals" are based on samples taken from early manufacturing lots and are not guaranteed. The measurements were
made with Vcc = 5V at room temperature.
2. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and S. The noise is due to external bus capacitance discharging into the. Port 0 and Port 2 pins when these pins make 1-
to-O transitions during bus operations. In the worst cases (capacitive loading >.100 pF), the noise pulse on the ALE pin may
exceed o.av. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
S. Capacitive loading on Ports 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall below the 0.9Vcc specifi-
cation when the address bits are stabilizing.
4. Icc is measured with all output pins disconnected; XTAL 1 driven with TCLCH, TCHCL = 5 ns, ~ = VSS + 0.5V, VIH =
~ - 0.5V; XTAL2 N.C.; Port 0 pins connected tei Vc~'Operating" current is measured with EA connected to Vee and
RST connected to Vss. "Idle" current is measured with EA connected to Vss, RST connected to Vcc and GSC inactive.
5. The specifications relating to external data memory characteristics are also applicable to DMA operations.
6. TOVWX should not be confused with TOVWX as specified for aOC51BH. On aOC152, TOVWX is measured from data
valid to rising edge of WR. On aOC51BH, TOVWX is measured from data valid to falling edge of WR. See timing diagrams.
7. This value is based on the maximum allowable die temperature and the thermal resistance of the package.
. .
45
40
35 MAX Icc
30 (ACTIVE) (NOTE 4)
'< 25 /"
.§. TYPICAL Icc
~
20 ./ '" (ACTIVE) (NOTE 1)
/ " ...... ~
--
15 MAX Icc
10 ./' (IDLE) (NOTE 4)
5 ~- TYPICAL Icc
IDLE (NOTE 1)
0
4 8 12
FREQUENCY (MHz)
270188-17
10-108
intJ 80C152A183C152A
A.C. CHARACTERISTICS (TA = O·C to + 70·C; Vee = 5V ± 10%; Vss = OV; Load Capacitance for
Port 0, ALE, and PSEN = 100 pF; Load Capacitance for All Other Outputs = 80 pF)
10-109
inter 80C152A/83C152A
ALE _ _J
rssEN _ _J
PORT 0 _ _..I
270188-6
ALE ,
PSEN I-----TLLDV------l.,
- - i - - - TRLRH - - - I
PORTO' INSTR. IN
270188-7
10-110
80C152A/83C152A
ALE
, I \.
P TWHlH
PSEN \. ~
I+-- TlLWL TWlWH
WR ~
TOVWX
,I
-- TAVll ~TLLAX~ - r- TWHOX
PORTO
::::r AO-A7 FROM R. OR DPL )
TAVWl
DATA OUT X XAO-A7 FROM PCl INSTR. IN
'PORT 2
-
~ P2.0-P2.7 OR A8-A15 FROM DPH X A8-A15 FROM PCH
270188-8
270188-9
10-111
inter 80C152A183C152A
ALE
CLOCK
t t
CLEAR RI SET RI
270188-10
A.C. TESTING:
270188-11 270188-12
For Timing Purposes a Port Pin is no Longer Floating when a 100
AC Inputs During Testing are Driven at Vee-O.S for a Logic "1"
mV change from Load Voltage Occurs, and Begins to Float when·
and O.4SV for a Logic "0". Timing Measurements are made at VIH
Min for a Logic "1" and Vil Max'for a Logic '~O". a 100 mV change from the Loaded VOHIVOl Level occurs
IOl/lOH ~ ± 20 rnA
10-112
inter 80C152A/83C152A
NOTES:
8. Same as TCLCH, use External Clock Drive Waveform.
9. Same as TCHCL, use External Clock Drive Waveform.
II BT 'I I
MANCHESTER :::::x: I
I
~i~
:-~
I I I
I
~~-+
I
X ~ I I
I
C::::
I
GRXD
I HBTJR FBTJR I
NRZ1:::::X:
~, I
~
t,1
,~
I
GRxD
FBTJR
270188-13
10-113
intJ 80C152A/83C152A
MANCHESTER.
t+'----
I'
*
BT ----~·I
I _ _ _ _~HB~T~JT~~~__....I~-~-~FB~T~JT----....I
x::::
I
I
GTxD
FBTJT
270188-14
10-114
inter SOC152A1S3C152A
t+·----ECBT----~·1
-----x
1 1
270188-15
10-115
80C152A/83C152A
10-116
83C 152JA/83C 152JA-1
UNIVERSAL COMMUNICATION CONTROLLER
8-BIT MICROCOMPUTER WITH FACTORY MASKED
PROGRAMMABLE ROM
80C152JA/80C152JA-1
UNIVERSAL COMMUNICATION CONTROLLER
8-BIT MICROCOMPUTER
80C152JB/80C152JB-1
UNIVERSAL COMMUNICATION CONTROLLER
8-BIT MICROCOMPUTER WITH EXTENDED 1/0
• Superset of 80C51 Architecture • 64KB Data Memory Addressing
• Multi-Protocol Serial Communication • 256 Bytes On-Chip RAM
I/O Port (2.048 Mbps/2.4 Mbps Max)
• Dual On-Chip DMA Channels
-SDLC
-HDLC • Hold/Hold Acknowledge
-CSMAlCD • Two General Purpose Timer/Counters
- User Definable Protocols
• 56 Special Function Registers
• Full Duplex/Half Duplex
• 11 Interrupt Sources
• MCS®-51 Compatible UART
• Available in 48 Pin Dual-in-Line Package
• 16.5 MHz Maximum Clock Frequency and 68 Pin Surface Mount PLCC
• Multiple Power Conservation Modes Package
(See Packaging Spec. Order #231369)
• 64KB Program Memory Addressing
The 80C152, which is based on the MCS®-51 CPU, is a highly integrated single·chip 8·bit microcontroller
designed for cost-sensitive, high-speed, serial communications. It is well suited for implementing Integrated
Services Digital Networks (ISDN), emerging Local Area Networks, and user defined serial backplane applica-
tions. In addition to the multi-protocol communication capability, the 80C152 offers traditional microcontroller
features for peripheral 1/0 interface and control.
Silicon implementations are much more cost effective than multi-wire cables found in board level parallel-to-
serial and serial-to-parallel ~onverters. The 83C152 contains, in silicon, all the features needed for the serial-
to-parallel conversion. Other 83C152 benefits include: 1) better noise immunity through differential signaling or
fiber optic connections, 2) data integrity utilizing the standard, designed in CRC checks, and 3) better modulari-
ty of hardware and software designs. All of these-cost, network parameter and real estate improvements-
apply to 83C152 serial links between boards or systems and 83C152 serial links on a single board.
September 1987
10-117 Order Number: 270431-001
inter 80C152JAl83C152JA/80C152JB ~[Q)W~OO©[§ OOOIP@OOINl~"iiO@OO
(GRXO)
(GTOX)
vee
P4.0
INDEX
CORNER'\,.
. . . 2 ~ i ;~~ 4
Ill;; "l q <i
z z z ~ : i. :. i
N .,
(DEN) P4.1
Pl.6 P"',5
(TXC) P4.2
Pl.7 P4.6
(RxC) P1.4 P4.3
N.C. P4.7
(HLO) P1.S P4.4
N.C.
(HLOA) P1.6 P4.5
P3.0 EA
Pl.7 P4.6
P3.1 ALE
RESET P4.7 (TOP VIEW)
P3.2 PSEN
(RXO) P3.0 EA N.C. N.C.
(TXO) P3.1 ALE P3.3 8DC1S2JA N.C.
83C152JA
(INTO) P3.2 PSEN P3.4 N.C.
(iNTi) P3.3 P2.7 (A1S) N.C. N.C.
(TO) P3.4 P2.6 (AI4) N.C. N.C.
(Tl) P3.S P2.S (AI3) N.C. P2.7
(i¥R) P3.S P2.4 (AI2) P3.5 P2.6
(Rii) P3.7 P2.3 (All) PM P2.5
(A/DO) PO.O P2.2 (Al0) P3.7 P2.4
(A/Ol) PO.l
(A/02) PO.2
P2.1 (A9)
P2.0 (A8)
N.C.
...
N ~ gJ iil ;; N . . Pi m
., .,., ., .," ., ~ ~ :; ~ ~
P2.3
(A/03) PO.3
XTAL2
PO.7 (A/07)
PO.S (A/OS) g~ --;" ~
f
'1 ~ ::;
~ ~~
. ~~~
"!
~ ~
<iz
~ ~
OJ
~
XTALl PO.S (A/OS)
~ S
V,s PO.4 (A/04) 270431-2
270431-1
P4.5
P4.S
P4.1
P6.3
EA
P3.1 ALE
P3.2 PSEN
PS.O (TOP VIEW) EPSEN
P3.3 P6.2
P3.4 8~152JB PS.7
P5.1 P6.4
P5.2 P5.7·
PS.3 P2.7
P3.5 P2.6
P3,6 P2.5
P3.7 P2.4
.,.
N.C. P2.3
::. re ~ iil ;;; ~ ~ ;:\ ~ i;; :ll III ~ :;; ~ ~
~ ~
OJ
~ ~
~
~ ~
::; ~"<oI;
> ~ ....
"~ ~ d ~ ~ "! C!
~ .~ ~
OJ
~
270431-3
10·118
·P6.0-P6.7 P4.0-P4.7 PO.O-PO.7 P2.0-P2.7
-----11 t
SARL1
SARHI
OARL1
OARHI
CI)
BCRL1
o
....CJI
(")
~
l>
......
CI)
." Co)
iD: ....CJI
(")
...CD
c
'?
!'l
UJ
1.£1 N
Co.
l>
......
em
..... 0'
~ I"~
CI)
n
;I;' THO o
CO
C ....(")CJI
~
TLI
iii"
...
ce
DI
·EBEN
,
THI
~
3 a:J
~
~
l§!
~
;:;g
©
IiiiiI
~
'liil
ADRD-3
©
2&
~
BAUD
_-.J ~
~
Pl.0- P1.7 P3.0-P3.7 270431-4 <=
'On 80C152JB Only ©
~
intJ 80C152JAl83C152JA/80C152JB ~@w~oo©~ DOOIP©OOIMl~'jj'D©OO
80C152JB General Description EPSEN is used in conjunction with Port 5 and Port 6
program memory operations. EPSEN functions like
The 80C152JB is a ROM less extension of the PSEN during program memory operation, but sup-
aOC152 Universal Communication controller. The ports Port 5 and Port 6. EPSEN is the read strobe to
80C152JB has the same five 8-bit I/O ports of the externai program memory for Port 5 and Port 6.
80C152, plus an additional two 8-bit 1/0 ports, Port 5 EPSEN is activated twice during each machine cycle
, and Port 6. The 80C152JB also has two additional unless an external data memory operation occurs on
control pins, EBEN (EPROM Bus ENable), and Port(s) 0 and Port 2. When external data memory is
EPSEN (EPROM bus Program Store ENable). accessed the second activation of EPSEN is
skipped, which is the same as when using PSEN.
EBEN selects the functionality of Port 5 and Port 6. Note that data memory fetches cannot be' made
When EBEN is low, these ports are strictly I/O, simi- through Ports 5 and 6.
lar to Port 4. The SFR location for Port 5 is 91 Hand
Port 6 is OA 1H. This means Port 5 and Port 6 are not When EBEN is high and EA is low, all program mem-
bit addressable. With EBEN low, all program memo- ory operations take place via Ports 5 and 6. The high
rY fetches take place via Port 0 and Port 2. (The byte of the address goes out on Port 6, and the low
80C152 is a ROMless only product). When EBEN is byte is output on Port 5. ALE is still used to latch the
high, Port 5 and Port 6 form an address/data bus address on Port 5. Next, the op code is read on Port
called the E-Bus (EPROM-Bus) for program memory 5. The timing is the same as when using Ports 0 and
operations. ' 2 for external program memory operations.
10-120
inter SOC 152JAlS3C 152JAlSOC152JB ~@W~OO©[§ OOO[F@OOIM]~'iiO@OO
NOTES:
1. N.C. pins on PLCC package may be connected to internal die and should not be used in customer applications.
2. It is recommended that both Pin 3 and Pin 33 be grounded for PLCC devices.
10-121
inter 80C152JAl83C152JA/80C 152JB ~1ID\Yl~OO©[§ OOO!F©OO!MI~ii"O©OO
10-122
80C152JA/83C152JA/80C152JB ~(Q)W~OO©~ OOOIF@OOIMl~liO@OO
OSCILLATOR CHARACTERISTICS
XTAL 1 and XTAL2 are the input and output, respec-
NC - XTAL2
tively, of an inverting amplifier which can be config-
ured for use as an on-chip oscillator, as shown in EXTERNAL
Figure 3. OSCILLATOR - - - - I XTAL 1
SIGNAL
To drive the device from an external clock source,
XTAL 1 should be driven, while XTAL2 is left uncon- ~L.v_s_s__
nected, as shown in Figure 4. There are no require-
ments on the duty cycle of the external clock signal, 270431-6
since the input to the internal clocking circuitry is
through a divide-by-two flip-flop, but minimum and Figure 4. External Clock Drive
maximum high and low times specified on the Data
Sheet must be observed.
IDLE MODE
In Idle Mode, the CPU puts itself to sleep while most
of the on-chip peripherals remain active. The major
XTAL2 peripherals that do not remain active during Idle, are
the DMA channels. The Idle Mode is invoked by
XTAL 1 software. The content of the on-chip RAM and all
the Special Function Registers remain unchanged
during this mode. The Idle Mode can be terminated
+-------1 vss by any enabled interrupt or by a hardware reset.
270431-5
POWER DOWN MODE
Figure 3. Using the On-Chip Oscillator
In Power Down Mode, the oscillator is stopped and
all on-chip functions cease except that the on-chip
RAM contents are maintained. The mode Power
Down is invoked by software. The Power Down
Mode can be terminated only by a hardware reset.
Table 2. Status of the External Pins During Idle and Power Down Modes
80C152JAl83C152JA
Program
Mode ALE PSEN Porta Port 1 Port 2 Port 3 Port 4
Memory
Idle Internal 1 1 Data Data Data Data Data
Idle External 1 1 Float Data Address Data Data
Power Down Internal 0 0 Data Data Data Data Data
Power Down External 0 0 Float Data Data Data Data
80C152JB
Instruction
Mode ALE PSEN EPSEN Porta Port 1 Port 2 Port 3 Port 4 Port 5 Port 6
Bus
Idle PO,P2 1 1 1 Float Data Address Data Data OFFH OFFH
Idle P5,P6 1 1 1 Data Data Data Data Data OFFH Address
Power Down PO,P2 0 0 1 Float Data Data Data Data OFFH OFFH
Power Down P5,P6 0 1 0 Data Data Data Data Data OFFH OFFH
NOTE:
For more detailed information on the reduced power modes refer to the Embedded Controller Handbook, and Application
Note AP-252, "Designing with the 80C51BH."
10-123
intJ 80C152JA/83C152JA/80C152JB ~@W~OO©[§ OOO!P@!ru!Ml~iiO@OO
ABSOLUTE MAXIMUM RATINGS* *Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias .... O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .......... - 65·C to + 150·C functional operation of the device at these or any
.other conditions above those indicated in the opera-
Voltage on Any pin to Vss .. -0.5\.1 to (Vee + 0.5V)
tional sections of this specification is not implied. Ex-
Voltage on Vee to VSS ........... -0.5V to + 6.5V posure io absolute maximum rating conditions for
Power Dissipation ....................... 1.0W(9) extended periods may affect device reliability.
Typ
Symbol Parameter Min Max Unit Test Conditions
(Note 3)
Vil Input Low Voltage -0.5 0.2Vec- 0.1 V
(All E~cept EA, EBEN)
VIl1 Input LowVoltage -0.5 0.2Vee- 0.3 V
(EA, EBEN)
VII-i Input High Voltage· 0.2Vee+ 0.9 Vee+ 0.5 V
(Except XTAL 1, RST)
VIH1 Input High Voltage 0.7Vee Vee+ 0.5. V
(XTAL1, RST) ,
10-124
80C152JAl83C152JAl80C152JB &,[gJW&,OO©[§ OOOlf@ffiJ[MJ&''ii'O@OO
NOTES:
3. "Typicals" are based on samples taken from early manufacturing lots and are not guaranteed. The measurements were
made with Vee = 5V at room temperature.
4. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins make 1-
to-O transitions during bus operations. In the worst cases (capacitive loading> 100 pF), the noise pulse on the ALE pin may
exceed O.BV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
5. Capacitive loading on Ports 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall below the 0.9Vee specifi-
cation when the address bits are stabilizing.
6. lee is measured with all output pins disconnected; XTAL 1 driven with TCLCH, TCHCL = 5 ns, V,L = Vss + 0.5V, V,H =
Vee - 0.5V; XTAL2 N.C.; Port 0 pins connected to Vee. "Operating" current is measured with EA connected to Vee and
RST connected to Vss. "Idle" current is measured with EA connected to Vss, RST connected to Vee and GSC inactive.
7. The specifications relating to external data memory characteristics are also applicable to DMA operations.
B. TQVWX should not be confused with TQVWX as specified for BOC51BH. On BOC152, TQVWX is measured from data
valid to rising edge of WR. On BOC51 BH, TQVWX is measured from data valid to falling edge of WR. See timing diagrams.
9. This value is based on the maximum allowable die temperature and the thermal resistance of the package.
10. All specifications relating to external program memory characteristics are applicable to:
EPSEN for PSEN
Port 5 for Port 0
Port 6 for Port 2
when EBEN is at a Logical 1 on the BOC152JB.
45
MAX Icc (ACTIVE)
40
35 /'
'/
30 TYPICAL Icc
~ /'" /"" (ACTIVE) (NOTE 1)
--
25
5u 20
.... v /'"
2
15 /'" V MAX Icc (IDLE)
10
_/ /" ....-
- :::---
...-::: TYPICAL Icc
5 IDLE (NOTE 1)
0
4 8 12 16
FREQUENCY (MHz)
270431-7
10-125
SOC152JA/S3C 152JAlSOC152JB ~[Q)W~OO©[§ OOO~@OOIMl~iiO@OO
A.C. CHARACTERISTICS (TA = O·C to + 70·C; Vee = 5V ± 10%; Vss = OV; Lqad Capacitance for
Port 0, ALE, and PSEN = 100 pF; Load Capacitance for All Other Outputs = 80 pF)
10-126
inter 80C152JAl83C152JAl80C152JB ~[Q)WbW~'J©[g O~IP@rnl[i'li]~iJO@~
ALE _ _oJ
PORT O/PORT 5
----'
ALE
PSEN I-----TLLDV-----I'I
TRLRH ---I
RD
PORTO INSTR. IN
270431-9
10-127
infef 80C152JA/83C152JA/80C1 ~2JB ~[Q)\Yl~OO©~. oOO!r@OO[MJ~'U'O@OO
ALE I \.
i=4- TWHLH
PSEN \.
,
-TLLWL TWLWH
-'
WR 1
TQVWX J
-. TAVLL I-- TLLAX---j -. r- TWHQX
PORTO
::::r AO-A7 FROM R, OR DPL )
TAVWL
DATA OUT X X AO- A7 FROM PCL INSTR. IN
PORT2
=> P2.0-P2.7 OR A8-A15 FROM DPH A8-A15 FROM PCH
270431-10
270431-11
10-128
inter SOC 152JA/S3C152JA/SOC152JB ~[Q)W~OO©~ OOOIF@OOIMl~'ifO@OO
INSTRUCTION I 7
ALE
CLOCK
r- TQVXH~ r- TXHQX
OUTPUT OATA
'''---'''''---r' '-----rJ "---""'--..JX'-_---JX 4 X'-_---JX"---_-'x"---""'--..JI
t t
WRITE TO SSUF SET TI
t t
CLEAR RI SET RI
270431-12
A.C. TESTING:
INPUT, OUTPUT WAVEFORMS FLOAT WAVEFORM
vce-O.s===>(
0,45 V
0.2Vcc+0.9
_;..0_.2_V.,;;CC;,.-_0_.1_ _ __
L
270431-13 270431-14
For Timing Purposes a Port Pin is no Longer Floating when a
AC Inputs During Testing are Driven at Vcc-O,5 for a Logic "1"
100 mV change from Load Voltage Occurs, and Begins to Float
and 0.45V for a Logic "0", Timing Measurements are made at VIH
when a 100 mV change from the Loaded VOHIVOL Level occurs
Min for a LogiC "1" and VIL Max for a Logic "0",
IOLIiOH ;, ± 20 rnA.
10-129
intJ 80C152JA/83C152JA/80C152JB ~[Q)W~OO©~ OOOIF@OOIMl~ii"O@OO
~OTES:
'11. Same as TCLCH, use External Clock Drive Waveform.
12. Same as TCHCL, use External Clock Drive Waveform.
II BT 'I
c::::
1 1
MANCHESTER =::J(
1
~X~ ~I
I......
~I~;'-------'I
X.' ~ 1
GRxD
NRzr=:::X
~ I ~
)K
'I' I
~ : GRxD
FBTJR
270431-15
10-130
intJ SOC152JAlS3C152JAlSOC152JB ~[Q)\\7~OO©~ OOOI?@OOIMl~ii'O@OO
~I'--------BT--------~'I I
MANCHESTER =::x I
I
? X, ? ? X,..-~?r--x:::: GTxD
'----"""Tl~..,,_"':'+~"'------''--''''~~,'---'I :~~ I
I
I_----H-B-TJ-T-~-~I~-~--F-BT-JT---~I
NRZ1=::X ~. ~ .~ ~ GTxD
ai'
FBTJT
270431-16
10-131
intJ 80C152JA/83C152JA/80C152JB ~IQ)\YI~OO©[§ OOOIr@OO[M)~'iiO@OO
f4"I'----ECBT ------+1'1
----x
1 1
EXTERNAL CLOCK
~ECL----:
1. 'X
: - - - ECH - . : "'I_ _ _--J
/
_ _....;...1 :-- ECDVT
:X,.-.;;...;.------...;....--
-+j
TRANSMIT DATA : X
ECDHT -+t ;....~--------....- -
f4"I'----ECBT------+t·1
1
1
I~______ J
1
/,-----.. .X
~
1 - : ECDSR '--ECDHR-: 1
RECEIVE DATA -~'''':--X Xr -;---......------..:.:.--
, ,~~--------~~--
270431-17
10-132 .
inter 27C64/S7C64
64K (SK x S) CHMOS PRODUCTION AND
UV ERASABLE PROMS
• CHMOS Microcontroller and • High Performance Speeds
Microprocessor Compatible - 150 ns Maximum Access Time
- 87C64-lntegrated Address Latch
• New Quick-Pulse Programming™
- Universal 28 Pin Memory Site, 2-line Algorithm (1 second programming)
Control
• Available in 28-Pin Cerdip and Plastic
• Low Power Consumption DIP Package and 32-Lead PLCC
-100}J-A Maximum Standby Current Package.
• Noise Immunity Features (See Packaging Spec, Order #231369)
- ± 10% Vee Tolerance
- Maximum Latch-up Immunity
Through EPI Processing
Intel's 27C64 and 87C64 CHMOS EPROMs are 64K bit 5V only memories organized as 8192 words of 8 bits.
They employ advanced CHMOS*II-E circuitry for systems requiring low power, high performance speeds, and
immunity to noise. The 87C64 has been optimized for multiplexed bus microcontroller and microprocessor
compatibility while the 27C64 has a non-multiplexed addressing interface and is plug compatible with the
standard Intel 2764A (HMOS II-E).
The 27C64 and 87C64 are offered in both a ceramic DIP, Plastic DIP, and Plastic Leaded Chip Carrier (PLCC)
Packages. Cerdip packages provide flexibility in prototyping and R&D environments; whereas Plastic DIP and
PLCC EPROMs provide optimum cost effectiveness in production environments. A new Quick-Pulse Program-
mingTM Algorithm is employed which can speed up programming by as much as one hundred times.
The 87C64 incorporates an address latch on the address pins to minimize chip count in multiplexed bus
systems. Designers can eliminate an external address latch by tieing address and data pins of the 87C64
directy to the processor's multiplexed address/data pins. On the falling edge of the ALE input (ALE/CE),
address information at the address inputs (Ao-A12) of the 87C64 is latched internally. The address inputs are
then ignored as data information is passed on th~ same bus.
The highest degree of protection against latch·up is achieved through Intel's unique EPI processing. Preven-
tion of latch-up is provided for stresses up to 100 mAon address and data pins from -1V to Vcc + 1V.
'liMOS and CHMOS are patented processes of Intel Corporation.
DATA OUTPUTS
0 0-07
OUTPUT ENABLE
PROG LOGIC
OUTPUT BUffERS.
Y-GATING
65,536 BIT
CELL MATRIX
290000-1
Shaded 'Areas' i> .:::';,:;:::represent the 87C64 version
Figure 1. Block Diagram
October 1987
10-133 Order Number: 290000-007
27C64/87C64
27C64/87C64
P27C64/P87C64
27256 27128 2732A 2716 2716 2732A 27128 27256
Vpp Vpp Vee Vee Vee
A'2 A'2 PCM J5GlVl A'4
A7 A7 A7 A7 N.C. Vee Vee A,s A,s
A6
As
A6
As
A6
As
A6
As ..'. As
As
As
As
As
As
As
As
A4 A4
c.._
A4 A4 A" Vpp All All All
AS As AS Aa at' DE DENpp DE DE
A2 A2 A2 A2 A,. A,o A,o A,o A,o
A, A, A, A, ~ ~ ~ ~,
An An AD AD ~ 07 07 ~
00 00 00 00 06 Os Os 06
0, 0, 0, 0, Os Os Os Os
02 02 02 ~ 04 04 04 04
Gnd Gnd Gnd Gnd Os Os . Os Oa
290000-2
NOTE:
Intel "Universal Site" Compatible EPROM Pin Confi~urations are shown in the adjacent blocks to 27C64 Pins,
Shaded Areas 1u!!L~represenllhe 87C64 version
Figure 2. Pin Configuration
A6 0 AS
A' AI
U All
A~ 32 PIN PLCC Ne
A2
0.450" X 0.550"
(11.430 X 13.970)
(MILLIMETERS)
A,
TOP VIEW
AD
Ne
00
290000-11
Figure 3. PLCC(N) Lead Configuration
10-134
27C64/87C64
D.C. CHARACTERISTICS
Electrical Parameters of EXPRESS EPROM products are identical to standard EPROM parameters except for:
27C64
Symbol Parameter 87C64 Test Conditions
Min Max
ISB Vee Standby Current (mA) CMOS 0.1 CE = Vee,OE = VIL
TTL 1.0 CE = VIH, OE = VIL
lee1(1) Vee Active Current (mA) TIL 20,30 OE = CE = VIL
Vee Active Current at TIL 20,30 OE = CE = VIL
High Temperature Vpp = Vee, Tambient = 85°C
NOTE:
1. See notes 4 and 6 of Read Operation D.C. Characteristics.
30~s
H
AOruLJ
:'rLS
Vee A'2
290000-14
°00, Binary Sequence from Ao to A12
°2
290000-13
DE = +sv = 1 Kfl
R vee = +sv
vpp = +sv GND = OV CE = 33.3 KHz
PGM = +sv
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under ':Abso-
Operating Temperature _ lute Maximum Ratings" may cause permanent dam-
During Read ............. ~ .... O°C to + 70°C(2) age to the device. This is a stress rating only and
functional operation of the device at these or any
Temperature Under Bias ......... -lO°C to + 80·C
other conditions above those indicated in the opera-
Storage Temperature .......... - 65°C to + 150·C tional sections of this specification is not implied Ex-
Voltage on Any Pin with posure to absolute maximum rating conditions for
Respect to Ground .............. - 2~OV to 7V(1) extended periods may affect device reliability. -
Voltage on Pin Ag with
Respect to Ground ......... -2.0V to + 13.5V(1)
Vpp Supply Voltage with Respect to Ground
During Programming ......... - 2.0V to + 14V(1)
Vcc Supply Voltage with
Respect to Ground .......... - 2.0V to + 7.OV(1)
10-136
intJ 27C64/87C64
READ OPERATION
Symbol Characteristic Min Max Min Max Min Max Min Max
NOTES:
1. A.C. characteristics tested at VIH = 2.4V and VIL = 0.45V.
Timing measurements made at VOL = O.SV and VOH = 2.0V.
2. Guaranteed and sampled.
3. Model Number Prefixes: No prefix = Cerdip; P = Plastic DIP; N = PLCC.
V,H -------+-,.
_--ICEI31~
V,H -------+----""
~-----t.cc-------<·I
290000-5
NOTES:
1. Typical values are for T A = 25°C and nominal supply voltages.
2. This parameter is only sampled and is not 100% tested.
3. OE may be delayed up to tCE-toE after the falling edge of CE without impact on tCE.
10-137
27C64/87C64
ALE/CE
tACL
OUTPUTS
-tCOE--t+----IOE
OE----~ ......_ _ _ __J
290000-6
2.4
2.0>
0.8
____
TEST POINTS _ _
2.0
OUTPUT
~0.8;.... __
fil-'N9"
3.3Kn
0.45
DEVICE
UNDER ~DUT
290000-10 TEST
CL= 100 pF
A.C. Testing: Inputs are driven at 2.4V for a Logic "1 "and 0.45V
'for a Logic "a". Timing measurements are made at 2.0V for a .l
logic "I" and O.BV for a Logic "0".
290000-3
CL ;= 100 pF
CL Includes Jig Capacitance
10-138
27C64/87C64
DEVICE OPERATION
The modes of operation of the 27C64/87C64 are
listed in Table 1. A single SV power supply is re-
quired in the read mode. All inputs are TIL levels
except for VPP and 12V on A9 for inteligent Identifier
mode.
NOTES:
1. X can be VIL or VIH.
2. VH = 12.0V ± O.5V.
3. A1-Aa, A10-12 = VIL.
4. See Table 2 for Vcc and Vpp voltages.
5. ALE ICE has to be toggled in order to latch in the addresses and read the signature codes.
6. The Manufacturer's identifier reads 89H for Cerdip devices; 88H for Plastic DIP and PLCC devices. _
7. In Read Mode tie PGM and Vpp to Vee.
10-139
inter 27C64/87C6:4
Two Line Output Control Initially, and after each erasure, all bits of the
EPROM are in the "1" state. Data is introduced by
Because EPROMs are usually used in larger memo- selectively programming "Os" into the desired bit lo-
ry arrays, Intel has provided 2 control lines which cations. Although. only "Os" will be programmed;
accommodate this multiple memory connection. The both "1 s" and "Os" can be present in the data word.
two control lines allow for: The only way to change a "0" to a "1" is by ultravio-
a) the lowest possible memory power dissipation, let light erasure.
and
The device is in the programming mode when Vpp is
b) complete assurance that output. bus .contention raised to its programming voltage (See Table 2) and
will not occur. CE (or ALE/CE) and PGM are both at TTL low and
OE = VIH. The data to be programmed is applied 8
To use these two control lines most efficiently, CE , bits in parallel' to the data output pins. The levels
(or 'ALE/CE) should be decoded and used' as the required for the address and data inputs are TTL:
primary device selecting function, while OE should
be made a common connection to all devices in the
array and connected to the READ line from the sys- Program Inhibit
tem control bus. This assures that all deselected
memory devices are in their low power standby Programming of multiple EPROMSin parallel with
mode and that the output pins are active only when different data is easily accomplished by using ·the
data is desired from a particular memory device. Program Inhibit mode. A high-level CE (or ALE/CE)
or PGM input inhibits the other devices from being
programmed.
10-140
inter 27C64/87C64
Except for CE (or ALE/CE), all like inputs (including ERASURE CHARACTERISTICS (FOR
OE) of the parallel EPROMs may be common. A TTL
CERDIP EPROMS)
low-level pulse applied to the £9lM input with Vpp at
its programming voltage and CE (or ALE/CE) = VIL The erasure characteristics are such that erasure
will program the selected device. begins to occur upon exposure to light with wave-
lengths shorter than approximately 4000 Angstroms
(A). It should be noted that sunlight and certain
Program Verify types of fluprescent lamps have wavelengths in the
3000-4000A range. Data shows that constant expo-
A verify (read) should be performed on the pro- sure to room level fluorescent lighting could erase
grammed bits to determine that they have been cor- the EPROM in approximately 3 years, while it would
rectly programme!LThe verify is performed with OE take approximately 1 week to cause erasure when
and CE (or ALE/CE) at VIL, PGM at VIH, and Vee exposed to direct sunlight. If the device is to be ex-
and Vpp at their programming voltages. Data should posed to these types of lighting conditions for ex-
be verified a minimum of tOE after the falling edge of tended periods of time, opaque labels should be
OE. placed over the window to prevent unintentional era-
sure.
inteligent Identifier™ Mode The recommended erasure procedure is exposure
to shortwave ultraviolet light which has a wavelength
The inteligent Identifier Mode allows the. r~adin~ ~ut of 2537 Angstroms (A). The integrated dose (Le., UV
of a binary code from an EPROM that will Identify Its
intensity x exposure time) for erasure should be a
manufacturer and type. This mode is intended for minimum of 15 Wsec/cm 2. The erasure time with
use by programming equipment for the purpose of .this dosage is approximately 15 to 20 minutes using
automatically matching the device to be pro-
an ultraviolet lamp with a 12000 )J-W/cm2 power rat-
grammed with its corresponding programming algo-
ing. The EPROM should be placed withi~ 1 in~h of
rithm. This mode is functional in the 25°C ± 5°C am-
the lamp tubes during erasure. The maximum inte-
bient temperature range that is required when pro-
grated dose an EPROM can be exposed to without
gramming the device. damage is 7258 Wsec/cm 2 (1 week @ 12000 )J-W/
cm 2). Exposure of the device to high intensity UV
To activate this mode, the programming equipment light for longer periods may cause permanent dam-
must force 11.5V to 12.5V on address line A9 of the
age.
EPROM. Two identifier bytes may then be se-
quenced from the device outputs by toggling ad-
dress line AO from VIL to VIH. All other address lines
must be held at VIL during the inteligent Identifier
CHMOS NOISE CHARACTERISTICS
Mode. Special EPI processing techniques have enabled In-
tel to build CHMOS with features adding to system
Byte 0 (AO = VIL) represents the manufacturer code reliability. These include input/output protection to
and byte 1 (AO = VIH) the device identifier code. latch-up. Each of the data and address pins will not
These two identifier bytes are given in Table 1. latch-up with currents up to 100 mA and voltages
ALE/CE of the 87C64 has to be toggled in order to from -1V to Vee + 1V.
latch in the addresses and read the Signature
Codes. Additionally, the Vpp (programming) pin is designed
to resist latch-up to the 14V maximum device limit.
10-141
27C64/87C64
290000-12
Quick-Pulse Programming™ Algorithm fication to determine when the address byte has
been successfully programmed. Up to 25 100 /Jos
Intel's 27C64 and 87C64 EPROMs can now be pro- pulses per byte are provided before a failure is rec-
grammed using the Quick-Pulse Programming Algo- ognized. A flowchart of the Quick-Pulse Program-
rithm, developed by Intel to substantially reduce the ming Algorithm is shown in Figure 5.
throughput time in the production environment. This
algorithm allows these devices to be programmed in For the Quick Pulse Programming Algorithm, the en-
under one second, almost a hundred fold improve- tire sequence of programming pulses and byte verifi-
ment over previous algorithms. Actual programming cations is performed at Vee = 6.25V and Vpp at
time is a function of the PROM programmer being 12.75V. When programming of the EPROM has
used. been completed, all bytes should be compared to
the original data with Vee = Vpp = 5.0V.
The Quick-Pulse Programming Algorithm uses initial
pulses of 100 microseconds followed by a byte veri-
10-142
inter 27C64/87C64
N'OTES: .
A_C_ CONDITIONS OF TEST
1. Vee must be applied simultaneously or before Vpp and
Input Rise and Fall Times (10% to 90%) ...... 20 ns removed Simultaneously or after Vpp.
Input Pulse Levels ...•.............. 0.45V to 2.4V 2. This parameter is only sampled and is not 100% tested.
Output Float is defined as the point where data is no long-
Input Timing Reference Level ....... 0.8V and 2.0V er driven-see timing diagram.
Output Timing Reference Level ...... 0.8V and 3.5V ' 3. The maximum current value is with outputs 00 to 07 Un-
loaded.
10-143
intJ 27C64/87C64
.PRDGRAM VERIFY
'~ -
ADDRESSES
_IA' __
ADDRESS STABLE
L
~
_'AH
12.75V
~ID' __ f+'DH.,
It'
- ~
'OF,!»
.-.-/ _'VP'__
Vpp
5.0V
8.25V
,
Vee ,
5.0V -.-/ _'ve,_
V,H
-
CE
V"
\
_'e,,_
V'H
PGM
-
V"
I,.
l- i-- 'OES1
-
'OE(2)
- I-- -
V'H
DE
V"
topw
, \
290000-9
NOTES: "
1. The Input Timing Reference Level is 0.8V for VIL and 2V for a VIH.
2. toE and tOFP are characteristics of the device but must be accommodated by the programmer.
3. When programming the 27C64, a 0.1 ,.F capacitor is required across Vpp and ground to suppress spurious voltage
transients which can damage the device.
10-144
intJ 27C64/87C64
Lilnits
Symbol ..Parameter Unit Conditions
Min Typ Max
tvps Vpp Setup Time 2 p.s
tves Vee Setup Time 2 p's
tLL Chip Deselect Width 2 p.s
tAL Address to Chip Select Setup 1 p.s
tLA Address Hold from Chip Select 1 p.s
tpw PGM Pulse Width 95 100 105 p.s Quick-Pulse
tos Data Setup Time 2 p.s
tOFP OE High to Data Float 0 130 ns
tOES Output Enable Setup Time 2 p.s
tOE Data Valid from Output Enable 150 ns
tOH Data Hold Time 2 tJ. s
teEs CE Setup Time 2 p.s
NOTE:
1. Programming tolerances and test conditions are the same as 27C64.
tLL-
(1)
Vpp
~ t vps
- - tves tCES-
(1)
Vee ~
~
tpw"
-;~;w
\-..J
290000-8
NOTE:
1. 12.75V Vpp & 6.25V Vee for Quick-Pulse Programming Algorithm.
10-145
inter ·87C257
256K (32Kx 8) CHMOS UV ERASABLE PROM
• CHMOS/NMOS Microcontroiler and • Noise Immunity Features
Mlcroproce$sor Compatible - ± 10% Vee Tolerance
- 87C257-1ntegrated Address Latch - Maximum Latch·up Immunity
- Universal 28 Pin Memory Site, 2·line Through EPI Processing
Control .
• New Quick·Pulse Programming™
'., Low Power Consumption Algorithm
• High Performance Speeds - 4 Second Programming
- 170 ns Maximum Access Time • Available in 28·Pln Cerdip Package
(See Packaging Spec .• Order '" 231369)
Intel's 87C257 CHMOS EPROM is a 256K-bit 5V only memory organized as 32,768 8-bit words. It employs
advanced CHMOS*II-E circuitry for systems requiring low power, high speed performance, and noise immuni-
ty. The 87C257 is optimized for compatibility with multiplexed address/data bus microcontrollers such as
Intel's 16 MHz 80.51- and 80.96- families.
The 87C257 incorporates latches on all address inputs to minimize chip count, reduce cost, and simplify
design of multiplexed bus systems. The 87C257's internal address latch allows address and data pins to be
tied directly to the processor's multiplexed address/data pins. Address information (inputs Ao-A14) is latched
early in the memory-fetch cycle by the falling edge of the ALE input. Subsequent address information is
ignored while ALE remains low. The EPROM can then pass data (from pins 00-07) on the same bus during
the last part of the memory-fetch cycle.
The 87C257 is offered in a ceramic DIP package, providing flexibility in prototyping and R&D environments.
The 87C257 employs the Quick-Pulse Programming™ Algorithm for fast and reliable programming.
Intel's EPI processing achieves the highest degree of latch-up protection. Address and data pin latch-up
prevention is provided for stressesup to 10.0. mA from -1V to Vcc + 1V.
'HMOS and, CHMOS are patented processes of Intel Corporation.
DATA OUTPUTS
0 0-07
5E OUTPUT ENABLE
PROG LOGIC
OUTPUT BUffERS
CE
CHIP ENABLE
ALE ADDRESS LATCH ENABLE
Y DECODE Y-GATING
:>:
~
In X DECODE 262,144 BIT
Ao-A I4 In CELL MATRIX
ADDRESS '"'"
Q
INPUTS Q
..:
290135-1
Figure 1. Block Diagram
October 1987
10.-146 Order Number: 290135-002
87C257
Pin Names
Ao-A14 ADDRESSES
00-0 7 OUTPUTS
OE OUTPUT ENABLE
CE CHIP ENABLE
ALE/vpp Address Latch
Enable/Vpp
N.C. NO CONNECT
10~147
inter 87C257
. EXTENDED TEMPERATURE
(EXPRESS) EPROMs -
The Intel EXPRESS EPROM family receives addi-
tional processing to enhance product characteris-
tics. EXPRESS processing is available for several
EPROM densities allowing the appr-opriate memory
size to match system applications. EXPRESS
EPROMs are available with 168 ±8 hour, 125·C dy-
namic burn-in using Intel's standard bias configura-
tion. This process meets or exceeds most industry
burn-in specifications. The standard EXPRESS
EPROM operating temperature range is O·C to
+ 70·C. Extended operating temperature range Vee
07
(-40·C to +85·C) EXPRESS and automotive tem-
06
perature range (- 40·C to + 125·C) products are
also available. Like all Intel EPROMs, the EXPRESS 05
EPROM family is inspected to 0.1 % electrical AQL. °4
This allows reduction or elimination of incoming test-
ing.
°3
29013S-4
OE = SVR = 1 KflVcc= +SV
ALElVpp = + SV Vss = GND CE = GND
AUTOMOTIVE AND EXPRESS
OPTIONS
Versions
Speed Packaging Options
Versions Cerdlp
-200V05 A
-250V10 A
•
-250V05 A
29013S-S
Binary Sequence from AD 10 A14
PRODUCT DEFINITIONS
Operating Burn-in 125·C
Type
Temperature ("C) (hr)
Q O·Cto +70·C 168 ±8
T - 40·C to + 85·C NONE
L - 40·C to + 85·C 168 ±8
A - 40·C to + 125·C NONE
B - 40·C to + 125·C 168 ±8
10-148
infef 87C257
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Operating Temperature, During age to the device. This is a stress rating only and
Read .....••••••.••.•••....•. O'C to + 70'C(2)
functional operation of the device at these or any
Temperature Under Bias ..••... -1 O'C to + 80'C(2)
other conditions above those indicated in the opera-
Storage Temperature .......... - 65'C to + 150'C tional sections of this specification is not implied Ex-
Voltage on any Pin with posure to absolute maximum rating conditions for
Respectto Ground ........••••• - 2V to + 7V(1) ex/ended periods may affect device reliability.
Voltage on Ag with
Respect to Ground ....•..••. - 2V to + 13.5V(1) NOTICE Specifications contained within the
Vpp Supply Voltage with Respect to Ground following tables are subject to change.
During Programming •.•.•.•.. - 2V to + 14.0V(1)
Vcc Supply Voltage with .
Respectto Ground ....•......• -2V to +7.0V(1)
READ OPERATION
D.C. CHARACTERISTICS TTL and NMOS Inputs
Symbol Parameter Notes Min Typ(3) Max Units Test Condition
III Input Load Current 0.Q1 1.0 ".A VIN = OV to 5.5V
ILO Output Leakage Current ±10 ".A VOUT = OV to 5.5V
158 Vee Current Standby I' Switching 10 mA CE = ALE = VIH
with Inputs- I Stable 1.0 mA CE = VIH. ALE = VIL
leel Vee Current Active 5 30 mA CE = VIL. ALE = VIH
f = 5 MHz. lOUT = 0 mA
VIL Input Low Voltage ( ± 10% Supply) 1 -0.5 O.B V
VIH Input High Voltage (± 10% Supply) 2.0 Vee + 0.5 V
VOL Output Low Voltage 0.45 V 10L = 2.1 mA
VOH Output High Voltage 2.4 V 10H = -400".A
los Output Short Circuit Current 6 100 mA
NOTES:
1. Minimum D.C. input voltage is -0.5V. During transitions. the inputs may undershoot to -2.0V for periods less than 20 ns.
Maximum D.C. voltage on output pins is Vee + 0.5V which may overshoot to Vee + 2V for periods less than 20 ns.
2. Operating temperature is for commercial product defined by this specification. Extended temperature options are available
in EXPRESS and Automotive versions.
3. Typical limits are at Vee = 5V. TA = + 25'C.
4. CE is Vee ±0.2V. All other inputs can have any value within spec.
5. Maximum current value is with outputs 00 to 07 unloaded.
6. Output shorted for no more than one second. No more than one output shorted at a time. los is sampled but not 100%
tested.
10-149
87C257
READ OPERATION
V1H
ALE
V1L
VIH _ _ _ _~~--+_
CE
V1L
(2)
V ____
IH
+ _________ _
t LOE --~-tOE
Of
V1L
~~~---~cc------~
OUTPUT VIH _ _ _ _ _ _ _ _ _ _ _ _ _ _ _..!i!:~L._t:§~~~~§:~~
HIGH Z
V1L
290135-6
NOTES:
1. This parameter is only sampled and is not 100% tested.
2. DE may be delayed up to IcE:"tOE after the falling edge of CE without impact on tCE'
10-150
inter 87C257
NOTE:
1. Sampled. Not 100% tested.
1.:~
~~IN914
1.5 -lEST POINlS :::::: IH OUTPUT
V1L -
3.3k.D.
DEVICE
UNDER OUT
290135-7
TEST
:e-- CL
A.C. testing inputs are driven at VOH for a Logic "I" 290135-S
and VOL for a Logic "a". Timing measurements are CL = 100 pF
made-at VIH for a Logic "1" and VIL for a Logic "a". CL Includes Jig Capacitance
DEVICE OPERATION
Table 1 lists 87C257 operating modes. Read mode requires a single 5V power supply. All input. levels are TTL
or CMOS except A9 in inteligent Identifier mode and Vpp.
Table 1. Mode Selection
Pins ALE/
CE OE As Ao Vee Outputs
Vpp
Mode
Read VIL VIL X(1) X X 5.0V DOUT
Output Disable - VIL VIH X X X 5.0V HighZ
Standby VIH X X X X 5.0V HighZ
Programming VIL VIH X X (Note 4) (Note 4) DIN
Program Verify VIH VIL X X (Note 4) (Note 4) DOUT
Optional Program VIL VIL X X Vee (Note 4) DCUT
Verify (Note 4)
Program Inhibit VIH VIH X X (Note 4) (Note 4) HighZ
inteligent Identifier(3) VIL VIL VH(2) VIL X Vec 89H
-Manufacturer
inteligent Identifier(3) VIL VIL VH(2) VIH X VCC 24H
-87C257
NOTES:
1. X can be VIL or VIH.
2. VH = 12.0V ±0.5V.
3. AI-As. AlO-12 = VIL. A13-14 = X.
4. See Table 2 for Vee and Vpp programming voltages.
10-151
inter 87C257
290135-9
PROGRAMMING MODES'
Figure 4. 80C31 with 87C257
Caution: Exceeding 14Von Vpp will permanently
System Configuration
damage the devIce.
10-152
intJ 87C257
can contain both "1s" and "Os". Ultraviolet light era- inteligent Identifier™ Mode
sure is the only way to change "Os" to "1s".
The inteligent Identifier Mode will determine an
The programming mode is entered when Vpp is EPROM's manufacturer and device type. Program-
raised to its programming voltage (see Table 2). ming equipment can automatically match a device
Data is programmed by applyil]Lan 8-bit word to the with its proper programming algorithm.
output pins (00-7). Pulsing CE to TTL-low while
OE = VIH will program data. TTL levels are required This mode is activated when programming equip-
for address and data inputs. ment forces 12V ±0.5V on the EPROM's Ag ad-
dress line. With A1-Aa, A1O-A12 = VIL (A13-14 are
don't care), address line Ao = VIL will present the
Program Inhibit manufacturer's code and Ao = VIH'the device code
(see Table 1). When Ag = VH, ALE need not be
The Program Inhibit mode allows parallel program- toggled to latch each identifier address. This mode
ming of multiple EPROMs with different data. With functions in the 25°C ± 5°C ambient temperature
Vpp at its programming voltage, a CE-Iow pulse pro- range required during programming.
grams the desired EPROM. CE-high inputs inhibit
programming of non-targeted devices. Except for CE
and OE, parallel EPROMs may have common in- ERASURE CHARACTERISTICS (FOR
puts.
CERDIP EPROMS)
Exposure to light of wavelength shorter than 4000
Program Verify Angstroms (A) begins EPROM erasure. Sunlight and
some fluorescent lamps have wavelengths in the
With Vpp and Vee at their programming voltages, a 3000.,...4000A range. Constant exposure to room-Iev-'
verify (read) determines that bits are correctly pro- el fluorescent light can erase an EPROM in about 3
grammed. The verify is performed with CE = ~ years (about 1 week for direct sunlight). Opaque la-
and OE = VIL. Valid data is available tOE after OE bels over the window will prevent unintentional era-
falls low. sure under these lighting conditions.
10-153
inter 87C257
290135'-10
CHMOS NOISE CHARACTERISTICS tion to determine when the addressed byte is cor-
rectly programmed. The algorithm terminates if 25
System reliability is enhanced by Intel's CHMOS 100/kS pulses fail to program a byte. Figure 5 shows
EPI-process techniques. Protection on each data the Quick-Pulse Programming algorithm flowchart.
and address pin prevents latch-up; even with 100
mA currents and voltages from -1V to Vee + 1V. The entire program-pulse/byte-verify sequence is
Additionally, the Vpp pin is designed to resist latch- performed with Vee = 6.25V and Vpp = 12.75V.
up to the 14V maximum device limit. . When programming is complete, all bytes should be
compared to the original data with Vee = 5.0V.
Quick-Pulse Programmlng™ Algorithm
Alternate Programming
The Quick-Pulse Programming algorithm programs
Intel's 87C257 EPROM. Developed to substantially Intel's 27C256 and 27256 Quick-Pulse Programming
reduce production programming throughput time, algorithms will also program the 87C257. By overrid-
this algorithm can program a 87C257 in under four . ing a check for the inteligent Identifier, older or non-
seconds. Actual programming time depends on the upgraded PROM programmers can program the
PROM programmer used. . 87C257. See Intel's 27C256 and 27256 data sheets
for programming waveforms of these alternate algo-
The Quick-Pulse Programming algorithm uses a 100 rithms.
microsecond initial-pulse followed by a byte verifica-
10-154
intJ 87C257
limits
Symbol Parameter Test Conditions
Min Max Unit
III Input Current (All Inputs) 1.0 ).tA VIN = VIL or VIH
VIL Input Low Level (All Inputs) -0.2 0.8 V
VIH Input High Level 2.0 Vee + 0.5 V
VOL Output Low Voltage During Verify 0.4 V IOL = 2.1 rnA
VOH Output High Voltage During Verify Vee - 0.8 V IOH = -400).tA
lee2(3) Vee Supply Current 30 rnA
IpP2(3) Vpp Supply Current (Program) 50 rnA CE = VIL
VIO Ag inteligent Identifier Voltage 11.5 12.5 V
Vpp(1) Programming Voltage 12.5 13.0 V
Ved 1) Supply Voltage During Programming 6.0 6.5 V
Limits
Symbol Parameter Conditions
Min Typ Max Unit
tAS Address Setup Time 2 ).ts
NOTES:
1. Vee must be applied simultaneously or before Vpp and removed simultaneously or after Vpp.
2. This parameter is only sampled and is not 100% tested. Output Float is defined as the point where data is no longer
driven-see timing diagram.
3. The maximum current value is with outputs 00 to 07 unloaded.
10-155
'V
12.0 V . - - - - -
I
1 1"ta lig ent Identifier. • 1"ta ng ent identifier
Manufacturer
Ag
I
=12.0V
Dey;ce
I " Blank Check
Illegal Bit Check I
I' Pro rom
g
I
I • Program
Verify
I
I • Re~d
Verify
I I
JJ
oC)
JJ
l>
s:
l
Address~::==>f AO=VIL '""'Z:AI-8'Al0-12=VIL~ ADDRESSVALID )~ ADDRESS STABLE I .n; "uun~JJ ,"",u ~ s:
Z
VIH Q
~
Data
VIL '
<
m
ALE;::el~ : ~ ~ - - - - - - - - - -1-- ~ ~ --~ -----t i
."
oJJ
s:
en
65~~~ . --; - ---- --- T -----~ -----
Vee
~ ..,.
01)
~ VIH o
N
(J1
en cr ..,.CI1
VIL
VIH ~
OE
VIL
290135-11
NOTES:
1. The input timing reference level is VIL = 0.8V and VIH = 2V.
2. toE and tOFP are device characteristics but must be accommodated by the programmer.
3. To prevent device damage durir]g programming, a 0.1 ,..F capacitor is required between Vpp and ground to suppress spurious voltage transients. , ~
4. During programming, the address latch function is bypassed whenever Vpp = 12.75V or A9 = VH. When Vpp and A9 are at TTL levels, the address'latch function is aID
enabled, and the device functions in read mode. ' ' ' Iffiil
5. Vpp can be 12.75V during Blank Check and Final Verify; if so, CE must be VIH. F
~
~
~
~
C:g
UPI-4S2
CHMOS PROGRAMMABLE 1/0 PROCESSOR
• 83C452/87C452P/80C452:3.5 to 16 MHz
• Two 16-Bit Timer/Counters
•
Clock Rate
Software Compatible with the MCS-51 • Boolean Processor
Family • 8BitInterrupt
Addressable RAM
•
(See Packaging Spec" Order: #231369)
40 Programmable I/O Lines
,The Intel UPI-452 (Universal Peripheral Interface) is a 68 pin CHMOS Slave 1/0 Processor with a sophisticated
bi-directional FIFO buffer interface on the slave bus and a two channel DMA processor on-chip, The UPI-452
is the newest member of Intel's UPI family of products, It is a general-purpose slave 1/0 Processor that allows
the deSigner to grow a customized interface solution.
The UPI-452 contains 'a complete 80C51 with twice the on-chip data and program memory. The sophisticated
slave FIFO module acts as a buffer between the UPI-452 internal CPU and the external host CPU. To both the
external host and the internal CPU, the FIFO module looks like a bi-directional bottomless buffer that can both
read and write data. The FIFO manages the transfer of data independent of the UPI-4S2 core CPU and
generates an interrupt or DMA request to either CPU, host or internal, as a FIFO service request.
The FIFO consists of two channels:the Input FIFO and the Output FIFO. The division of the FIFO module
array, 128 bytes, between Input channel and Output channel is programmable by the user. Each FIFO byte
has an additional logical ninth bit to distinguish between a data byte and a Data Stream Command byte.
Additionally, Immediate Commands allow direct, interrupt driven, bi-directional communication between the
UPI-452 internal CPU and external host CPU, bypassing the FIFO.
The on-chip DMA processor allows high speed data transfers from one writeable memory space to another.
As many as 64K bytes can be transferred in a, single DMA operation. Three distinct memory spaces may be
used in DMA operations; Internal Data Memory, External Data Memory, and the Special Function Registers
(including the FIFO IN, FIFO OUT, and Serial Channel Special Functions Registers).
September 1987
10-157 Order Number: 231428-003
C
o
o'"
,Q00
c'"
_z
~":::"
l
!II
o "'z
01 ~I'"
I
o~I ~
:::a 00 it
~ ~I ..... 0
!1; AO~Z
- - - - - - - - - -l} - -
NfAf'TIC
r-
illi - - - - - -I ~I~ ,
"II
iiii
...
r:::
ID
I o
...
Z
o»o::::!;;Itn
~z!:"''i:
~c~~~
'"
~
~ -fl- ---------ft --- i:~
" FIFO FIFO " FIFO HOST-
~
IMMEDIATE I HOST DMA
:-" INPUT MODULE OUTPUT FIFO COMMAND AND
...n
:I>
41>-
CHANNEL SLAVE- CHANNEL INTERFACE INTERRUPT
REQUEST
.....
~
U1
:::T
;::;:
ID
2-
r:::
~m
INTERFACE
srn~
HCON
HSTAT
., '."
Iroo; I II ~
CX> et ...:',
: ;
,,~
PI)
m : i
0'
:J.r.::. __ .JL_-,
#" .... • I
n
~
~
• I I •
C
iii"
~
TI
ea
ii1 l§!
3
~
DMA TIMING
~
AND CONTROL
~
DCON1
SAR1
~
'iiiI
DAR 0
BCRO
DAR 1
BCR 1
©
22J
",L
~
~
@
- ~@ - --
oJ ~
~
~ ~
co 1,/
.!.. @
~
inter UPI·452
~-----------------~------,
i>sEN
ALE
EA
RST
231428-2
10-159
UPI-4S2
TABLE OF CONTENTS
Introduction
Table of Contents
List of Tables and Figures
Pin Description
Architectural Overview
Introduction
FIFO Buffer Interface
FIFO Programmable Features
Immediate Commands
DMA
FIFO/Slave Interface Functional Description
Overview
Input FIFO Channel
Output FIFO Channel
Immediate Commands
Host & Slave Interface Special Function Registers
Slave Interface Special Function Registers
External Host Interface Special FunctionRegisters
FIFO Module-External Host Interface .
Overview
Slave Interface Address Decodin£ .
Interrupts to the Host
DMA Requests to the Host
FIFO Module-Internal CPU Interface
Overview
Internal CPU Access to FIFO via Software Instructions
General Purpose DMA Channels
Overview
Architecture
DMA Special Function Registers
DMA Transfer Modes
External Memory DMA
Latency
DMA Interrupt Vectors
Interrupts When DMA is Active
DMA Arbitration
Interrupts
Overview
FIFO Module Interrupts to Internal CPU
Interrupt Enabling and Priority
FIFO-External Host Interface FIFO DMA Freeze Mode
Overview.
Initialization
Invoking FIFO DMA Freeze Mode During Normal Operation
. FIFO Module Special Function Register Operation During FIFO DMA Freeze Mode
Internal CPU Read & Write of the FIFO During FIFO DMA Freeze Mode
Memory Organization
Accessing External Memory
Miscellaneous Special Function Register Descriptions
10-160 .
intJ UPI-452
Figures:
1. Architectural Block Diagram
2. UPI-452 68-Pin PGA Pinout Diagram
3. UPI-452 Conceptual Block Diagram
4. UPI-452 Functional Block Diagram
5. Input FIFO Channel Functional Block Diagram
6. Output FIFO Channel Functional Block Diagram
7a. Handshake Mechanisms for Handling Immediate Command IN Flowchart
7b. Handshake Mechanisms for Handling Immediate Command OUT Flowchart
8. DMA Transfer from: External to External Memory
9. DMA Transfer from: External to Internal Memory
10. DMA Transfer from: Internal to External Memory
11. DMA Transfer Waveform: Internal to Internal Memory
12. Disabling FIFO to Host Slave Interface Timing Diagram
Tables:
1. Input FIFO Channel Registers
2. Output FIFO Channel Registers
3. UPI-452 Address Decoding
4. DMA Accessible Special Function Registers
5. DMA Mode Control - PCON SFR
6. Interrupt Priority
7. Interrupt Vector Addresses
8. Slave Bus Interface Status During FIFO DMA Freeze Mode
9. FIFO SFR's Characteristics During FIFO DMA Freeze Mode
10. Threshold SFRs Range of Values and Number of Bytes to be Transferred
11 a. 80C51 Special Function Registers
11 b. UPI-452 Additional Special Function Registers
12. Program Status Word (PSW)
13. PCON Special Function R~gister
10-161
inter UPI-452
~
t '"
... ~'"....
.
..: .. ~ °...
0..
N
0.. ~
"!
OJ
0..
"!
OJ
0..
III
'" .<
.... ....'"
0..
...
0..
C!
OJ
0..
::l
0..
"1
OJ
0..
.,
N
0..
...N
~
0..
'0
Q)
@@ @ @ @ @ @ @@
~ P4.S P4.6 @) @@ @ @ @ @ @ @@ @ Pmi EA
1:
Q)
c P4.7 XTAL1
® @ @ @ PO.7 PO.6
°c,E
8 . XTAL2 AO @ @ @ @ PO.S PO.4·
Q)
DRQIN/
INTRQOUT ® ® P1.1 Pl.2
>'E INTRQIN
INTRQ @) @ 0 0 Pl.3 Pl.4
'E~
... .0
DB7 DBS €D @@ @ @ @ @ @ @ ® <D Pl.S Pl.6
.!!ti
.n. @<§ @ @ @ @ @ @ @
.'" ...
IJm
(~= .,m
CI
'"mCI ;;;
CI
": ..; ~
0.. .. .
~ ~ '''1
0:
.. m
CI
...m
CI
....m
CI
0
m
CI ~ ::l .. ..'" "1 ..;
0..
":
0:'
PIN NO.1
MARK
..
m
CI
...
m
CI
....
m
CI
0
m
CI
u
,;'
"1
'" '"
0.. ..
"1 ..;
0..
":
0:
.,m
'"
m ;;;
....
..;
....
..; "!
..'" ..'"
"'! C! "1
PIN NO.1
MARK
CI CI CI 0..
'"
0.. 0:
'0 @(8l @ @ @ @ @ @ @ '\(
Q)
~
Q)
'C
c
DB7 DBS €D @@ @ @ @ @ @ @ ® <D Pl.S Pl.6
"
Q)
DRQIN/
INTRQIN
INTRQ @) @ 00 0 Pl.3 Pl.4
. =-
E . DRQOUTj
e'E
_01
WiiiTE
INTRQOUT
@ @ ® ® Pl.l Pl.2
1~
0>"
Al A2 @ @ @ @ PO.3 PO.2
.. ~u
... .. ...
..
'" ~'"'"
... ~
0.. 0..
N N
0..
N
0..
III
>
u ....
<
231428-18
10-162
inter UPI-452
10-163
inter UPI-452
10-164
intJ UPI·452
10-165
intJ UPI·452
231428-7
10-166
UPI·452
231428-8
The division of the 128 bytes between Input and nel Boundary Pointer (CBP) SFR. This register con-
Output channels is user programmable allowing tains the number of address locations assigned to
maximum flexibility. If the entire 128 byte FIFO is the Input channel. The remaining address locations
allocated to the Input channel, a high performance are automatically assigned to the Output FIFO. The
Host can transfer up to 128 bytes at one time, then CBP SFR can only be programmed by the internal
dedicate its resources to other functions while the CPU during FIFO DMA Freeze Mode (See FIFO-Ex-
internal CPU processes the data in the FIFO. Vari- ternal. Host Interface FIFO DMA Freeze Mode de-
ous handshake signals allow the external Host to scription). The CBP is initialized to 40H (64 bytes)
operate independently and without frequent monitor- upon reset.
ing of the UPI-452 internal CPU. The FIFO Buffer
insures that the slave processor receives data in the The number in the Channel Boundary Pointer SFR is
same order that it was sent by the host without the actually the first address location of the Output
need to keep track of addresses. Three slave bus FIFO. Writing to the CBP SFR reassigns the Input
interface handshake methods are supported by the and Output FIFO address space. Whenever the CBP
UPI-452: DMA, Interrupt and Polled. is written, the Input FIFO pointers are reset to zero
and the Output FIFO pointers are set to the value in
The FIFO is nine bits wide. The ninth bit acts as a the CBP SFR.
command/data flag. Commands written to the FIFO
All of the FIFO space may be assigned to one chan-
by either the host or internal CPU are called Data
nel. In such a situation the other channel's data path
Stream Commands or DSCs. DSCs are written to
consists of a single SFR (FIFO IN/COMMAND IN or
t~e input FIFO by the Host via a unique external
FIFO OUT/COMMAND OUT SFR) location. .
address. DSCs are written to the output FIFO by the
internal CPU via the COMMAND OUT Special Func- CBP InputF.IFO Output FIFO
tion Register (SFR). When encountered by the host Register Size Size
or internal CPU a Data Stream Command can be 0 1 128
used as an address vector to user defined service 1 1 128
routines, DSCs provide synchronization of data and 2 2 126
commands between the Host and internal CPU. 3 3 125
4 4 124
FIFO PROGRAMMABLE FEATURES •
7B 123
• •
5
7C 124 4
Size of Input/Output Channels 7D 125 3
7E 128 1
The 128 bytes of FIFO space can be allocated be- 7F 128 1
tween the Input and Output channels via the Chan-
10-167
UPI-452
FIFO/SLAVE INTERFACE
Immediate Commands FUNCTIONAL DESCRIPTION
The UPI-452 provides, in addition to data and DSCs,
a third direct means of communication between the Overview
external Host and internal CPU called Immediate
C-ommends. As the name implies, an !mmediate. The FIFO is a 128 Bvte RAM arrav with recirculatina
Command is available to the receiving'CPU immedi- pointers to manage- the read and write accesseS.
ately, via an interrupt, without being entered into the The FIFO consists of an Input and an Output chan-
FIFO as are Data Stream Commands. Like Data nel. Access cycles to the FIFO by the internal CPU
Stream Commands, Immediate Commands are writ- and external Host are interleaved and appear to be
ten either via a unique external address by the host occurring concurrently to both the internal CPU and
CPU, or via dedicated SFR by the internal CPU. external Host. Interleaving access cycles ensures
efficient use of this shared resource. The internal
The DSC and/or Immediate Command interface CPU accesses the FIFO in the same way it would
may be defined as either Interrupt or Polled under access any of the Special Function Registers e.g.,
user program control via the Interrupt Enable (IE), direct and register indirect addressing as well as ar-
Slave Control Register (SLCON), and, Interrupt En- ithmetric and logical instructions.
able Priority (IEP) Special Function Registers, for the
internal CPU and via the Host Control SFR for the.
external Host CPU. Input FIFO Channel
The. Input FIFO Channel provides for data transfer
DMA from the external Host to the internal CPU (Figure 5).
The registers associated with the Input Channel dur-
The UPI-452 contains a two channel internal DMA ing normal operation are listed in Table 1*.
controller which allows transfer of data between any
Table 1. Input FIFO Channel Registers'
Register Name Description
1) Input Buffer Latch Host CPU Write only
2) FIFO IN SFR Internal CPU Read only
3) COMMAND IN SFR Internal CPU Read only
4) Input FIFO Read Pointer SFR Internal CPU Read only
.5) Input FIFO Write Pointer SFR Internal CPU Read only
6) Input FIFO Threshold SFR Internal CPU Read only
.. ..
'See "'FIFO-EXTERNAL HOST INTERFACE FIFO DMA FREEZE MODE" section for FIFO DMA Freeze Mode SFR charactenstlcs deSCription .
10-168
inter UPI-4S2
EXTERNAL HOST
CPU
EXTERNAL
ADDRESS HOST DATA
BUS
INPUT WRITE
POINTER (IWPR)
!::
ID
THRESHOLD SFR INPUT FIFO
(ITHR) i!:
'"
z
INPUT READ
POINTER (IRPR)
231428-9
The host CPU writes data and Data Stream Com· The Inl'lut FIFO Channel addressing is controlled by
mands into the Input Buffer Latch on the rising edge the Input FIFO Read and Write Pointer SFRs. These
of the external WR signal. External addressing de· SFRs are read only registers during normal opera·
termines whether the byte is a data byte or Data tion. However, during FIFO DMA Freeze Mode (See
Stream Command and the FIFO logic sets the ninth FIFO·External Host Interface FIFO DMA Freeze
bit of the FIFO accordingly as the byte is moved Mode description),. the internal CPU has write ac-
from the Input Buffer Latch into the FIFO. A "1" in cess to them. Any write to these registers in normal
the ninth bit indicates that the incoming byte is a mode will have no effect. The Input Write Pointer
Data Stream Command. The internal CPU reads SFR contains the address location to which datal
data bytes via the FIFO IN SFR, and Data Stream commands are written from the Input Buffer Latch.
Commands via the COMMAND IN SFR. The write pointer is automatically incremented after
each write and is reset to zero if equal to the CBP,
A Data Stream Command will generate an interrupt as the- Input FIFO operates as a circular buffer.
to the internal CPU prior to being read and after
completion of the previous operation. The DSC can If a write is performed on an empty FIFO, the first
then be read via the COMMAND IN SFR. Data can byte is also written into the FIFO IN or COMMAND
only be read via the FIFO IN SFR and Data Stream IN SFR. If the Host continues writing while the Input
Commands via the COMMAND IN SFR. Attempting FIFO is full, an external interrupt, if enabled, is sent
to read Data Stream Commands as data by address· to the host to Signal the overrun condition. The
ing the FIFO IN SFR will result in '~OFFH" being writes are ignored by the FIFO control logic. Similar·
read, and -the Input FIFO Read Pointer will remain Iy, an internal CPU read of an empty FIFO will cause
intact. (This prevents accidental misreadin,9 of Data an underrun error interrupt to be generated to the
Stream Commands.) Attempting to read data as internal CPU and a value of "OFFH" will be read by
Data Stream Commands will have the same conse· the internal CPU.
quence.
10·169
UPI-452
The Read Pointer SFR holds the address of the next number of bytes assigned to the Input FIFO (CBP)
byte to be read from the Input FIFO. An Input FIFO minus the number of bytes programmed in the Input
read operation post-increments the Input Read FIFO Threshold SFR. With this feature the Host is
Pointer SFR and loads a new data byte into the assured that it can write at least a threshold number
FIFO IN SFR or a Data Stream Command into the of bytes to the Input FIFO channel without worrying
COMMAND IN SFR at the end of the read cycle. about an overrun condition. Once the Request for
Service is generated it remains active until the Input
An Input FIFO Request for Service (via DMA, Inter- FIFO becomes full.
rupt or a flag) is generated to the Host whenever
more data can be written into the Input FIFO. For
efficient utilization of the Host, a "threshold" value Output FIFO Channel
can be programmed into the Input FIFO Threshold
SFR. The range of values of the Input FIFO Thresh- The Output FIFO Channel provides data transfer
old SFR can be from 0 to (CBP-2). The Request for from the UPI-452 internal CPU to the external Host
Service Interrupt is generated only after the Input (Figure 6).
FIFO has room to accommodate a threshold number
of bytes or more. The threshold is equal to the total' The registers associated with the Output Channel
during normal operation are listed in Table 2*.
231428-10
10-170
inter UPI-4S2
The UPI-452 internal CPU transfers data to the Out- 2.) The second type of Request for Service is called
put FIFO via the FIFO OUT SFR and commands via "Flush Mode" and occurs when the internal CPU
the COMMAND OUT SFR. If the byte is written to writes a Data Stream Command into the Output
the COMMAND OUT SFR, the ninth bit is automati- FIFO. Its purpose is to ensure that a data block
cally set (= 1) to indicate a Data Stream Command. entered into the Output FIFO, which is less than
If the byte is written to the FIFO OUT SFR the ninth the programmed threshold, will generate a Re-
bit is cleared (=0). Thus the FIFO OUT and COM- quest for Service interrupt, if enabled, and be
MAND OUT SFRs are the same but the address de- read, or "Flushed" from the Output FIFO, by the
termines whether the byte entered in the FIFO is a external host CPU regardless of the status of the
DSC or data byte. OTHR SFR.
10-171
infef UPI-4S2
r----------------
SET SET
a
\:V
,
.oil
GENERATES INTERRUPT
....
GENERATES
TO INTE.RNAL CPU INTERRUrT TO HOST
, ,
,,
) )
• 4
SET SET
a
\:V
, ,
.oil .oil
GENERATES GENERATES INTERRUPT
INTERRUPT TO HOST TO INTE.RNAL CPU
,, ,,
-----------------~
... _-----
231428-12
231428-11
Figure 7a. Handshake Mechanisms for Handling Figure 7b. Handshake Mechanisms for Handling
Immediate Command IN Flowchart Immediate Command OUT Flowchart
10-172
inter UPI-4S2
Each register resides in the SFR Array and is accessible via all direct addressing modes except bit. Only the
Slave Control Register (SLCON) is bit addressable.
The MODE SFR can be directly modified by the internal CPU through direct address instructions. It can also be
indirectly modified by the external host CPU by setting up a MODE SFR service routine in the UPI-452 program
memory and having the host issue a Command, either Immediate or DSC, to vector to that routine.
Symbolic Physical
Address Address
MODE MD6 MD5 MD4 OF9H
(MSB) (LSB)
Status On Reset:
1" o o o 1* 1"
MD7 (reserved)"'
MD6 Request for Service to external CPU via;
1 = DMA (DRQIN/DRQOUT) request to external host when the Input or Output FIFO channel re-
quests service
o = Interrupt (INTRQIN/INTRQOUT or INTRQ) to external host when the Input or Output FIFO
channel requests service or a DSC is encountered in the I/O Buffer Latch
MD5 Configure DRQIN/INTRQIN and DRQOUT/INTRQOUT to be either;
1 = Enable (Actively driven)
o= Disable (Tri-state)
MD4 Configure INTRQ to be either;
1 = Enable (Actively driven)
o= Disable (Tri-state)
MD3 (reserved)' *
MD2 (reserved)"
MD1 (reserved)"
MDO (reserved)"
10-173
inter UPI-452
Symbolic Physical
Address Address
SLCON IFI OFI ICII I' ICOI FRZ IFRS ·OFRS OE8H
(MSB) (LSB)
Status On Reset:
o o o o o 1" o o
IFI Enable Input FIFO Interrupt (due to Underrun Error Condition, Data Stream Command or Request
Service)
1 = Enable
0= Disable
OFI Enable Output FIFO Interrupt (due to Overrun Error Condition or Request Service)
1 = Enable
0= Disable
Note: If the DMA ill configured to service a FIFO demand, then the Request for Service Interrupt is
not generated.
ICII Generate Interrupt when a command is written to the Immediate Command in Register
1 = Enable
0= Disable
ICOI Generate Interrupt when Immediate Command Out Register is Available
1 = Enable
0= Disable
FRZ Enable FIFO DMA Freeze Mode
1 = Normal operation
o = FIFO DMA Freeze Mode
SC2 (reserved) ••
IFRS Input FIFO Channel Request for Service
1, = Request when Input FIFO not empty
o = Request when Input FIFO full
OFRS Output FIFO Channel Request for Service
1 = Request when Output FIFO not full
o = Channel Request when Output FIFO empty
NOTES:
°A '1' will be read from all SFR reserved locations except HCON SFR,HCO and HC2.
"'reserved'-these locations are reserved for future use by Intel Corporation.
o o o
(MSB) (LSB)
10-174
inter UPI-452
It can also access other SFRs by commanding the internal CPU to change them accordingly via Data Stream
Commands or Immediate Commands. The protocol for implementing this is entirely determined by the user.
Symbolic Physical
Address Address
HCON HC7 HCS HC5 HC4 HC3 HC1 OE7H
(MSB) (LSB)
Status On Reset:
0 0 0 0 0 O' 0 O'
10-175
intJ UPI-452
HC7 Enabie Output FIFO Interrupt due to Underrun Error Condition, Data Stream Command or Service
Request
1 = Enable
0= Disable
HC6 Enable Input FIFO Interrupt due to Overrun Error Condition, or Service Request
1 = Enable
0= Disable
HCS Enable the generation of the Interrupt due to Immediate Command Out being present
1 = Enable
0= Disable
HC4 Enable the Interrupt due to the Immediate Command In Register being Available for a new Immediate
Command byte
1 = Enable
o = Disable
HC3 Reset UPI-4S2
1 = Software RESET
o = Normal Operation
HC2 (reserved)"
HC1 Select between INTRQ and INTRQINIINTRQOUT as Request for.5ervice interrupt signal when DMA is
disabled .
1 = INTRQ
o= INTRQIN or INTRQOUT
HCO (reserved)"
. NOTES:
'A '1' will be read from all SFR reserved locations except HCON SFR, HCO and HC2.
"'reserved'-these locations are reserved for future use by Intel Corporation.
Symbolic Physical
Address Address
HSTAT OE6H
- Output FIFO Status -+
Status On Reset:
1/0'
(MSB) (LSB)
10-176
infef UPI-4S2
HST7 Output FIFO Underrun Error Condition FIFO MODULE - EXTERNAL HOST
1 = No Underrun Error
INTERFACE
o = Underrun Error (latched until Host
Status Register is read)
Overview
HST6 Immediate Command Out SFR Status
1 = Empty The FIFO-external Host interface supports high
o = Immediate Command Present speed asynchronous bi-directional 8-bit data trans-
fers. The host interface is fully compatible with Intel
HST5 Data Stream Command/Data at Output microprocessor local busses and with MULTIBUS.
FIFO Status The FIFO has two specialized DMA request pins for
1 = Data (not DSC) Input and Output FIFO channel DMA requests.
o = DSC (present at Output FIFO COM- These are multiplexed to provide a dedicated Re-
MAND OUT SFR) quest for Service interrupt (DRQINIINTRQIN,
(Note: Only if HST4 = 0, if HST4 = 1 then un- DRQOUT /INTRQOUT).
determined)
The external Host can program, under user defined
HST4 Output FIFO Request for Service Status
1 = No Request for Service protocol, thresholds into the FIFO Input and Output
o = Output FIFO Request for Service due to: Threshold SFRs which determine when the FIFO
Request for Service interrupt is generated to the
a. Output FIFO containing the threshold Host CPU. The FIFO module external Host interface
number of bytes or more is configured by the internal CPU via the MODE
b. Internal CPU sending a block of data ter- SFR. "The external Host can enable and disable
minated by a DSC (DSC Flush Mode) Host interface interrupts via the Host Control SFR."
HST3 Input FIFO Overrun Error Condition Data Stream Commands in the Input FIFO channel
1 = No Overrun Error allow the Host to influence the processing of data
o = Overrun Error (latched until Host Status blocks and are sent with the data flow to maintain
Register is read) synchronization. Data Stream Commands in the
Output FIFO Channel allow the internal CPU to per-
HST2 Immediate Command In SFR Status form the same function, and also to set the Output
1 = Full (i.e. Internal CPU has not read pre- FIFO Request Service status logic to the host CPU
vious Immediate Command sent by Host) regardless of the programmed value in the Thresh-
o = Empty old SFR.
* Reset value;
'1' - if read by the external Host Slave Interface Address Decoding
'0' - if read by internal CPU (reads shadow The UPI-452 determines the desired Host function
latch - see FIFO DMA Freeze Mode descrip- through address decoding. The lower three bits of
tion) the address as well as the READ, WRITE, Chip Se-
lect (CS) and DMA Acknowledge (DACK) are used
HST1 FIFO DMA Freeze Mode Status
1 = Freeze Mode in progress. for decoding. Table 3 shows the pin states and the
(In Freeze Mode, the bits of the Host Status Read or Write operations associated with each con-
SFR are forced to a '1' initially to prevent the figuration.
external Host from attempting to access the
FIFO. The definition of the Host Status SFR Interrupts to the Host
bits during FIFO DMA Freeze Mode can be The UPI-452 interrupts the external Host via the
found in FIFO DMA Freeze Mode descrip- INTRQ pin. In addition, the DRQIN and DRQOUT
tion) pins can be multiplexed as interrupt request lines,
o = Normal Operation INTRQIN and INTRQOUT respectively, when DMA
HSTO Input FIFO Request Service Status is disabled. This provides two special FIFO "Re-
1 = Input FIFO does not request service quest for Service" interrupts.
o = Input FIFO request service due to the
Input FIFO containing enough space for the There are eight FIFO-related interrupt sources; two
host to write the threshold number of bytes from The Input FIFO; three from The Output FIFO;
or more one from the Immediate Command Out SFR; one
from the Immediate Command IN SFR; and one due
to FIFO DMA Freeze Mode.
NOTES:
1. Attempting to read a DSC as a data byte will result in invalid data being read. The read pointers are not incremented so
that the DSC is not lost. Attempting to read a data byte as a DSC has the same result.
2. If DACK is active the UPI-452 will attempt a DMA operation when RD or WR becomes active regardless of the DMA
enable bit (MD6) in the MODE SFR. Care should be taken when using DACK. For proper operation, DACK must be driven
high (+5V) when not using DMA.
b. When an Input FIFO overrun error condition ex- b. An Immediate Command IN interrupt is generat-
ists. The appropriate bits in the Host Status SFR ed, if enabled, to the Host when the internal CPU
are set and the interrupt is generated only if en- has read a byte from the Immediate Command IN
abled. (IMIN) SFR. The read operation clears the Host
Status SFR Immediate Command IN Status bit
OUTPUT FIFO: The Output FIFO Request for S'erv- (HSTAT HST2) indicating that the' Immediate
jt"'o Intorr'l""t ,,"t"\,...,+,...,.. in ... ,..i ...... il,.. ........ _""" ......... _ ... +UIG
........ I_
..... ..., I I . "...... U ....... ...,t'vl~U.Q~ III CI .:Jlllllial IllClr II 10' Qo:t 111-
Comrnand iN SFR is empty. The corresponding
put FIFO interrupt: Slave Status (SSTAT) SFR bit is also set to indi-
a. When the FIFO contains the threshold number of cate an empty status. Setting the Slave Status
bytes or more. SFR bit generates a FIFO-Slave Interface inter-
rupt, if enabled, to the internal CPU. (See Figure
b. Output FIFO error condition interrupts are gener-
7a, Immediate Command IN Flowchart.)
ated when the Output FIFO is underrun.
c. Data Stream Command present in the Output NOTE:
Buffer Latch. ' Immediate Command IN and OUT interrupts are ac-
tually specific Request For Service interrupts to the
A Data Stream Command interrupt is used to halt
Host.
normal processing, using the command as a vector
to a service routine. When DMA is disabled, the user
FIFO DMA FREEZE MODE: When the internal CPU
may program (through HC1) INTRa to include FIFO
invokes FIFO DMA Freeze Mode, for example at re-
Request for Service Interrupts or use INTRalN and
set or to reconfigure the FIFO interface, INTRa is
INTRaOUT as Request for Service Interrupts.' ,
activated. The INTRa can only be deactivated by
IMMEDIATE COMMAND INTERRUPTS: the external Host reading the Host Status SFR
(HST1 remains active until FIFO DMA Freeze Mode
a. An Immediate Command Out Interrupt is generat- is disabled by the internal CPU).
ed, if enabled, to the Host and the corresponding
Host Status SFR bit (HSTAT HST6) is cleared, Once an interrupt is generated, INTRa will remain
when the internal CPU writes to the Immediate high until no interrupt generating condition exists.
Command OUT (IMOUT) SFR. When the Host For a FIFO underrun/overrun error interrupt, the in-
reads the Immediate Command OUT (IMOUT) terrupt condition is deactivated by the external Host
SFR the corresponding" bit in the Host Status reading the Host Status SFR. An interrupt is serv-
(HSTAT) SFR is set. This causes the Slav,e Status iced by reading the Host Status SFR to determine
Immediate Command OUT Status bit (SSTAT the source of the interrupt and vectoring the appro-
SST6) to be cleared indicating that the Immediate priate service routine.
Command OUT (IMOUT) SFR is empty. If en-
abled, a FIFO-Slave Interface will also begener-
ated to the internal CPU. (See Figure 7b, Immedi-
ate Command OUT Flowchart.)
10-178
UPI-4S2
DMA Requests to the Host nation via the DMAO/DMA 1 Source Address or Des-
tination Address Special Function Registers. The
The UPI-452 generates two DMA requests, DRQIN FIFO module manages the transfer of data between
and DRQOUT, to facilitate data transfer between the the external host and FIFO SFRs.
Host and the Input and Output FIFO channels. A
DMA acknowledge, DACK, is used as a chip select
and initiates a data transfer. The external READ and Internal CPU Access to FIFO Via
WRITE signals select the Input and Output FIFO re- Software Instructions
spectively. The CS and address lines can also be
used as a DMA acknowledge for processors with The internal CPU has access to the Input and Out-
onboard DMA controllers which do not generate a put FIFOs via the FIFO IN/COMMAND IN and FIFO
DACK signal. OUT/COMMAND OUT SFRs which reside in the
Special Function Register Array. At the end of every
The internal CPU can configure the UPI-452 to re- instruction that involves a read of the FIFO IN/COM-
quest service from the external host via DMA or in- MAND IN SFR, the SFR is written over by a new
terrupts by programming Mode SFR MD6 bit. In ad- byte from the Input FIFO channel when available. At
dition the external Host enables DMA requests the end of every instruction that involves a write to
through bits 6 and 7 of the Host Control SFR. When the FIFO OUT/COMMAND OUT SFR, the new byte
a DMA request is invoked the number of bytes trans- is written into the Output FIFO channel and the write
ferred to the Input FIFO is the total number of bytes pointer is incremented after the write operation (post
in the Input FIFO (as determined by the CBP SFR) incremented).
minus the value programmed in the Input FIFO
Threshold SFR. The DMA request line is activated The internal CPU reads the Input FIFO by using the
only when the Input FIFO has a threshold number of FIFO IN/COMMAND IN SFR as the source register
bytes that can be transferred. in an instruction. Those instructions which read the
Input FIFO are listed below:
The Output FIFO DMA request is activated when a
DSC is written by the internal CPU at the end of a ADD A,FIFO IN/COMMAND IN
less than threshold size block of data (Flush Mode) AD DC A,FIFO IN/COMMAND IN
or when the Output FIFO threshold is reached. The PUSH FIFO IN/COMMAND IN
request remains active until the Input FIFO becomes
ANL A,FIFO IN/COMMAND IN
full or the Output FIFO becomes empty. If a DSC is
encountered during an Output FIFO DMA transfer, ORL A,FIFO IN/COMMAND IN
the DMA request is dropped until the DSC is read. XRL A,FIFO IN/COMMAND IN
The DMA request will be reactivated after the DSC is CJNE A,FIFO IN/COMMAND IN, rei
read and remains active until the Output FIFO be-
SUBB A,FIFO IN/COMMAND IN
comes empty or another DSC is encountered.
MOV direct,FIFO IN/COMMAND IN
MOV @Ri,FIFO IN/COMMAND IN
FIFO MODULE - INTERNAL CPU MOV Rn,FIFO IN/COMMAND IN
INTERFACE MOV A,FIFO IN/COMMAND IN
10-179
inter UPI-4S2
The FIFO IN, COMMAND IN and Immediate Com- dress Register (DAR). (Note: Since the FIFO IN SFR
mand In SFRs are read only registers. Any write op- is a read only register, the DMA transfer will be ig-
eration performed on these registers will be ignored nored if it is used asa DMA DAR. This is also true if
and the FIFO pOinters will remain intact. the FIFO OUT SFR is used as a DMA SAR.)
The internal CPU uses the FIFO OUT SFR to write Each DMA channel is software programmable to op-
to the Output FIFO and any instruction which uses erate in either Block Mode or Demand Mode. In the
the FIFO OUT or COMMAND OUT SFR as a desti- Block Mode, DMA transfers can be further .pro-
nation will invoke a FIFO write. DSCs are differenti- grammed to take place in Burst Mode or Alternate
ated from data by writing to the COMMAND OUT Cycle mode. In Burst Mode, the processor halts its
SFR. In the FIFO, Data Stream Commands have the execution and dedicates its resources to the DMA
ninth bit assoCiated with the command byte set to transfer. In Alternate Cycle Mode, DMA cycles and
"1". The instructions used to write to the Output instruction cycles occur alternately.
FIFO are listed below:
In Demand Mode, a DMA transfer occurs only when
MOV FIFO OUT /COMMOUt, A it is demanded. Demands can be accepted from an
MOV FIFO OUT/COMMOUT, direct external device (through External Interrupt pins,
. MOV FIFO OUT /COMMOUT, Rn EXTO/EXT1) or from either the Serial Channel or
POP FIFO OUT /COMMOUT FIFO flags. In this way, a DMA transfer can be syn-
chronized to an external device, the FIFO or the Se-
MOV FIFO OUT/COMMOUT, #data rial Port. If the External Interrupt is configured in
MOV FIFO OUT/COMMOUNT, @Ri Edge Mode, a single byte transfer occurs per tran-
sition. The external interrupt itself will occur if en-
NOTE: abled. If the External Interrupt is configured in Level
Instructions which use the FIFO OUT/COMMAND Mode, DMA transfers continue until the External In-
OUT SFRs as both a source and destination regis- terrupt request goes inactive or the byte count be-
ter cause invalid data to be written into the Output comes zero. The following flags activate Demand
'FIFO. These instructions are not supported by the Mode transfers of one byte to/from the FIFO or Seri-
UPI-4S2 FIFO. al Channel:
RI - Serial Channel Receiver Buffer Full
GENERAL PURPOSE DMA CHANNELS TI - Serial Channel Transm!tter Buffer Empty
Overview Architecture
There are two identical General Purpose DMA Chan- There are three 16 bit and one 8 bit Special Function
nels on the UPI-4S2 which allow high speed data Registers associated with each DMA channel.
transfer from one writeable memory space to anoth- • The 16 bit Source Address SFR (SAR) points to
er. As many as 64K bytes can be transferred in a the source byte.
single DMA operation. The following memory
spaces can be used with DMA channels: • The 16 bit Destination Address SFR (DAR) points
to the destination.
• Internal Data Memory
• The 16 bit Byte Count SFR (BCR) contains the
• External Data Memory number of bytes to be transferred and is decre-
• Special Function Registers mented when a byte transfer is accomplished.
• The DMA Control SFR (DCON) is eight bits wide
The Special Function Register array appears as a and specifies the source memory space, destina-
limited group of dedicated memory addresses. The tion memory space and the mode of operation.
Special Function Registers may be used in DMA
transfer operations by specifying the SFR as the In Auto Increment mode, the Source Address and/
sourCe or destination address. The Special Function or Destination Address is incremented when a byte
Registers which may be used in DMA transfers are is transferred. When a DMA transfer is complete
listed in Table 4. Table 4 also shows whether the (BCR = 0), the DONE bit is set and a maskable
SFR may be used as Source or Destination only, or interrupt is generated. The GO· bit must be set to
both. . . start any DMA transfer (also, the Slave Control SFR
FRZ bit must be set to disable FIFO DMA Freeze
The FIFO can be accessed during DMA by using the Mode). The two DMA channels are deSignated as
FIFO IN SFR as the DMA Source Address Register DMAO and DMA 1, and their corresponding registers
(SAR) or the FIFO OUT SFR as the Destination Ad- are suffixed by 0 or 1; e.g. SARO, DAR 1, etc.
10-1BO
UPI-4S2
10-181
intJ UPI-452
DONE DMA transfer Flag: service request is generated. DMA transfer cycles
are alternated with instruction execution cycles.
o .DMA transfer .is not completed. DMA transfers are terminated as in FIFO Demand
DMA transfer is complete. Mode.
NOTE:
This flag is set when contents of the Byte Count Output Channel
SFA decrements to zero. It is reset automatically The DMA is configured as in FIFO Demand Mode
when the DMA vectors to its interrupt routine. and transfers are initiated whenever an Output FIFO
GO Enable DMA Transfer: requests service. DMA transfer cycles are alternated
with instruction execution cycles. DMA transfers are
o Disable DMA transfer (in all modes). terminated as in FIFO Demand Mode.
Enable DMA transfer. If the DMA is in
the Block mode, start DMA transfer if The FIFO logic resets the interrupt flag after trans-
possible. If it is in the Demand mode, ferring the byte, so the interrupt is never generated.
enable the channel and wait for a de-
mand. . Once the DMA is programmed to service the FIFO,
the request for service interrupt for the FIFO is inhib-
NOTE: ited until the DMA is done (BCA = 0). .
The GO bit is reset when the BCA decrements to
zero.
2. BURST MODE
In BUAST mode the DMA is initiated by setting the
DMA Transfer Modes GO bit in the DCON SFR. The DMA operation con-
The following four modes of DMA operation are pos- tinues until BCA decrements to zero (zero byte
sible in the UPI-4S2. count), then an interrupt is generated (if enabled).
No interrupts are recognized during a DMA opera-
tion once started.
1. ALTERNATE=CYCLE P.10CE
This mode differs from FIFO Demand Mode in that Output Channel
.CPU instruction cycles must be interleaved with
DMA transfers, even if the FIFO is demanding DMA. The Output FIFO Channel can be used in burst
In FIFO Demand Mode, CPU cycles would never oc- mode by specifying the FIFO OUT or COMMAND
cur if the FIFO demand was present. OUT SFR as the DMA Destination Address. DMA
transfers begin when the GO bit is set. This mode
can be used to send a block of data or a block of
Input Channel Data Stream Commands. If the FIFO becomes full
The DMA is configured as in FIFO Demand Mode during the block transfer, the remaining data will be
and transfers are initiated whenever an Input FIFO lost.
10-182
UPI-452
10-183
UPI-452
4. EXTERNAL DEMAND MODE ARBITER MODE: In this mode, the UPI-452 is the
bus master. It configures port pin P1.5 as HLD input
The DMA can be initiated by an external device via and pin P1.6 as HLDA output. When a device as-
External interrupt 0 and 1 (INTO/INT1) pins. The serts the HLD signal to use the .local bus, the UPI-
INTO pin demands DMAO (Channel 0) and INT1 de- 452 asserts the HLDA Signal after current instruction
mands DMA 1 (Channel 1). If the interrupts are con- execution is complete. If the UPI-452 needs an ex-
figured in edge mode, a single byte transfer is ac- ternal access via a DMA channel, it waits until the
complished for every request. Interrupts also result requester releases the bus, HLD goes inactive.
(INTO and INT1) after every byte transfer (if en-
abled). If the interrupts are configured in level mode, DISABLE MODE: When external program memory is
the DMA transfer continues until the request goes accessed by an instruction or by program counter
inactive or BCR = o. In either case, a DMA interrupt overflow beyond the internal ROM address or exter-
is generated (if enabled) when BCR = o. The GO bit nal data memory is accessed by MOVX instructions,
must be set for the transfer to begin. it is a local memory access and the HLD/HLDA logic
is not initiated. When a DMA channel attempts data
transfer to/from the external data memory, the
EXTERNAL MEMORY DMA HLD/HLDA logic is' initiated as described below.
DMA transfers from the internal memory space to
When transferring data to or from external memory the internal memory space does not initiate the
via DMA, the HOLD (HLD) and HOLD-ACKNOWL- HLD/HLDA logiC.
EDGE (HLDA) signals are used for handshaking;
The HOLD and HOLD-ACKNOWLEDGE are active The balance of the PCON SFR bits are described in
low signals which arbitrate control of the local bus. the "80C51 Register Description: Power Control
The UPI-452 can .be used in a system where mUlti- ·SFR" section below.
masters are connected to a single parallel Address/
Data bus. The HLD/HLDA signals are used to share
resources (memory, peripherals, etc.) among all the Latency
processors on the local bus. The UPI-452 can be
When the GO bit is set, the -UPI-452 finishes the
configured in any of three different External Memory
~J.odss controlled by bits 5 and G (REO &.ARSj in
current instruction before starting the DMA opera-
the PCON SFR '(Table 5). Each mode is described tion. Thus the maximum latency is 3.0 microseconds
(at 16 MHz). .'
below:
10-184
infef UPI-452
When a DMA operation is complete (BCR decre- If the UPI-452 (as a Requester) asserts a HLD signal
ments to zero), the DONE flag in the respective to request a DMA transfer (see "External Memory
DCON (DCONO or DCON1) SFR is set. If the DMA DMA")and its other DMA Channel requests a trans-
interrupt is enabled, the DONE flag is reset automat- fer before the HLDA signal is received, the channel
ically upon vectoring to the interrupt routine. having higher priority is activated first. A Burst Mode
transfer on channel 0 can not be interrupted since
DMAOhas the highest priority. A Demand Mode
Interrupts When DMA is Active transfer on channel 0 is the only type of activity that
can interrupt a block transfer on DMA 1.
If a Burst Mode DMA transfer is in progress, the in-
terrupts are not serviced until the DMA transfer is If, while executing a DMA transfer, the Arbiter re-
complete. This is also true for level activated Exter- ceives a HLD signal, and then before it can acknowl-
nal Demand DMA transfers. During Alternate Cycle edge, its other DMA Channel requests a transfer, it
DMA transfers, however, the interrupts are serviced then completes the second DMA transfer before
at the end of the DMA cycle. After that, DMA cycles sending the HLDA signal to release the bus to the
and instruction execution cycles occur alternately. In HLD request.
the case of edge activated External Demand Mode
DMA transfers, the interrupt is serviced at the end of DMA transfers may be held off under the following
DMA transfer of that single byte. conditions:
1. A write to any of the DMA registers inhibits the
DMA for one instruction cycle.
DMA Arbitration
Only one of the two DMA channels is active at a NOTE:
An instruction cycle may be executed in 1, 2 or 4
time, except when both are configured in the Alter-
nate Cycle mode. In this case, the DMA cycles and machine cycles dependent on the instruction being
executed. DMA transfers are only executed after
Instruction Execution cycles occur in the following
order: the completion of an instruction cycle never be-
tween machine cycles of a single instruction cycle.
1. DMA Cycle o. Similarly instruction cycles are only executed upon
2. Instruction execution. completion of a DMA transfer whether it be a one
3. DMA Cycle 1. machine cycle transfer or two machine cycles (for
ext. to ext. memory transfers).
4. Instruction execution.
2. A single machine cycle DMA register read opera-
DMAO has priority over DMA 1 during simultaneous tion (Le. MOV A, DCONO) will inhibit the DMA for
activation of the two DMA channels. If one DMA one instruction cycle. However a two cycle DMA
channel is active, the other DMA channel, if activat- register read operation will not inhibit the DMA
(Le. MOV P1, DCONO).
ed, waits until the first one is complete.
If the HOLD/HOLD Acknowledge logic is enabled in
If DMAO is already in the Alternate Cycle mode and
DMA 1 is activated in Alternate Cycle Mode, it will requestor mode the hold request will go active once
take two instruction cycles before DMA 1 is activated the go bit has been set (for burst mode) and once
(due to the priority of DMAO). Once DMA 1 becomes the demand flag is set (for demand mode) regard-
active, the execution will follow the normal se- less of whether the DMA is held off by one of the
quence. above conditions.
10-185
intJ UPI-452
51 52 53 5. 55 56 51 52 53 5. 55 56
05C
Jl.fl.I1.. nsLru-Lfl..I1..ru-Lfl.I1.. n..rLru-L nsLru-L nsLr"'"
ALE
r 1\ r ~
r
OM" CYCLE
231428-13
OM... CYCLE
51 52 53 5' 55 56 51' 52 53
CLOCK
ALE
PSEN
iiii
231428-14
51 52 53 5' 55 56 51 ,I' 52 53
CLOCK
ALE
I--------O"A CyCLE-------1
231428-15
10-186
inter UPI-452
51 52 53 54 55 56 51 52 53
CLOCK
ALE
P5EN
PORT2
PORTO
IN5TRUCTION
DMA CYCLE EXECUTION
231428-16
. 10-1B7
UPI-452
A Data Stream Command Interrupt is generated Immediate Command OUT bit (SSTAT SST6) to
whenever there is a Data Stream Command in the be set and the corresponding Host Status bit
COMMAND IN SFR. The interrupt is generated to (HSTAT HST6) to be cleared indicating the SFR is
ensure that the internal interrupt is recognized be- empty. When the internal CPU writes to the Imme~
fore another instruction is executed. diate Command OUT SFR, the Host Status bit is
set and Slave Status bit is cleared to indicate the
, ~FR isfull. (See Figure 7b, Immediate Command
Immediate Command Interrupts OUT Flowchart.) ,
a. An Immediate Command IN interrupt is generat-
ed, if enabled, to the internal CPU when the Host NOTE:
has written to the Immediate Command IN (IMIN) Immediate Command IN and OUT interrupts are ac-
SFR. The, write operation clears the Slave Status tually specific FIFO-Slave Interface interrupts to the
SFR bit (SSTAT SS:r2) and sets the Host Status internal CPU.
SFR bit (HSTAT HST2) to indicate that a byte is
present in the Immediate Command IN' SFR. One instruction from the main program is executed
When the internal CPU reads the Immediate Com- between two Consecutive interrupt service routines
mand IN (IMIN) SFR the Slave Status SFR status as in the 80C51. However, if the second interrupt
bit is set, and the Host Status SFR status bit is service routine is due to a Data Stream Command
cleared indicating the IMIN SFR is empty. Clear- Interrupt, the main program instruction is not execut~
ing the Host Status SFR bit will cause a Request ed (to prevent misreading of invalid data).
For Service (INTRQ) interrupt, if enabled, to signal
the Host that the IMIN SFR is empty. (See Figure
7a, Immediate Command IN Flowchart.) Interrupt Enabling and Priority
b. An Immediate Command OUT interrupt is gener- Each of the three interrupt special function registers
ated; if enabled, to the internal CPU when the (IE, IP and IEP) is listed below with its corresponding
Host has read the Immediate Command QUT bit definitions.
SFR. The Host read causes the Slave Status
1E.6 (reserved)
- 1E.5 (reserved)
ES lEA Serial Channel interrupt enable
ET1 1E.3 Internal Timer/Counter 1 Overflow Interrupt
EX1 IE.2 Externallnterrilpt-Request 1-
ETO 1E.1 In,ternal Timer/Counter 0 Overflow Interrupt
EXO lE.O , External Interrupt Request o.
10-188
UPI·452
Symbolic Physical
Address Address
IP PS PT1 PX1 PTO PXO OB8H
(MSB) (LSB)
Priority Within
Symbol Position Function
A Level
(lowest)
- IP.7 (reserved) -
- IP.6 (reserved) -
- IP.5 (reserved) -
PS IP.4 Local Serial Channel 0.7
PT1 IP.3 Internal Timer/Counter 1 0.5
PX1 IP.2 External Interrupt Request 1 0.3
PTO IP.1 Internal Timer/Counter 0 0.1
PXO IP.O External Interrupt Request 0 0.0
(highest)
Symbolic Physical
Address Address
IEP I.PFIFO I EDMAO I EDMA1 I PDMAO I PDMA1 I EFIFO I OF8H
(MSB) (LSB)
Priority
Symbol Position Function Within a
Level
- IEP.7 (reserved)
- IEP.6 (reserved)
PFIFO IEP.5 FIFO Slave Bus Interface Interrupt Priority 0.6
EDMAO IEP.4 DMA Channel 0 Interrupt Enable
EDMA1 IEP.3 DMA Channel 1 Interrupt Enable
PDMAO IEP.2 DMA Channel 0 Priority 0.2
PDMA1 IEP.1 DMA Channel 1 Priority 0.4
EFIFO IEP.O FIFO Slave Bus Interface Interrupt Enable
10-189
inter UPI-452
FIFO:.EXTERNAL HOST INTERFACE DMA Freeze Mode bit defaults to FIFO DMA Freeze
Mode (SLCON FRZ = O). Below is a list of the FIFO
FIFO DMA FREEZE MODE Special Function Registers and their default power
on reset values;
Overview SFRName Label Value
During FIFO DMA Freeze Mode the internal CPU Channel Boundary Pointer· CBP 40H 164D
can reconfigure the FIFO interface. FIFO DMA Output Channel Read Pointers ORPR 40H 164D
Freeze Mode is provided to prevent the Host from Output Channel Write Pointers OWPR 40H 164D
accessing the FIFO during a reconfiguration se-
Input Channel Read Pointers IRPR OOH 100D
quence. The internal CPU invokes FIFO DMA
Freeze MOde by clearing bit 3 of 'the Slave Control Input Channel Write Pointers IWPR OOH 100D
SFR (SC3). INTRQ becomes active whenever FIFO Input Threshold ITHR BOH I 12BD
DMA Freeze Mode is invoked to indicate the freeze Output Threshold OTHR 01H 110
status. The interrupt can only be deactivated by the
Host reading the Host Status SFR. The Input and Output FIFO channels may be recon-
figured by programming any of these SFRs while the
During FIFO DMA Freeze Mode only two operations FIFO Host interface is in FIFO DMA Freeze Mode.
are possible by the Host to the UPI-452 slave, the The UPI-452 also notifies the Host that FIFO DMA
balance are disabled, as shown in Table B. The in- Freeze Mode is in progress by setting the Host
ternal DMA is disabled during FIFO DMA Freeze Status SFR FIFO DMA Freeze Mode Status bit,
Mode, and the internal CPU has write access to all FIFO DMA Freeze Mode In Progress. The Host in-
of the FIFO control SFRs (Table 9). terrogates the Host Status SFR to determine the
status of the FIFO Host interface following reset be- .
fore attempting to read ,from or write to the UPI-452
Initialization FIFO buffer.
At power on reset the FIFO Host interface is auto-
matica!!y frozen. The Slave Control Enab!e F!FO
Table 8. Slave Bus Interface Status During FIFO DMA Freeze Mode
Interface Pins; Operation In Status In
CS A2 A1 AD READ WRITE
DACK Normal Mode FIFO DMA Freeze Mode
1 0 0 1 0 0 1 Read Host Status SFR Operational
1 0 0 1 1 0 1 Read HostControl SFR Operational
1 0 0 1 1 1 0 Write Host Control SFR Disabled
1 0 0 0 0 0 1 Data or DMA Data from Disabled
Output Channel
1 0 0 0 0 1 0 Data or DMA Data to Disabled
Input Channel
1 0 0 0 1 0 1 Data Stream Command from Disabled
Output Channel
1 0 0 0 1 1 0 Data Stream Command to Disabled
Input Channel
1 0 1 0 0 0 1 Read Immediate Command Disabled
Qut from Output Channel
1 0 1 0 0 1 0 Write Immediate Command Disabled
In to Input Channel
0 X X X X 0 1 DMA Data from Outp,ut Disabled
Channel
0 X X X X 1 0 DMA Data to Input Channel Disabled
10-190
inter UPI·452
The UPI-452 can also be programmed to interrupt FIFO DMA Freeze Mode without first stopping the
the Host following power on reset in order to indi- external Host from accessing the UPI-452 will not
cate to the Host that FIFO DMA Freeze Mode is in guarantee a clean break with the external Host.
progress. This is done by enabling the INTRO inter-
rupt output pin via the MODE SFR (MD4) before the The proper way to invoke FIFO DMA Freeze Mode is
Slave Control SFR Enable FIFO DMA Freeze Mode by issuing an Immediate Command to the external
bit is set to Normal Mode. At power on reset the host indicating that FIFO DMA Freeze Mode will be
Mode SFR is forced to zero. This disables all inter- invoked. Upon receiving the Immediate Command,
rupt and DMA output pins (INTRO, DROIN/ the external Host should complete servicing all
INTROIN and DROOUTIINTROOUT). Because the pending interrupts and DMA requests, then send an
Host Status SFR FIFO DMA Freeze Mode In Prog- Immediate Command back to the UPI-452 acknowl-
ress bit is set, a Request For Service, INTRO, inter- edging the FIFO DMA Freeze Mode request. After
rupt is pending until the Host Status SFR is read. issuing the first Immediate Command, the internal
This is because the FIFO DMA Freeze Mode inter- CPU should not perform any action on the FIFO until
rupt is always enabled. If the Slave Control FIFO FIFO DMA Freeze Mode is invoked .
. DMA Freeze Mode bit (SLCON FRZ) is set to Nor-
mal Mode before the MODE SFR INTRO bit is en- If FIFO DMA Freeze Mode is invoked without stop-
abled, the INTRO output will not go active when the ping the Host during Host transfers, only the last two
MODE SFR INTRO bit is enabled if the Host Status bytes of data written into or read from the FIFO will
SFR has been read. be valid. The timing diagram for disabling the FIFO
module to the external Host interface is illustrated in
The default values for the FIFO and Slave Interface Figure 12. Due to this synchronization sequence, the
represents minimum UPI-452 internal initialization. UPI-452 might not go into FIFO DMA Freeze Mode
No specific Special Function Register initialization is immediately after SC3 is cleared. A special bit in the
required to begin operation of the FIFO Slave Inter- Slave Status Register (SST5) is provided to indicate
face. The last initialization instruction must always the status of the FIFO DMA Freeze Mode. The FIFO
set the UPI-452 to Normal Mode. This causes the DMA Freeze Mode operations described in this sec-
UPI-452 to exit FIFO DMA Freeze Mode and en- tion are only valid after SST5 is cleared.
ables Host read/write access of the FIFO.
As FIFO DMA Freeze Mode is invoked, the DROIN
Following reset, either hardware (via the RST pin) or or DROOUT will be deactivated (stopping the trans-
software (via HCON SFR bit HC3) the UPI-452 re- ferring of data), bit 1 of the Host Status SFR will be
quires 2 internal machine cycles (24 TCLCL) to up- set (HST1 = 1), and SST5 will be cleared (SST5 = 0)
date all internal registers. to indicate to the external Host and internal CPU
that the slave interface has been frozen. After the
freeze becomes effective, any attempt by the exter-
Invoking FIFO DMA Freeze Mode .nal Host to access the FIFO will cause the overrun
During Normal Operation and underrun bits to be activated (bits HST7 (for
reads) or HST3 (for writes». These two bits, HST3
When the UPI-452 is in normal operation, FIFO DMA and HST7, will be set (deactivated) after the Host
Freeze Mode should not be arbitrarily invoked by Status SFR has been read. If INTRO is used to re-
clearing SC3 (SC3 = 0) because the external Host quest service, the FIFO interface is frozen upon
runs asynchronously to the internal CPU. Invoking completion of any Host read or write operation in
progress.
DRQIN/
DRQOUT
..J
~ -----55 ~----,
I' ~.! A FIFO RD/WR AFTER INTERFACE
, FREEZE IS INVOKED WILL CAUSE
, HST 3 OR HST7 TO BE SET
5r-------------~~~----~~----~--~~----~
INTRQ -1_ --------------------- :FIFO INTERNALLY STOPPED FROM
ACCEPTING OR OUTPUTIING DATA
SC3
HST1 ___________________________ ~
231428-17
External Host writing to the Immediate Command In HCON, the Input Channel error condition flag
SFR and the Host Control SFR is also inhibited (HST3) will be cleared.
when the .slave bus interface is frozen. Writing to
these two registers after FIFO DMA Freeze Mode is
invoked will also cause HST3 (overrun) to be activat- Input FIFO Pointer Registers
ed (HST3 = 0). Similarly, reading the Immediate (IRPR & IWPR)
Command Out Register by the external Host is dis-
abled during FIFO DMA Freeze Mode, and.any at- Once the FIFO module is in FIFO DMA Freeze
tempt to do so will cause the clearing '(deactivating, Mode, error flags due to overrun and underrun of the
"0") of HST7 bit (underrun). Input FIFO pointers will be dis.abled. Any attempt to
create an overrun or unqerrun condition by changing
After the slave bus interface is frozen, the internal the Input FIFO pointers would result in an inconsist-
CPU can perform the following operations on the ency in performance between the status flag and the
FIFO Special Function Registers (these operations threshold counter.
are allowed only during FIFO DMA Freeze Mode).
To enhance the speed of the UPI-452, read opera"
For FIFO 1. Changing the Channel tions on the Input FIFO will look ahead by two bytes.
Reconfiguration Boundary Pointer SFR. Hence, every time the IRPR is changed during FIFO
2. Changing the Input and DMA Freeze Mode, two NOPs need to be executed
Output Threshold SFR. so that the two byte pipeline can be updated with the
new data bytes pointed to by the new IRPR. The
To Enhance the 3. Writing to ,the read and write Threshold Counter SFR also needs to change by the
Testability pointers of the Input and same number of bytes as the IRPR (increase
Threshold Counter if IRPR goes forward or decrease
Output FIFO's.
if IRPR goes backward). This will ensure that future
4. Writing to and reading the interrupts will still be generated only after a thresh-
Host Control SFRs. old number of bytes are available. (See "Input and
5. Controlling some bits of Host Output FIFO Threshold SFR" section below.)
and Slave Status SFRS.
6. Reading the Immediate In FIFO DMA Freeze Mode, the internal CPU can
Command Out SFR and also change the content of IWPR, and each change
Writing to the Immediate of IWPR also requires an update. of the Threshold
Comand In SFR. Counter SPR.
10-192
inter UPI·452
NOTES:
1. Writing of IRPR will automatically cause the FIFO IN SFR to load the contents of the Input FIFO from that location.
2. Writing to ORPR will automatically cause the IOBl SFR to load the contents of the Output FIFO at that ORPR address.
3. Writing to the CBP SFR will cause automatic reset of the four pointers of the Input and Output FIFO channels.
4. The internal CPU cannot directly change the status of these registers. However, by changing the status of the FIFO
channels, the internal CPU can indirectly change the contents of the status registers.
5. Changing the Input FIFO Read/Write Pointers also requires that a consistent update of the Input FIFO Threshold Counter
SFR.
6. Changing the Output FIFO Read/Write Pointers also requires that a consistent update of the Output FIFO Threshold
Counter SFR.
10-193
intJ UPI·452
Input and Output FIFO Threshold SFR Host Status SFR (HSTAT)
(ITHR & OTHR)
When in, FIFO DMA Freeze Mode, some bits in the
The Input and Output FIFO Threshold SFRs are also Host Status SFR are forced high and will not reflect
programmable by the internal CPU during FIFO DMA the new status until the system returns to normal
Freeze Mode. For proper operation of the Threshold operation. The definition of the register in FIFO DMA
feature, the Threshold SFR should be changed only Freeze Mode is as follows:
when the Input and Output FIFO channels are emp-
ty, since they reflect the current number of bytes NOTE:
available to read/write before an'internipt is gener- The internal CPU reads this shadow latch value
ated. . when reading the Host Status SFR. The shadow
latch will keep the information for these bits so nor-
Table 10 illustrates the Threshold SFRs range of mal operation can be resumed with the right status.
values and the number of bytes to be transferred The following bits are set (= 1) when FIFO DMA
when the Request For Service Flag is activated: Freeze Mode is invoked;
HST7 Output FIFO Error Condition Flag,
Table 10. Threshold SFRs Range of Values and
1 = No error.
Number of Bytes to be Transferred
ITHR No. of Bytes No. of Bytes
o = An invalid read has been done on the
OTHR output FIFO or the Immediate Command
(lower Available to (lower Available to Olit Register by the host CPU.
~even bits) be Written seven bits be Read
0 CBP 1 2 NOTE:
1 CBP-1 2 3 The normal underrun error condition status is dis-
2 CBP-2 3 4 abled. If an Immediate Command Out (IMOUT)
• • • • SFR read is attempted during FIFO DMA Freeze
• • • • Mode, the contents of the IMOUT SFR is output on
• • • • the Data Buffer and the, error status is cleared
(= ~.' ,
CBP·3 ,3 (80H-CBP)·3 (80H-CBP)-2
GBP-2· 2 (80H-CBP)-2 (80H-CBP)-1 HST6 Immediate Command Out SFR Status
(80H-CBP)·1 (80H-CBP)
During normal operation, this bit is cleared
(= 0) when the IMOUT SFR is written by the
The eighth bit of the Input and Output FIFO Thresh- UPI-452 internal CPU and set (= 1) when the
old SFR indicates the status of the service requests IMOUT SFR is read by the external Host.
regardless of the freeze condition. If the eighth bit is Once the host-slave interface is frozen (Le.
a "1", the FIFO is requesting service from the exter- SST5 = 0), this bit will be read as a 1 by the
nal Host. In other words, when the Threshold SFR host CPU. A shadow latch will keep the infor-
value goes below zero (2's complement), a service mation for this bit so normal operation can be
request is generated". Normally the ITHR SFR is resumed with the correct status.
decremented after each external Host write to the
Shadow latch:
Input FIFO and incremented after each internal CPU
read of the Input FIFO. The OTHR SFR is decre- 1 = Internal CPU reads the IMOUT SFR
mented by internal CPU writes and incremented by o = Internal CPU writes to the IMOUT SFR
external Host reads. Thus if the pointers are moved
HST5 Data Stream Command at Output FIFO
when the FIFO's are not empty, these relationships
can be used to calculate the offset for the Threshold This bit is forced to a "1" during FIFO DMA
SFRs. It is best to change the Threshold SFRs only Freeze Mode to prevent ,the external host
when the FIFO's are empty to avoid this complica~ CPU from trying to read the DSC. Once nor-
tion. The threshold registers should also be updated mal. operation is resumed, HST5 will reflect
after the pointers have been manipulated. the Data/Command status of the currentbyte
in the Output FIFO.
NOTE: Shadow Latch (read by the internal CPU):
When programming the ITHR SFR, the eighth bit
1 = No Data Stream Command (DSC)
should be set to 1 (OR'd with 80H). This causes
HSTAT SFR HSTO = 0, Input FIFO Request For o = Data Stream Command at Output FIFO
Service. If ITHR bit 7 = 0 then HSTAT HSTO = 1,
Input FIFO Does Not Request Service, and no in-
terrupt will be generated.
'The 8th bit of the ITHR SFR must be set during initialization if the
Host interrupt request is desired immediately upon leaving Freeze
Mode,
10-194
intJ UPI·452
HST4 Output FIFO Service Request Status SST? Output FIFO Overrun Error Flag
When FIFO DMA Freeze Mode is invoked, Inoperative in FIFO DMA Freeze Mode.
this bit no longer reflects the Output FIFO Re- SST6 Immediate Command Out SFR Status
quest Service Status. This bit wll be forced to
a 111". In FIFO DMA Freeze Mode, this bit will be
cleared when the internal CPU reads the Im-
HST3 Input FIFO Error Condition Flag mediate Command Out SFR and set when
1 = No error. the internal CPU writes to the Immediate
a = One of the following operations has Command Out Register.
been attempted by the external host and SST5 FIFO-External Interface FIFO DMA Freeze
is invalid: Mode Status
1) Write into the Input FIFO This bit indicates to the internal CPU that
2) Write into the Host Control SFR FIFO DMA Freeze Mode is in progress and
that it has write access to the FIFO Control,
3) Write into the Immediate Command In Host control and Immediate Command SFRs.
SFR
SST4 Output FIFO Request Service Status
NOTE: During normal operation, this bit indicates to
The normal Input FIFO overrun condition is dis- the internal CPU that the Output FIFO is
abled. ready for more data. The status of this bit re-
HST2 Immediate Command In SFR Status flects the position of the Output FIFO read
and write pointers. Hence, in FIFO DMA
This bit is normally cleared when the internal Freeze Mode, this flag can be changed by the
CPU reads the IMIN SFR and set when the internal CPU indirectly as the read and write
external host CPU writes into the IMIN SFR. pointers change.
When the host-slave interface is frozen, read-
ing and writing of the IMIN by the internal SST3 Input FIFO Underrun Flag
CPU will change the shadow latch of this bit. Inoperative during FIFO DMA Freeze Mode.
This bit will be read as a "1" by the external During normal operation, a read operation
Host. clears (= 0) this bit when there are no data
Shadow latch. bytes in the Input FIFO and deactivated (= 1)
1 = Internal CPU writes into IMIN SFR when the Slave Status SFR is read. In FIFO
DMA Freeze Mode, this bit will not be cleared
a = Internal CPU reads the IMIN SFR by an Input FIFO read underrun error condi-
HST1 FIFO DMA Freeze Mode Status tion, nor will it be reset by the reading of the
1 = FIFO DMA Freeze Mode. Slave Status SFR.
a= Normal Operation (non-FIFO DMA SST2 Immediate Command In SFR Status
Freeze Mode). This bit is normally activated (= 0) when the
external host CPU writes into the Immediate
NOTE: Command In SFR and deactivated (= 1)
This bit is used to indicate to the external Host that when it is read by the internal CPU. In FIFO
the host-slave interface has been frozen and hence DMA Freeze Mode, this bit will not be activat-
the external Host functions are now reduced as ed (= 0) by the external Host's writing of the
shown in Table 8. Immediate Command IN SFR since this func-
HSTO Input FIFO Request Service Satus . tion is disabled. However, this bit will be
cleared (= 0) if the internal CPU writes to the
When slave interface is frozen this bit no Immediate Command In SFR and it will be set
longer reflects the Input FIFO Request Serv- = 1) if it reads from the register.
ice Status. This bit will be forced to a "1".
SST1 Data Stream Command at Input FIFO Flag
In FIFO DMA Freeze Mode, this bit operates
Slave Status SFR (SSTAT) normally. It indicates whether the next byte of
data from the Input FIFO is a DSC or data
The Slave Status SFR is a read-only SFR. However, byte. If it is a DSC byte, reading from the
once the slave interface is frozen, most of the bits of FIFO IN SFR will result in reading invalid data
this SFR can be changed by the internal CPU by (FFH) and vice versa. In FIFO DMA Freeze
reconfiguring the FIFO and accessing the FIFO Spe- Mode, this bit still reflects the type of data
cial Function Registers. byte available from the Input FIFO.
10-195
UPI-4S2
SSTO Input FIFO Service Request Flag changed. (See "Input and Output FIFO Threshold
During normal operation, this bit is activated SFR" section below.)
(= 0) when the Input FIFO contains bytes that
can be read by the internal CPU and deacti-
vated (= 1) when the Input FIFO does not MEMORY ORGANIZATION
need any service from the internal CPU. In
FIFO DMA Freeze Mode, the status of this bit The UPI-452 has separate address spaces for Pro-
should not change unless the pointers of the gram Memory and Data Memory like the 80C51. The
Input FIFO are changed. In this mode, the in- Program Memory can be. up to 64K bytes. The lower
ternal CPU can indirectly change this bit by 8K of Program Memory may reside on-chip. The
changing the read .and write pointers of the Data Memory consists of 256 bytes of on-chip RAM,
Input FIFO but cannot change it directly. up to 64K bytes of off-chip RAM and a number of
"SFRs" (Special Function Registers) which appear
as yet another set of unique memory addresses.
Immediate Command In/Out SFR Table 11a_lnternal Memory Addressing
(IMIN/IMOUT) Memory Space Addressing Method
If FIFO DMA Freeze Mode is in progress, writing to Lower 128 Bytes of Direct or Indirect
the Immediate Command In SFR by the external Internal RAM
host will be disabled, and any such attempt will
cause HST3 to be cleared (=0). Similarly, the Imme- Upper 128 Bytes Indirect Only
diate Command Out SFR read operation (by the of Internal RAM
host) will be disabled internally and read attempts
UPI-452 SFR's Direct Only
will cause HST7 to be cleared (= 0).
10-196
infef UPI-4S2
Table 11 b. 80C51 Special Function Registers Table 11c. UPI·452 Additional Special
Function Registers (Continued)
Symbol Name Address Contents
Symbol Name Address Contents
'ACC Accumulator OEOH OOH
'B B Register OFOH OOH DARLO Low Byte/ OC2H I
'PSW Program Status ODOH OOH DARHO Hi Byte/ OC3H I
Word Channel 0
SP Stack Pointer 81H 07H DARL1 Low Byte/ OD2H I
DPTR Data Pointer 82H OOOOH DARH1 Hi Byte/ OD3H I
(consisting of DPH Channel 1
and DPL) OOH
DCONO DMAO Control 92H
'PO PortO 80H OFFH
DCON1 DMA 1 Control 93H OOH
'P1 Port 1 90H OFFH
"P2 Port 2 OAOH OFFH FIN FIFO IN OEEH I
"P3 Port 3 OBOH OFFH FOUT FIFO OUT OFEH I
*IP Interrupt Priority OB8H OEOH HCON Host Control OE7H OOH
Control Host Status OE6H OFBH
HSTAT
"IE Interrupt Enable OA8H 60H
*IEP Interrupt Enable OF8H OCOH
Control
and Priority
TMOD Timer/Counter 89H OOH
Mode Control IMIN Immediate Command OFCH I
In
"TCON Timer/Counter 88H OOH
Control IMOUT Immediate Command OFDH I
THO Timer/Counter 8CH OOH Out
o (high byte) . IRPR Input Read OEBH OOH
TLO Timer/Counter 8AH OOH Pointer
o (low byte) ITHR Input FIFO OF6H 80H
TH1 Timer/Counter 8DH OOH Threshold
1 (high byte) IWPR Input Write OEAH OOH
TL1 Timer/Counter 8BH OOH Pointer
.1 (low byte) MODE Mode Register OF9H 8FH
"SCON . Serial Control 98H OOH ORPR Output Read OFAH 40H
SBUF Serial Data Buff 99H I Pointer
PCON Power Control 87H 10H
OTHR Output FIFO OF7H 01H
I = Indeterminate Threshold
Table 11c. UPI-452 Additional OWPR Output Write. OFBH 40H
Special Function Registers Threshold
Symbol Name Address Contents *P4 Port 4 OCOH OFFH
DMA Source Address
BCRLO DMA Byte OE2H I
Count Low Byte/ SARLO Low Byte/ OA2H I
BCRHO High Byte/ OE3H I SARHO Hi Byte/ OA3H I
Channel 0 Channel 0
BCRL1 Low Byte/ OF2H I SARL1 Low Byte/ OB2H I
10-197
inter UPI·452
10-19S
inter UPI·452
NOTE:
If 1's are written to PO and IOL at the same time, PO takes precedence. The reset value of peON is (OOOXOOOO).
10-199
inter UPI-452
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may cause permanent dam-
Ambient Temperature Under Bias ..... o·c to 70'Ct age to the device. This is a stress rating only and
Storage Temperature .......... - 65'C to + 150'C functional operation of the device at these or any
other conditions above those indicated in the opera-
Voltage on Any
tional sections of this specification is not implied. Ex-
Pin to Vss ............... -0.5V to Vee + 0.5V posure to absolute maximum rating conditions for
Voltage on Vee to Vss ............ -0.5V to + 6.5V extended periods may affect device reliability.
Power Dissipation ........................ 1.0W··
Vec/Vpp Supply Voltage with NOTICE: Specifications contained within the
Respect to Ground following tables are subject to change.
During Programming ......... - 0.6V to + 14.0V
10-200
UPI-4S2
NOTES:
1. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLS of ALE and Ports
1 and 3. The noise is due to external bus capacitance discharging into the Port 0 and Port 2 pins when these pins make 1-
to-O transitions during bus operations. In the worst cases (capacitive loading> 100 pF), the noise pulse on the ALE line may
exceed 0.8V. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
2. Capacitive loading on Ports 0 and 2 may cause the VOH on ALE and PSEN to momentarily fall before the 0.9 Vee
specification when the address bits are stabilizing.
3. Power DOWN lee is measured with all output pins disconnected; EA = Port 0 = Vee; XTAL2 N.C.; RST = Vss; DB =
Vee; WR = RD = DACK = CS = AO = Al = A2 = Vee. Power Down Mode is not supported on the 87C452P.
4. lee is measured with all output pins disconnected; XTAL1 driven with TCLCH, TCHCL = 5 ns, VIL = VSS + 0.5V, VIH ""
Vee - 0.5V; XTAL2 N.C.; EA = RST = Port 0 = Vee; WR = RD = DACK = CS = AO = A1 = A2 = Vee. lee would be
slightly higher if a crystal oscillator is used.
5. Idle lee is measured with all output pins disconnected; XTAL 1 driven with TCLCH, TCHCL = 5 ns, VIL = Vss + 0.5V,
VIH = Vee - 0.5V; XTAL2 N.C.; Port 0 = Vee: EA = RST = Vss; WR = RD = DACK = CS = AO = A1 = A2 = Vee.
6. 87C452P Piggyback EPROM only.
7. 80C452 and 83C452 only.
H: Logic level HIGH. TAVLL = Time for Address Valid to ALE Low.
I: Instruction (program memory contents). TLLPL = Time for ALE Low to PSEN Low.
L: Logic level LOW, or ALE.
P: PSEN.
10-201
UPI-452
A.C. CHARACTERISTICS TA = O·C to 70·C, Vee = 5V ± 10%, Vss = OV, Load Capacitance for
Port 0, ALE, and PSEN = 100 pF, Load Capacitance for All Other Outputs = 80 pF
10-202
inter UPI-452
ALE~
-- r----------------~I~
TWHLHCJ-----\
~ ____ _J
I
\\.. _ _- . J1
14
. 1 - - - - TLLDV - - - - - - I
PORTO
231428-19
TLHLL ......
ALE
·~~t----TPLPH ----+I
PORTO
231428-20
10-203
inter UPI-452
ALE.
PSENJ
.-.rr___________________ ~_H_L_H-_L~~
1 \...
______ _J
'''''_ _-'1
I+---+-~-TOVWH ---f4-I~HOX
r---r~_-"\l
PORTO DATA OUT
231428-21
INSTRUCTION I a 2 3 4 5 6 7 B
.,<" . n n n n n n n n n n n n n n n n n n I
-~~~~~~~~~~~~~~~~~~~
_ _ _ _--iI-lXLXL -I
CLOCK
~rlXHOX
INPUT DATA _ _ _ _ _J
t
t
CLEAR Rl
SET Rl
231428-22
10-204
inter UPI-452
NOTE:
External clock timings are sampled, not tested on ali parts.
Vee-0.5 - - - - ~~:-:--"'"
0.45V
231428-23
0.45VJ\_0_.2_V.,,:e::;e_-0_._
1------'.
>C TIMING REFERENCE
POINTS
231428-24 . 231428-25
AC inputs during testing are driven at Vee -0.5V for a logic "1" For timing purposes a port pin is no longer floating when a
and OA5V for a logic "0". Timing measurements are made at VIH 100 mV change from load voltage occurs, and begins to float
min. for a logic "1" and VIL max. for a logic "0". when a 100 mV change from the loaded VOHIVOL level occurs.
IOL/IOH <: ± 20 rnA.
10-205
intJ UPI-4S2
HLD/HLDA WAVEFORMS
Arbiter Mode
Requestor Mode
HLD _ _ _ .....If( j
HLDA _ _~{,~_
I- TAHHL-----+l-
,,,..,-----
231428-31
HLD/HLDA TIMINGS
Test Conditions: TA = O·C to +70·C; Vee = 5V ±10%, Vss = OV; Load Capacitance = 80 pF
16MHzOsc Variable Oscillator
Symbol Parameter Units
Min Max Min Max
TUlAIPt.1 ~I"\'"
I I ItVIII .. HLD Pulss \Nidth 350 AT"'" ,",I I
.... lvL.vL.-r: IUU liS
Tee
)
TRV
Tee
f
~
TDR
~TDH
DATA )
DRQIN
DRQOUT
231428-27
10·206
inter UPI-4S2
Test Conditions: TA = O°C to 70·C; Vee = 5V ±10%; Vss = OV; Load Capacitance = 80 pF
16 MHzOsc Variable Oscillator
Symbol Parameter Units
Min Max Min Max
TCC Cycle Time 375 6TCLCL ns
TPW Command Pulse Width 100 100 ns
TRV Recovery Time 60 60 ns
TAS Address Setup Time 5 5 ns
TAH Address Hold Time 30 30 ns
TOS Write Data Setup Time 30 30 ns
TOHw Write Data Hold Time 5 5 ns
TOHR Read Data Hold Time 5 40 5 40 ns
TOV READ Active to Read 85 92 nson ns
Data Valid Delay 12 MHz Part
TDR WRITE Inactive to Read 300 4.8TCLCL ns
Data Valid Delay
(Applies only to Host
Control SFR)
TRa READ or WRITE Active 150 150 ns
to DRaiN or DRaOUT Delay
DEVICE
FAILED
DEVICE
FAILED
231428-29
inteligent Programming™ Algorithm duration of the initial PGM pulse(s) is one millisec-
ond, which will then be followed by a longer overpro-
The inteligent Programming Algorithm, a standard in gram pulse of length 3X ms. X is an iteration counter
the industry for the past few years, is required for all and is equal to the number of the initial one millisec-
of Intel's 12.5V DERDEP EPROMs. Plastic amd ond pulses applied to a particular location, before a
PLCC EPROMs may also be programmed using this correct verify occurs. Up to 25 one-millisecond puls-
method. A flowchart of the inteligent Programming es per byte are provided for before the overprogram
Algorithm is shown in Figure 4. pulse is applied.
The entire sequence of program pulses and byte verifications is performed at Vcc· = 6.0V and Vpp =
12.5V. When the inteligent Programming cycle has been completed, all bytes should be compared to the
. original data with Vee = Vpp = 5.0V.
PROGRAMMING VERIFICATION
PORT I.PORT2 ~C~AgDD~REgSStO~-j'~2=}-----t::!A~DD~R~ES~S~O~-~'2~:>----
TAVQV -
PORTO---t-C:JD~~!A~IN=:>-t--------(JD~AT~A~O~UT~1-----
J TGHDX-
~TDVGl_
_ TAVGl :-
I-
TGHAX I- TElQV
I - "1
Ll
TEHQZ
----~-I~~~~ I~,--------~--~~TD-H-AX-~----
AlE/PGM I
-j ~,TPHGl
+:~~~l -ITEHSH
1- TDXOl- 1
·1
231428-30
NOTES:
1. Vee must be applied simultaneously or before Vpp and removed simultaneously or after Vpp.
2. The length of the overprogram pulse may vary from 2.85 ms to 78.75 ms as a function of the iteration counter value X
(inteligent Programming Algorithm only).
3. This parameter is only sampled and is not 100% tested. Output Float is defined as the point where data is no longer
driven-see timing diagram.
4. The maximum current value is· with Port 0 unloaded.
10-209
intJ UPI-452
10-210
inter APPLICATION
NOTE
AP-70
November 1987
JOHN WHARTON
MICROCONTROLLER APPLICATIONS
10-212
inter AP-70
2.0 BOOLEAN PROCESSOR plex (albeit slower) ones, which in tum link together
eventually solving the problem at hand. A four-bit CPU
OPERATION executing multiple precision subroutines can, for exam-
The Boolean Processing capabilities of the 8051 are ple, perform 64-bit addition and subtraction. The sub-
based on concepts which have been around for some routines could in tum be building blocks for floating-
time. Digital computer systems of widely varying de- point multiplication and division routines. Eventually,
signs all have four functional elements in common (Fig- the four-bit CPU can simulate a far more complex "'vir-
ure 2): tual" machine.
• a central processor (CPU) with the control, timing, In fact, any digital computer with the above four func-
and logic circuits needed to execute stored instruc- tional elements can (given time) complete any algo-
tions: rithm (though the proverbial room full of chimpanzees
• a memory to store the sequence of instructions mak- at word processors might first re-create Shakespeare's
ing up a program or algorithm: classics and this Application Note)! This fact offers lit-
• data memory to store variables used by the pro- tle consolation to product designers who want pro-
gram: grams to run as quickly as possible. By definition, a
and real-time contrql algorithm must proceed quickly
enough to meet the preordained speed constraints of
• some means of communicating with the outside other equipment.
world.
One of the factors determining how long it will take a
The CPU usually includes one or more accumulators or microcomputer to complete a given chore is the num-
special registers for computing or storing values during ber of instructions it must execute. What makes a given
program execution. The instruction set of ~uch a computer architecture particularly well- or poorly-suit-
processor generally includes, at a minimum, operation ed for a class of problems is how well its instruction set
classes to perform arithmetic or logical functions on matches the tasks to be performed. The better the
program variables, move variables from one place to "primitive" operations correspond to the steps taken by
another, cause program execution to jump or condi- the control algorithm, the lower the number of instruc-
tionally branch based on register or variable states, and tions needed, and the quicker the program will run. All
instructions to call and return from subroutines. The else being equal, a CPU supporting 64-bit arithmetic
program and data memory functions sometimes share a directly could clearly perform floating-point math fast-
single memory space, but this is no~ always the case. er than a machine bogged-down by multiple-precision
When the address spaces are separated, program and subroutines. In the same way, direct support for bit
data memory need not even have the same basic word manipulation naturally leads to more efficient pro~
width. grams handling the binary input and output conditions
inherent in digital control problems.
A digital computer's flexibility comes in part from
combining simple fast operations to produce more com-
TIMING &
CONTROL
PROGRAM
MEMORY
ACCUMULATOR
& REGISTERS
INPUTI REAL
OUTPUT WORLD
PORTS
CENTRAL
DATA
PROCESSING
MEMORY
UNIT
203830-2
10-213
AP·70
ORL C.bit
bit to Carry flag
OR direct bit to Carry flag 2 2
opcode I I bit address
ORL C.bit OR complement of direct 2 2
bit to Carry flag SETB bit
CLR bit
JC rei Jump if Carry is flag is set 2 2
CPL bit
JNC rei Jump if No Carry flag 2 2
ANLC, bit
JB bit.rel Jump if direct Bit set 3 2
JNB bit.rel Jump if direct Bit Not set 3 2 ANL C,/ bit
JBC bit.rel Jump if direct Bit is set & 3 2 ORLC, bit
Clear bit ORL C,/ bit
Address mode abbreviations MOVC, bit
MOV bit,C
C-Carry flag.
bit-128 software flags, any 1/0 pin, control or status
bit.
rei-Ali conditional jumps include an 8-bit offset byte.
opcode I I bit address I displacement I
JB bit, rei
Range is + 127 -128 bytes relative to first byte of the
JNB bit, rei
following instruction.
JBC bit, rei
All mnemonics copyrighted@ Intel Corporation 1980.
b.) Bit Manipulation and Test Instructions
10-214
AP-70
7FH~
1-";:;'" I~
OFFH
OFOH F7 FO B
2FH 7F 7E 7D 7C 7B 7A 79 78
2DH 6F 6E 6D 6C 6B 6A 69 68
2BH SF 5E 5D 5C 5B SA 59 58
2AH 57 56 55 54 53 52 51 50 OB8H B8 tP
29H 4F 4E 4D 4C 4B 4A 49 48
28H 47 46 45 44 43 42 41 40 OBOH B7 BO P3
27H 3F 3E 3D 3C 3B 3A 39 38
26H 37 36 35 34 33 32 31 3D OA8H AF A8 tE
25H 2F 2E 2D 2C 2B 2A 29 28
24H 27 26 25 24 23 22 21 20 OAOH A7 AO P2
23H IF IE lD lC lB lA 19 18
21H OF DE OD OC DB OA 09 08
20H 07 06 05 04 03 02 01 DO 90H 97 90 PI
lFH
Bank 3
18H
17H
88H 8F 88 TCON
10H Bank 2
OFH
D8H Bank 1
07H
80H 87 80 PO
BankO
DO
203830-3
a.):RAM Bit Addresses· b.) Special Function Register Bit Addresses
Figure 4. Bit Address Maps
Data Memory. The instructions in Figure 3b can oper- Input/Output. All 32 I/O pins can be addressed as indi-
ate directly upon 144 general purpose bits forming the vidual inputs, outputs, or both, in any combination.
Boolean processor "RAM." These bits can be used as Any pin can be a control strobe output, status (Test)
software flags or to store program variable~. Two oper- input, or serial I/O link implemented via software. An
and instructions use the CPU's carry flag ("C") as a additional 33 individually addressable bits reconfigure,
special one-bit register: in a sense, the carry is a "Boole- control, and monitor the status of the CPU and all on-
an accumulator" for logical operations and data trans- chip peripheral functions (timer counters, serial port
fers. modes, interrupt logic, and so forth).
10-215
inter AP-70
(MSB) (LSB)
INT1 PS.S Interrupt 1 input pin.
I RD I WR I T1 I TO IINT1 I INTO I TXD I RXD I Low-level or falling-edge trig-
gered.
Symbol Position Name and Significance Interrupt 0 input pin.
INTO PS.2
RD PS.7 Read data control output. Low-level or falling-edge trig-
Active low pulse generated by gered.
hardware when external data
TXD PS.1 Transmit Data pin for serial
memory is read. port in UART mode. Clock out-
WR PS.6 Write data control output. put in shift register mode.
Active low pulse generated by
RXD PS.O Receive Data pin for serial
hardware when external data
port in UART mode. Data I/O
memory is written.
pin in shift register mode.
T1 PS.5 Timer/counter 1 external input
or test pin.
TO PS.4 Timer/counter 0 external input
or test pin.
Figure 6. P3-Alternate I/O Functions of Port 3
Direct Bit Addressing Bit addresses between 128 and 255 (80H and OFFH)
correspond to bits in a number of special registers,
The most significant bit of the direct address byte se- mostly used for I/O or peripheral control. These posi-
lects one of two groups of bits: Values between 0 and tions are numbered with a different scheme than RAM:
127 (DOH and 7FH) defme bits in a block of 32 bytes of the five high-order address bits match those of the reg-
on-chip RAM, between RAM addresses 20H and 2FH ister's own address, while the three low-order bits iden-
(Figure 4a). They are numbered consecutively from the tify the bit position within that register (Figure4b).
lowest-order byte'S lowest-order bit through the high-
est-order byte'S highest-order bit.
10-216
infef AP-70
Notice the column labeled "Symbol" in Figure 5. Bits the five bits not implemented in IE and IP should not
with special meanings in the PSW and other registers be accessed: they can not be used as sof~ware flags.
have corresponding symbolic names. General-purpose
(as opposed to carry-specific) instructions may access Addressable Register Set. There are 20 special function
the carry like any other bit by using the mnemonic CY registers in the 8051, but the advantages of bit address-
in place of C, PO, PI, P2, and P3 are the 8051's four ing only relate to the II described below. Five poten-
I/O ports: secondary functions assigned to each of the tially bit-addressable register addresses (OCOH, OC8H,
eight pins of P3 are shown in Figure 6. OD8H, OE8H, & OF8H) are being reserved for possible
future expansion in microcomputers based on the
Figure 7 shows the last four bit addressable registers. MCS-51 architecture. Reading or writing non-existent
TCON (Timer Control) and SCON (Serial port Con- registers in the 8051 series is pointless, and may cause
trol) control and monitor the corresponding peripher- unpredictable results. Byte-wide logical operations can
als, while IE (Interrupt Enable) and IP (Interrupt Pri- be used to manipulate bits in all non-bit addressable
ority) enable and prioritize the five hardware interrupt registers and RAM.
sources. Like the reserved hardware register addresses,
10-217
intJ AP-70
(MSB) (LSB)
IE1 TCON.3 Interrupt 1 Edge flag.
ITF1 I TR1 I TFO I TRO IIE1 IIT1 I lEO liTO I Set by hardware when exter-
nal interrupt edge detected.
Symbol Position Name and Significance Cleared when interrupt pro-
TF1 TCON.7 Timer 1 overflow Flag. cessed.
Set by hardware on timer/ In TCON.2 Interrupt 1 Type control bit.
counter overflow. Cleared Set/cleared by software to
when interrupt processed. specify falling edge/low level
TR1 TCON.a Timer 1 Run control bit. triggered external interrupts.
Set/cleared by software to turn lEO rCON.1 Interrupt 0 Edge flag:
timer/counter on/off. Set by hardware when exter-
TFO TCON.5 Timer 0 overflow Flag. nal interrupt edge detected.
Set by hardware on timer/ 'Cleared when interrupt pro-
counter overflow. Cleared cessed.
when interrupt processed. ITO TCON.O Interrupt 0 Type control bit.
TRO TCONA Timer 0 Run control bit. Set/cleared by software to
Set/cleared by software to turn specify falling edge/low level
timer/counter on/off. triggered external interrupts.
a.) TCON-Timer/Counter Control/Status Register
10-21B
AP-70
(MSB) (lSB)
Symbol Position Name and Significance, EX1 1E.2 Enable External interrupt 1
EA IE.? Enable All control bit. control bit. Set! cleared by
Cleared by software to disable software to enable/disable in-
all interrupts, independent of terrupts from INT1.
the state of IE.4-IE.O. ETO IE.1 Enable Tilller 0 control bit.
1E.6 (reserved) Set! cleared by software to en-
1E.5 able/disable interrupts from
timer / counter O.
ES IE.4 Enable Serial port control bit.
Set/cleared by software to en- EXO IE.O Enable External interrupt 0
able/disable interrupts from TI control bit. Set/cleared by
or RI flags. software to enable/disable in-
terrupts from INTO.
ET1 IE.3 Enable Timer 1 control bit.
Set!cleared by software to en-
able/disable interrupts from
timer/counter 1.
c.) IE-Interrupt Enable Register
(MSB) (lSB)
10-219
intJ AP-70
• by the name or address of the register containing the Logical Operations. Four instructions perform the logi-
bit, the dot operator symbol (a period: "."), and the cal-AND and logical-OR operations between the carry
bit's position in the register (7 -0): and another bit, and leave the results in the carry. The
• in the case of control and 'status registers, by the instruction mnemonics are ANL and ORL;' the absence
predefined assembler symbols listed in the first col- or presence of a slash mark ("/") before the source
umns'ofFigures 5-7. operand indicates whether to use the positive-logic val-
ue or the logical complement of the addressed bit. (The
Bits may also be given user-defined names with the as- source operand itself is never affected.)
sembler "BIT" directive and any of the above tech-
niques. For example, bit 5 of the PSW may be cleared Bit-test Instructions. The conditional jump instructions
by any of the four instructions. "JC rei" (Jump on Carry) and "JNC rei" (Jump on
Not Carry) test the state of the carry flag, branching if
USR_FLG BIT PSW.5 User Symbol Definition it is a one or zero, respectively. (The letters "rei" de-
note relative code addressing.) The three-byte instruc-
CLR OD5H Absolute AddreSSing tions "JB bit.rel" and "JNB bit. rei" (Jump on Bit and
CLR PSW.5 Use of Dot Operator Jump on Not Bit) test the state of any addressable bit in
CLR FO Pre-Defined Assembler a similar manner. A fifth instruction combines the
Symbol Jump ~m Bit and Clear operations. "JBC bit. rei" condi-
CLR USR_FLG User-Defined Symbol tionally branches to the indicated address, then clears
the bit in the same two cycle instruction. This operation
Data Transfers. The two-byte MOV instructions can is the same as the MCS-48 "JTF" instructions.
transport any addressable bit to the carry in one cycle,
or copy the carry to the bit in two cycles. A bit can be All 8051 conditional jump instructions use program
moved between two arbitrary locations via the carry by counter-relative addressing, and all execute in two cy-
combining the two instructions. (If necessary, push and cles. The last instruction byte encodes a signed dis-
pop the PSW to preserve the previous contents of the placement ranging from -128 to + 127. During execu-
carry.) These instructions can replace the multi-instruc- tion, the CPU adds this value to the incremented pro-
tion sequence of Figure 8, a program structure appear- gram counter to produce the jump destination. Put an-
ing in controller applications, whenever flags or outputs other way, a conditional jump to the immediately fol-
are conditionally switched on or off. - iowing instruction wouid encode OOH in the offset byte.
203830-4
10-220
AP-70
within a register: to reference a bit the programmer Table 3. Other Instructions Affecting
must know and specify both the encompassing register the Carry Flag
and the bit's position therein. This constraint severely
Mnemonic Description Byte eyc
limits the flexibility of symbolic bit addressing and re-
duces the machine's code-efficiency and speed. ADD A,Rn Add register to 1
Accumulator
Interaction with Other Instructions. The carry flag is ADD A,direct Add direct byte to 2
also affected by the instructions listed in Table 3. It can Accumulator
be rotated through the accumulator, and altered as a ADD A,@Ri Add indirect RAM to
side effect of arithmetic instructions. Refer to the Us- Accumulator
er's Manual for details on how these instructions oper- ADD A,#data Add immediate data 2
ate. to Accumulator
AD DC A,Rn Add register to
Accumulator with
Simple Instruction Combinations Carry flag
ADDC A,direct Add direct byte to 2
By combining general purpose bit operations with cer- Accumulator with
tain addressable bits, one can "custom build" several Carry flag
hundred useful instructions. All eight bits of the PSW ADDC A,@Ri Add indirect RAM to
can be tested directly with conditional jump instruc- Accumulator with
tions to monitor (among other things) parity and over- Carry flag
flow status. Programmers can take advantage of 128 ADDC A,#data Add immediate data 2
software flags to keep track of operating modes, re- to Acc with Carry flag
source usage, and so forth. SUBB A,Rn Subtract register from
Accumulator with
The Boolean instructions are also the most efficient borrow
way to control or reconfigure peripheral and I/O regis- SUBB A,direct Subtract direct byte 2
ters. All 32 I/O lines become "test pins," for example, from Acc with borrow
tested by conditional jump instructions. Any output pin SUBB A,@Ri Subtract indirect RAM
can be toggled (complemented) in a single instruction from Acc with borrow
cycle. Setting or clearing the Timer Run flags (TRO and SUBB A,#data Subtract immediate 2
TRI) tum the timer/counters on or off; polling the data from Acc with
same flags elsewhere lets the program determine if a borrow
timer is running. The respective overflow flags (TFO MUL AB Multiply A & B 4
and TFI) can be tested to determine when the desired DIV AB Divide A by B 4
period or count has elapsed, then cleared in preparation DA A Decimal Adjust
for the next repetition. (For the record, these bits are all Accumulator
part of the TCON register, Figure 7a. Thanks to sym-
RLC A Rotate Accumulator
bolic bit addressing, the programmer only needs to re-
Left through the Carry
member the mnemonic associated with each function.
flag
In other words, don't bother memorizing control word
RRC A Rotate Accumulator
layouts.)
Right through Carry
flag
In the MCS-48 family, instructions corresponding to
some of the above. functions require specific opcodes. CJNE A,direct.rel Compare direct byte 3 2
Ten different opcodes serve to clear complement the to Acc &Jump if. Not
software flags FO and Fl, enable/disable each inter- Equal
rupt, and start/stop the timer. In the 8051 instruction CJNE A,#data.rel Compare immediate 3 2
set, just three opcodes (SETB, CLR, CPL) with a direct to Acc &Jump if Not
bit address appended perform the same functions. Two Equal
test instructions (JB and JNB) can be combined with CJNE Rn,#data.rel Compare immed to 3 2
bit addresses to test the software flags, the 8048 I/O register &Jump if Not
pins TO, TI, and INT, and the eight accumulator bits, Equal
replacing 15' more different instructions. CJNE @Ri,#data.rel Compare immed to 3 2
indirect & Jump if Not
Table 4a shows how 8051 programs implement soft- Equal
ware flag and machine control functions associated
with special opcodes in the 8048. In every case the All mnemonics copyrighted © Intel Corporation 1980.
MCS-51 solution requires the same number of machine
cycles, and executes 2.5 times faster.
10-221
intJ AP-70
Table 4a. Contrasting 8048 and 8051 Blt;Control and Testing Instructions
8048 8x51
Bytes Cycles ""Sec Bytes Cycles Be ""Sec
Instruction Instruction
Flag Control
CLR C 1 1 2.5 CLR C 1 1
CPL FO 1 1 2.5 CPL FO 2 1
Flag Testing
JNC offset 2 2 5.0 JNC rei 2 2
JFO offset 2 2 5.0 JB FO.rel 3 2
JB7 offset 2 2 5.0 JB ACC.7.rel 3 2
Peripheral POlling
JTO offset 2 2 5.0 JB TO.rel 3 2
JN1 offset 2 2 5.0 JNB INTO.tel 3 2
JTF offset 2 2 5.0 JBC TFO.rel 3 2
Machine and Peripheral Control
STRT T 1 1 2.5 SETB TRO 2 1
EN 1 1 1 2.5 . SETB EXO 2 1
DIS TCNT1 1 1 2.5 CLR ETO 2 1
Table 4b. Replacing 8048 Instruction Sequences with Single 8x51 Instructions
8048 8051
Bytes Cycles ""Sec Bytes Cycles Be ""Sec
Instruction Instruction
Flag Control
Set carry
CLR C
CPL C = 2 2 5.0 SETB C 1 1
Set Software Flag
CLR FO
CPL FO = 2 2 5.0 SETB FO 2 1
Turn Off Output Pin
ANL P1.#OFBH = 2 2 5.0 CLR P1.2 2 1
Complement Output Pin
IN AP1
XRL A#04H
OUTL P1.A = 4 6 15.0 CPL P1.2 2 1
Clear Flag in RAM
MOV RO.#FLGADR
MOV A@RO
ANL A#FLGMASK
MOV @RO.A = 6 6 15.0 CLR ·USER_FLG 2 1
10-222
AP-70
Table 4b Replacing 8048 Instruction Sequences with Single 8x51 Instructions (Continued)
8048 8x51
Bytes Cycles ,.,.Sec Bytes Cycles & ,.,.Sec
Instruction Instruction
Flag Testing:
Jump if Software Flag is 0
JFO $+4
JMP offset = 4 4 10.0 JNB FO.rel 3 2
Jump if Accumulator bit is 0
CPL A
JB7 offset
CPL A = 4 4 10.0 JNB ACC.7.rel 3 2
Peripheral Polling
Test if Input Pin is Grounded
IN A.P1
CPL A
JB3 offset = 4 5 12.5 JNB P1.3.rel 3 2
Test if Interrupt Pin is High
JN1 $+4
JMP offset = 4 4 10.0 JB INTO.rel 3 2
10-223
intJ AP-70
A steadily increasing number of data communication Different microprocessor architectures would best im-
products use encoding methods to protect the security pement this type of permutation in different ways.
of sensitive information. By law, interstate financial Most approaches would share the steps of Figure lOa:
transactions involving the Federal banking system must • Initialize the Permutation Buffer to default state
be transmitted using the Federal Information Pro- (ones or zeroes):
cessing Data Encryption Standard (DES).
• Isolate the state of a bit of a byte from the Key
Basically, the DES combines eight bytes of "plaintext" Buffer. Depending on the CPU, this might be ac-
data (in binary, ASCII, or any other format) with a 56- complished by rotating a word of the Key Buffer
bit "key", producing a 64-bit encrypted value for trans- through a carry flag or testing a bit in memory or an
mission. At the receiving end the same algorithm is accumulator against a mask byte:
applied to the incoming data using the same key, repro- • Perform a conditional jump based on the carry or
ducing the original eight byte message. The algorithm zero flag if the Permutation Buffer default state is
used for these permutations is fixed; different user-de- correct:
fined keys ensure data privacy. • Otherwise reverse the corresponding bit in the per-
mutation buffer with logical operations and mask
It is not the purpose of this note to describe the DES in bytes.
any detail. Suffice it to say that encryption/decryption
is a long, iterative process consisting of rotations, exclu- Each step above may require several instructions. The
sive -OR operations, function table look-ups, and an last three steps must be repeated for all 48 bits. Most
extensive (and quite bizarre) sequence of bit permuta- microprocessors would spend 300 to 3,000 microsec-
tion, packing, and unpacking steps. (For further details onds on each of the 16 iterations.
refer to the June 21, 1979 issue of Electronics maga-
zine.) The bit manipulation steps are included, it is ru- Notice, though, that this flow chart looks a lot like
mored, to impede a general purpose digital supercom- Figure 8. The Boolean Processor can permute bits by
puter trying to "break" the code. Any algorithm imple- simply moving them from the source to the carry to the
menting the DES with previous generation micro- destination-a total of two instructions taking four
processors would spend virtually all of its time diddling bytes and three microseconds per bit. Assume the Shift-
bits. ed Key Buffer and Permutation Buffer beth reside.in
bit-addressable RAM, with the bits of the former as-
The bit manipulation performed is typified by the Key signed symbolic name~ SKB_l, SKB_2, ... SKB_
Schedule Calculation represented in Figure 9. This step 56, and that the bytes of the latter are named PB_I,
is repeated 16 times for each key used in the course of a ... PB_8. Then working from Figure 9, the software
transmission. In essence, a seven-byte, 56-bit "Shifted for the permutation algorithm would be that of Exam-
Key Buffer" is transformed into an eight-byte, "Permu- pIela. The total routine length would be 192 bytes,
tation Buffer" without altering the shifted Key. The requiring 144 microseconds.
arrows in Figure 9 indicate a few of the translation
steps. Only six bits of each byte of the Permutation
Buffer are used; the two high-order bits of each byte are
cleared. This means only 48 of the 56 Shifted Key Buff-
er bits are used in anyone iteration.
---------------------"--------------------- --------------------"---------------------
14151111 21 2425
"" " 3334
PERMUTATION BYTE 1 PERM BYTE 2 PERM BYTE 3 PERM BYTE 4 BYTE 5 BYTE 6 PERM BYTE 7 PERM BYTE 8
203830-5
48-Bit Key KI
10-224
inter AP-70
REPEAT
FOR EACH
BIT OF
SHIFTED
KEY
BUFFER
(48 TIMES)
SET PERMUTATION (LEAVE PERMUTATION
BUFFER BIT BUFFER BIT
PC2(1) CLEARED)
203830-6
Figure 10a. Flowchart for Key Permutation Attempted with a Byte Processor
10-225
Ap·70
~
I CLEAR ACCUMULATOR
I
LOAD BIT MAPPED ONTO BIT 5 OF
PERMUTATION BYTE INTO CARRY
REPEAT'
t
,
LOAD BIT MAPPED ONTO BIT 0
OF PERMUTATION BYTE INTO CARRY
I ,
. ROTATE LEFT INTO ACC.
BUFFER
,
I
I
10-226
inter AP-70
The algorithm of Figure lOb is just slightly more effi- Example 1. DES Key Permutation Software.
cient in this time-critical application and illustrates the a.) "Brute Force" technique
synergy of an integrated byte and bit processor. The
bits needed for each byte of the Permutation Buffer are MOV C,SKB_l
assimilated by loading each bit into the carry (1 Jots.) MOV PB_l.l, C
and shifting it into the accumulator (1 Jots.). Each byte MOV C,SKB_2
is stored in RAM when completed. Forty-eight bits MOV PB_4.0,C
thus need a total of 112 instructions, some of which are MOV C,SKB_3
listed in Example lb. MOV PB_2.5,C
MOV C,SKB_4
Worst-case execution time would be 112 microseconds, MOV PB_l. 0, C
since each instruction takes a single cycle. Routine
length would also decrease, to 168 bytes. (Actually, in
the context of the complete encryption algorithm, each MOV C,SKB_55
permuted byte would be processed as soon as it is as- MOV PB_5.0,C
similated-saving memory and cutting execution time MOV C,SKB_56
by another 8 Jots.) MOV PB_7.2,C
To date, most banking terminals and other systems us- b.) Using Accumulator to Collect Bits
ing the DES have needed special boards or peripheral
controller chips just for the encryption/decryption pro- CLR A
cess, and still more hardware to form a serial bit stream MOV C,SKB_14
for transmission '(Figure l1a). An 8051 solution could RLC A
pack most of the entire system onto the one chip (Fig- MOV C,SKB_17
ure 11b). The whole DES algorithm would require less RLC A
than one-fourth of the on-chip program memory, with MOV C, SKB_ll
the remaining bytes free for operating the banking ter- RLC A
minal (or whatever) itself. MOV C,SKB_24
RLC A
Moreover, since transmission and reception of data is MOV C,SKB_l
performed through the on-board UART, the unen- RLC A
crypted data (plaintext) never even exists outside the MOV C,SKB_5
microcomputer! Naturally, this would afford a high de- RLC A
gree of security from data interception. MOV PB_l,A
MOV C,SKB_29
RLC A
MOV C,SKB_32
RLC A
MOV PB_8,A
10-227
inter AP-70
DATA
I
ENCRY· TO
PTION MODEM
CPU RAM ROM UART
UNIT
KEYBOARD
I
I
SYSTEM DATA BUS
J
203830-8
a.) Using Multi-Chip Processor Technology
~DISPL_AY----JK'--------ll~ I -
TAO
TO
KEYBOARD
•
-y
PO
8051
R.D .. MODEM
P1
I'll
203830-9
b.) Using One Single-Chip Microcomputer
Figure 11. Secure Banking Terminal Block Diagram
Design Example # 2-5oftware Figures 12a and 12b show algorithms for receiving or
transmitting a byte of data. (Another section of pro-
Serial 1/0 gram would invoke this algorithm eight times, synchro-
An exercise often imposed on beginning microcomput- nizing it with a start bit, clock signal, software delay, or
er students is to write a program simulating a UART. timer interrupt.) Data is received by testing an input
Though doing this with the 8051 Family may appear to pin, setting the carry to. the same state, shifting the
be a moot point (given that the hardware for a full carry into a data buffer, and saving the partial frame in
UART is on-chip), it is still instructive to see how it internal RAM. Data is transmitted by shifting an out-
would be done, and maintains a product line tradition. put. buffer through the carry, and generating each bit
on an output pin.
As it turns out, the 8051 microcomputers can receive or
transmit serial data via software very efficiently using A side-by-side comparison of the software for this com-
the Boolean instruction set. Since any I/O pin may be a mon "bit-banging" application with three different mi-
serial input or output, several serial links could be croprocessor architectures is shown in Table Sa and 5b.
maintained at once. The 8051 solution is more efficient than the others on
every count!
10-228
AP-70
PIN = 1
203830-10
a.) Reception
203830-11
b.) Transmission
10-229
intJ AP-70
RESUlTS:
K I"STRl:CTIO-';S 71>,;STRlTTIO:-lS 41>,;STRl'CTIO>,;S
14 BYTES 9 BYTES 7 BYTES
5b STATES 9 CYCI.F.S 4 CYCLES
19 uSEC 22.5 uSF.e. 4 uSEC
RESlILTS:
10lNSTRlJCTI0II;S K Ii'iSTRlJCTIONS 4 INSTRlJCTlONS
20 BYTES 13 BYTES 7 BYTES
72 STATES II CYCLES 5 CYCI.ES
24 uSEC 27.5 uSEC 5 uSEC
203830-30
Design Example # 3-Combinatorial Figure 13 shows TTL and' relay logic diagrams for a
Logic Equations function of the six variables U through Z. Each is a
solution of the equation.
Next we'll look at some simple uses for bit-test instruc-
tions and logical operations. (This example is also pre- Q = (Ue(V + W» + (XeV) + Z
sented in Application Note AP-69.)
Equations of this sort might be reduced using Kar-
Virtually all hardware IJesigners have solved complex naugh Maps or algebraic techniques, but that is not the
functions using combinatorial logic. While the hard- purpose of this example. As the logic complexity in-
ware involved may vary from relay logic, vacuum creases, so does the difficulty of the reduction process.
tubes, or TTL or to more esoteric technologies like flu- Even a minor change to the function equations as the
idics, in each case the goal is the same: to solve a prob- design evolves wOjlld require tedious re-reduction from
lem represented by a logical function of several Boolean scratch.
variables.
10-230
infef AP-70
v
W ----L__'''
x
}----o
y
z
203830-12
Q = (U • (V + W)) + (x. Y) + Z
a.) Using TTL
v
x y
CRI
CR2
203830-13
. b.) Using Relay Logic
Figure 13. Hardware Implementations of Boolean Functions
For the sake of comparison we will implement this to an output pin on some third port. The first two im-
function three ways, restricting the software to three plementations follow the flow-chart shown in Figure
proper subsets of the MeS·51 instruction set. We will 14. Program flow would embark on a route down a
also assume that U and V are input pins from different test-and-branch tree and leaves either the "True" or
input ports, Wand X are status bits for two peripheral "Not True" exit ASAP-as soon as the proper result
controllers, and Y and Z are software flags set up earli· has been determined. These exits then rewrite the out-
er in the program. The end result must be written put port with the result bit respectively one or zero.
10-231
AP-70
10-232
inter Ap·70
10-233
intJ AP-70
An upper-limit can be placed on the complexity of soft- Imagine the three position tum lever on the steering
ware to simulate a large number of gates by summing column as a single-pole, triple-throw toggle switch. In
the total number of inputs and outputs. The actual total its central position all contacts are open. In the up or
should be somewhat shorter, since calculations can be down positions contacts close Causing corresponding
"chained," as shown. The output of one gate is often lights in the rear of the car to blink. So far very simple.
the first input to another; bypassing the intermediate
variable to eliminate two lines of source. Two more tum signals blink in the front ofthe car, and
two others in the dashboard. All six bulbs flash when
an emergency switch is closed; A thermo-mechanical
Design Example # ~Automotlve relay (accessible under the dashboard in case it wears
Dashboard Functions out) causes the blinking.
Now let's apply these techniques to designing the soft. Applying the brake pedal turns the tail light filaments
ware for a complete controller system. This application on constantly ... unless a tum is in progress, in which
is patterned after a familiar real-world application case the blinking tail light is not affected. (Of course,
which isn't nearly as trivial as it might first appear: the front tum signals and dashboard indicators are not
automobile tum signals. affected by the brake pedal.) Table 6 summarizes these
operating modes.
10-234
inter AP-70
But we're not done yet. Each of the exterior turn signal each termination for each filament lead to extra cost
(but not the dashboard) bulbs has a second, somewhat and labor during construction, lower reliability and
dimmer filament for the parking lights. Figure 15 safety, and more costly repairs. And considering the
shows TTL circuitry which could control all six bulbs. system's present complexity, increasing its reliability or
The signals labeled "High Freq." and "Low Freq." rep- detecting failures would be quite difficult.
resent two square-wave inputs. Basically, when one of
the turn switches is closed or the emergency switch is There are two reasons for going into such painful detail
activated the low frequency signal (about 1 Hz) is gated describing this example. First, to show that the messiest
through to the appropriate dashboard indicator(s) and part of many system designs is determining what the
turn signal(s). The rear signals are also activated when controller should do. Writing the software to solve
the brake pedal is depressed provided a turn is not be- these functions will be comparatively easy. Secondly, to
ing made in the same direction. When the parking light show the many potential failure points. in the system.
switch is closed the higher frequency oscillator is gated Later we'll see how the peripheral functions and intelli-
to each front and rear turn signal, sustaining a low-in- gence built into a microcomputer (with a little creativi-
tensity background level. (This is to eliminate the need ty) can greatly reduce external interconnections and
for additional parking light filaments.) mechanical part count.
L. TURN
EMERG r---....- - - - - - L. DASH
L. FRNT
BRAKE L. REAR
R. TURN
r---....+----- R. DASH
R. FRNT
R.REAR
PARK
LO. HI.
FREO. FREO.
OSCILLATOR OSCILLATOR
203830-15
10-235
intJ AP-70
+12V
+12V
8051
LEn
FRONT
:"
Pl.S
Pl.0
RIGHT
FRONT
EMERGENCY Pl.l P1.I
SWITCH
PARKING LEn
Pl.2 DASHBOARD
LIGHTS Pl.7
Pl.3 RIGHT
TURN DASHBO.ARD
SWITCH P2.0
P1.4
LEn
REAR
P2,1
RIGHT
REAR
PU
10-236
AP-70
program structures are not needed. Only the initial "tuned" to approximately I Hz for the tum- and emer-
Boolean variable declarations need to be changed; gency-indicator blinking rate.
ASM5l automatically adjusts all addresses and symbol-
ic references to the reassigned variables. The user is Loading THO with -16 will cause an interrupt after
assured that no additional debugging or software verifi- 4.096 ms. The interrupt service routine reloads the
cation will be required. high-order byte of timer 0 for the next interval, saves
the CPU registers likely to be affected on the stack, and
then decrements SUB_DIY. Loading SUB_DIY.
with 244 initially and each time it decrements to zero
;INTERRUPT RATE SUBDIVIDER will produce a 0.999 second period for the highest-or-
SUB_DIV DATA 20H der bit.
;HIGH-FREQUENCY OSCILLATOR BIT
HI_FREQ BIT SUB_DIV,O
:LOW-FREQUENCY OSCILLATOR BIT ORG OOOBH ;TIMER 0 SERVICE VECTOR
LO_FREQ BIT SUB_DIV,7 MOV THO,#-16
PUSH PSW
ORG OOOOH PUSH ACC
JMP INIT PUSH B
DJNZ SUB_DIV,TOSERV
ORG IOOH MOV SUB_DIV,#244
;PUT TIMER 0 IN MODE I
INIT; MOV TMOD,#OOOOOOOIB The code to sample inputs, perform calculations, and
:INITIALIZE TIMER REGISTERS update outputs-the real "meat" of the signal control-
MOV TLO,#O ler algorithm-may be performed either as part of the
MOV THO,#-16 interrupt service routine or as part of a background
;SUBDIVIDE INTERRUPT RATE BY 244 program loop. The only concern is that it must b'e exe-
MOV SUB_DIV,#244 cuted at least serveral dozen times per second to pre-
:ENABLE TIMER INTERRUPTS vent parking light flickering. We will assume the for~
SETB ETO mer case, and insert the code into the timer 0 service
:GLOBALLY ENABLE ALL INTERRUPTS routine.
SETB EA
;START TIMER First, notice from the logic diagram (Figure 15) that
SETB TRO the subterm (PARK. H_FREQ), asserted when the
parking lights are to be on dimly, figures into four of
;(CONTINUE WITH BACKGROUND PROGRAM) the six output functions. Accordingly, we will first
compute that term and save it in a temporary location
;PUT TIMER 0 IN MODE I named· "DIM". The PSW contains two general purpose
;INITIALIZE TIMER REGISTERS flags: FO, which corresponds to the 8048 flag of the
same name, and PSW.1. Since the PSW has been saved
;SUBDIVIDE INTERRUPT RATE BY 244 and will be restored to its previous state after servicing
;ENABLE TIMER INTERRUPTS the interrupt, we can use either bit for temporary stor-
;GLOBALLY ENABLE ALL INTERRUPTS age.
;START TIMER
DIM BIT PSW.I ;DECLARE TEMP
Timer 0 (one of the two on-chip timer counters) re- :STORAGE FLAG
places the thermo-mechaniCal blinker relay in the dash-
board controller. During system initialization it is con- MOV C,PARK :GATE PARKING
figured as a timer in mode I by setting the least signifi- ;LIGHT SWITCH
cant bit of the timer mode register (TMOD). In this ANL HLFREQ ;WITH HIGH
configuration the low-order byte (fLO) is incremented ;FREQUENCY
every machine cycle, overflowing and incrementing the ;SIGNAL
high-order byte (THO) every 256 /Ls. Timer interrupt 0 MOV DIM,C ;AND SAVE IN
is enabled so that a hardware interrupt will occur each :TEMP. VARIABLE
time THO overflows.
An eight-bit variable in the bit-addressable RAM array This simple three-line section of code illustrates are"
will be needed to further subdivide the interrupts via markable point. The software indicates in very abstract
software. The lowest-order bit of this counter toggles terms exactly what function is being performed, inde-
very fast to modulate the parking lights: bit 7 will be
10-237
Ap·70
10-238
AP-70
MOV C,SUB_DIV.l;START WITH 50 This is where the earlier decision to address bits sym-
;PERCENT bolically throughout the program is going to payoff.
ANL C,SUB_DIV.O;MASK DOWN TO 25 This major I/O restructuring is nearly as simple to im-
;PERCENT plement as rearranging the input pins. Again, only the
ORL C,SUB_DIV.2;AND BUILD BACK TO bit declarations need to be changed.
;62 PERCENT
MOV DIM,C ;DUTY CYCLE FOR
;PARKING LIGHTS. LFRNT BIT B.O ;FRONT LEFT-TURN
;INDICATOR
R_FRNT BIT B.l ;FRONT RIGHT-TURN
Interconnections increase cost and decrease reliability. ;INDICATOR
The simple buffered pin-per-function circuit in Figure LDASH BIT B.2 ;DASHBOARD LEFT-TURN
16 is insufficient when many outputs require higher- ;INDICATOR
than-TTL drive levels. A lower-cost solution uses the R_DASH BIT B.3 ;DASHBOARD RIGHT-TURN
8051 serial port in the shift-register mode to augment ;INDICATOR
I/O. In mode 0, writing a byte to the serial port data LREAR BIT B.4 ;REAR LEFT-TURN
buffer (SBUF) causes the data to be output sequentially ;INDICATOR
through the "RXD" pin while a burst of eight clock R_REAR BIT B.5 ;REAR RIGHT-TURN
pulses is generated on the "TXD" pin. A shift register ;INDICATOR
connected to these pins (Figure 17) will load the data
byte as it is shifted out. A number of special peripheral
+ 12V
8051
203830-17
The original program to compute the functions need standard double filament bulb, but with the filaments
not change. After computing the output variables, the driven in parallel to tolerate single-element failures.
control map is transmitted to the buffered shift register
through the serial port. Even with redundancy, the lights will eventually fail.
To handle this inescapable fact current or voltage sens-
MOV SBUF,B ;LOAD BUFFER AND TRANSMIT ing circuits on each main drive wire can verify that
each bulb and its high-current driver is functioning
The Boolean Processor solution holds a number of ad- properly. Figure 18 shows one such circuit.
vantages over older methods. Fewer switches are re-
quired. Each is simpler, requiring fewer poles and lower Assume all of the lights are turned on except one: i.e.,
current contacts. The flasher relay is eliminated entire- all but one of the collectors are grounded. For the bulb
ly. Only six filaments are driven, rather than 10. The which is turned off, if there is continuity from + l2V
wiring harness is therefore simpler and less expensive-- through the bulb base and filament, the control wire, all
one conductor for each of the six lamps and each of the connectors, and the P.C. board traces, and if the tran-
five sensor switches. The fewer conductors use far few- sistor is indeed not shorted to ground, then the collec-
er connectors. The whole system is more reliable. tor will be pulled to + l2V. This turns on the base of
Q8 through the corresponding resistor, and grounds the
And since the system is much simpler it would be feasi- input pin, verifying that the bulb circuit is operational.
ble to implement redundancy and or fault detection on The continuity of each circuit can be checked by soft-
the four main turn indicators. Each could still be a ware in this ~ay.
WIRING +12V
HARNESS
1
I
®
.. ·1 (Q 1 A 17\\
Pl.6
Pl.7
P2.0
-
P2.l
P2.2
=
+5V
TO
203830-18
Figure 18
10-240
AP-70
Now turn all the bulbs on, grounding all the collectors. The complete assembled program listing is printed in
Q7 should be turned off, and the Test pin should be Appendix A. The resulting code consists of 67 program
high. However, a control wire shorted to + 12V or an statements, not counting declarations and comments,
open-circuited drive transistor would leave one of the which assemble into 150 bytes of object code. Each pass
collectors at the higher voltage even now. This too through the service routine requires (coincidently)
would turn on Q7, indicating a different type offailure. 67 /Ls plus 32 /Ls once per second for the electrical test.
Software could perform these checks once per second If executed every 4 ms as suggested this software would
by executing the routine every time the software count- typically reduce the throughput of the background pro-
er SUB_DIY is reloaded by the interrupt routine. gram by less than 2%.
10-241
AP-70
+ 5V
r-
XTAL1
It VCC RST
1.0uF
12M~Z
~
~ XTAL2
-
SERIAL \
LINK , RXD
TXD
INTO
-
INT1
ASYNCHRONANS
INTERRUPTS
RETURN 8051
LINES
\ P3.4
0 8 16 24 32 40 48 56 PO.O
P3.5
1 57 PO.1
P3.6
2 58 PO.2
'3- - I-rsg PH
--
4
8.8
SENSOR
MATRIX
60
PO.3
PO.4
"5- 61 PO.5
P2.0
P2.1 MACHINE
6 62 PO.6
P2.2 ACTUATORS
7 15 23 31 39 47. 55 63 PO,]
P2.3
I t P2.4
~
P1.0 P2.5
P1.1 P2.6
P1.2 P2.7
P1.3
P1.4
_ _ N.C.
P1.5 ALE
P1.6 PSEN _ N . C .
P1.7
)..J VSS EA
SCAN
LINES
r 203830-19
The computer's serial port is configured as a nine-bit There are several ways to implement the sensor matrix
UART, transferring data at 17,000 bytes-per-second. circuitry, all logically similar. Figure 20a shows one
The ninth bit may distinguish between address and data possibility. Each of the 64 sensors consists of a pair of
bytes. simple switch contacts in series with a diode to permit
multiple contact closures throughout the matrix.
The 8051 serial port can be configured to detect bytes
with the address bit set, automatically ignoring all oth- The scan lines from Port 1 provide eight un-encoded
ers. Pins INTO and INTI are interrupts configured.re- active-high scan signals for enabling columns of the
spectively as high-priority, falling-edge triggered and matrix. The return lines on rows where a contact is
low-priority, low-level triggered. The remaining 12 I/O closed are pulled high and read as logic ones. Open
pins output TTL-level control signals to 12 actuators. return lines are pulled to ground by one of the 40 kn
resistors and are read as zeroes. (The resistor values
must be chosen to ensure all return lines are pulled
above the 2.0V logic threshold, even in the worst-case,
10-242
intJ AP-70
10-243
inter AP-70
...
+5V
.
~
~
~~ ! +8x4K
8051
"0" "8" "56" RETURN
~~~ ~~~
......
....J- LINES
"1"
~....L-
I- -+---.....--++----....4-.-1 PO.l
~----''----+-+---------4 Pl.0
'----:-------++--------1 Pl.l
'---------,--++----------4 Pl.2
'-----------++-----'----l Pl.3
'------------++--------l Pl.4
' - - - - - - - - - - - - - + + - - - - - - - 1 Pl.5
'--------------------4I-+---------l Pl.6
' - - - - - - - - - - - - - - - - - - - - - - + - l > . . - - - - - - - - 1 Pl.7
SCAN II
LINES
203830-20
a.) Using Switch Contact/Diode Matrix
Figure 20. Sensor Matrix Implementation Methods
10·244
AP-70
+SV
+8x4K
h
-
(~,*) "0"
~
()I¥~"
l
..-
"
~
O¥Y)"S6"
RETURN
,LINES
ll- L-
f- - I ~
po.o
......., .-
~
(~,¥)
P"-
"1"
Ct;z)l +-
~
C~'¥)"S7"
1 ~
PO.l
1 -- PO.2
I
-- I I
PO.3
I I I~I I
PO.4
po.s
1+1+' PO.6
~
Q:::l)_"7"
b.-.rl
(~'~"lS"
I .........
( ~K~"63"
l - T" r - -r ~ PO.7
8x40K t;
-
Pl.0
Pl.l
Pl.2
Pl.3
Pl.4
Pl.S
Pl.6
Pl.7
.:' '
seA: ....
LINES
203830-21
b.) Using Optically-Coupled Isolators
Figure 20. Sensor Matrix Implementation Methods (Continued)
10·245
AP-70
nlnn!
8051
...>-
;:~~:;: >-
N M ... > N
>-
M
>-
_ ....... N ~ ~ ~ N N N N
I I 1 1
'--i-+_+_+-+_+_+_+_......-+-+-+-+-+-t-i--+_--<t----+_+-+_+_+_-+--+--___ po.o
'--+_+_+-+_+_+_+_-~-+-+-+-+-t-i--+_--__+-+_~+--+--+--___IPOl
'--i-+_+-+-+_+---.....-+-+-+-+-+--+----~t-t-+-+-+----i PO.2
'--t-t-t-+-t----......-t--+-+-t--+-----..-t-+-~+----i P03
~+-+-+_+-----......-+-+-+--+_------<--+_+-+_--l PO.4
G
:~::
' - - - - - - - - - - - - - - - - - - - - - ; Pl.S
~-----~--------~----~
'-----------------------'-----------'""""i PH
203830-22
c.) Using TTL Three-State Buffers
Figure 20. Sensor Matrix Implementation Methods (Continued)
10-246
AP-70
r---
, , , , , ,
rrrnrrr ntrnn
DO 01 02 03 04 05 06 07
74151
DO 01 02 03 04 05 06 07
74151
nrrnn
DO 01 02 03 04 05 0& D7
74151
C B A Y S C' B A Y S C B A Y s
1+ ~ ~
PO.O
PO.1
L ..1-.1 PO.2
I PO.3
PO.4
PO.5
PO.&
PO.7
11 11 11 11 11
~
P1.0
1 1 1 1 P1.1
~ P1.2
'--
203830-23
d.) Using TTL Data Selectors
10-247
inter Ap..70
OUTPUT SCAN
MASK TO SCAN Example 4.
LINES; ,
STORE SHIFTED Simple Combinatorial Output Variables.
MASK
;SET P2.2=(12) (23) (34) ( 45) ( 56)
MOV C,12
ANL C,23
ANL C,34
READ RETURN
LINES AND UPDATE
ANL C, 45
BIT MAPS ANL C, 56
MOV P2.2,C
10-248
inter AP-70
Example 5. Incorporating Override signal into actu- Latching Relays. A latching relay can be forced into
ator outputs. either the ON or OFF state by two corresponding input
signals, where it will remain until forced onto the oppo-
CALL INPUT_SCAN site state-analogous to a TTL Set/Reset flip-flop. The
MOV C,O relay is used as an intermediate variable for other calcu-
ORL C,l lations. In the previous example, the emergency condi-
ORL C,2 tion could be remembered and remain active until an
ORL C,3 "emergency cleared" button is pressed.
MOV FO,C
Any flag or addressable bit may represent a latching
COMPUTE FUNCTION 0 relay with a few lines of code (see Example 6).
ANL C, FO
MOV PLO,C Example 6. Simulating a latching relay.
JNB USR_FLG,NXTTST
DJNZ DLAY_COUNT,NXTTST
CLR USR_FLG
MOV DLAY_COUNT,#200
NXTTST; , ..
203830-25
10-249
inter AP-70
Serial Interface to Remote Processor. When it detects A programmed controller which simulates each Boole-
emergency conditions represented by certain input an function with a subroutine would be less efficient by
combinations (such as the earlier Emergency Override), at least an order of magnitude. Extra software is needed
the controller could shut down the machine immediate- for the simulation routines, and each step takes longer
ly andlor alert the host processor via the serial port. to execute for three reasons: several byte-wide logical
Code bytes indicating the nature of the problem could instructions are executed per user program step (rather
be transmitted to a central computer. In fact, at 17,000 than one Boolean operation): most of those instructions
bytes-per-second, the entire contents of both bit maps take longer to execute with microprocessors""performing
could be sent to the host processor for further analysis multiple off-chip accesses: and calling and returning
in less than a millisecond! If the host decides that con- from the various subroutines requires overhead for
ditions warrant, it could alert other remote processors stack operations.
in the system that a problem exists and specify which
shut-down sequence each should initiate. For more in- In fact, the speed of the Boolean Processor solution is
formation on using the serial port, consult the MCS-Sl " likely to be much faster than the system requires. The
User's Manual. CPU might use the time left over to compute feedback
parameters, collect and analyze execution statistics,
Response Timing perform system diagnostics; and so forth.
Here the Boolean processor pays off. Every instruction ;EXCLUSIVE-;OR FUNCTION IMPOSED ON CARR~
mentioned in this Note completes in one or two micro- ;USING FO IS INPUT VARIABLE."
seconds-the minimum instruction execution time for ;XOR_FO: JNB FO,XORCNT ;(nJB" FOR X-NOR)
many other microcontrollers! A ladder diagram con- .CPL C
taining a hundred rungs, with an average of four con- ;XORCNT: ••••• "•••
tacts per rung can be replaced by approximately five
hundred lines of software. A complete pass through the
entire matrix scanning routine and all computations xeH. The contents of the carry and some other bit may
would require about a millisecond: less than the time it be exchanged (switched) by using the accumulator as
takes for most relays to change state. " temporary storage. Bits can be moved into and out of
the accumulator simultaneously using the Rotate-
10-250
inter AP-70
through-carry instructions, though this would alter the Design Example 2 can be extended quite readily to 16
accumulator data. or more bits by using multi-byte input and output buff-
ers.
;EXCHANGE CARRY WITH USRFLG Many mass data storage peripherals and serial commu-
XCHBIT: RLC A nications protocols include Cyclic Redundancy (CRC)
MOV C,USR_FLG codes to verify data integrity. The function is generally
RRC A computed serially by hardware using shift registers and
MOV USR_FLG,C Exclusive-OR gates, but it can be done with software.
RLC A As each bit is received into the carry, appropriate bits
in the multi-byte data buffer are conditionally comple-
mented based on the incoming data bit. When finished,
Extended Bit Addressing. The 8051 can directly address the CRC register contents may be checked for zero by
144 general-purpose bits for all instructions in Figure ORing the two bytes in the accumulator.
3b. Similar operations may be extended to any bit any-
where on the chip with some loss of efficiency.
4.0 SUMMARY
The logical operations AND, OR, and Exclusive-OR
are performed on byte variables using six different ad- A truly unique facet of the Intel MCS-51 microcomput-
dressing modes, one of which lets the source be an im- er family design is the collection of features optimized
mediate mask, and the destination any directly address- for the one-bit operations so often desired in real-world,
able byte. Any bit may thus be set, cleared, or comple- real-time control applications. Included are 17 special
mented with a three-byte, two-cycle instruction if the .instructions, a Boolean accumulator, implicit and direct
mask has all bits but one set or cleared. addressing modes, program and mass data storage, and
many I/O options. These are the world's first single-
Byte variables, registers, and indirectly addressed RAM chip microcomputers able to efficiently manipulate, op-
may be moved to a bit addressable register (usually the erate on, and transfer either bytes or individual bits as
accumulator) in one instruction. Once transferred, the data.
bits may be tested with a conditional jump, allowing
any bit to be polled in 3 microseconds-still much fast- This Application Note has detailed the information
er than most architectures-or used for logical calcula- needed by a microcomputer system designer to make
tions. (This technique can also simulate additional bit full use of these capabilities. Five design examples were
addressing modes with byte operations.) used to contrast the solutions allowed by the 8051 and
those required by previous architectures. Depending on
Parity of bytes or bits. The parity of the current accu" the individual application, the 8051 solution will be eas-
mulator contents is always available in the PSW, from ier to design, more reliable to' implement, debug, and
whence it may be moved to the carry and further verify, use less program memory, and run up to an or-
processed. Error-correcting Hamming codes and simi- der of magnitUde faster than the same function imple-
lar applications require computing parity on groups of mented on previous digital computer architectures.
isolated bits. This can be done by conditionally comple-
menting the carry flag based on those bits or by gather- Combining byte- and bit-handling capabilities in a sin-
ing the bits into the accumulator (as shown in the DES gle microcomputer has a strong synergistic effect: the
example) and then testing the. parallel parity flag. . power of the result exceeds the power of byte- and bit-
processors laboring individually. Virtually all user ap-
Multiple byte shift and eRe codes plications will benefit in some way from this duality.
Data intensive applications will use bit addressing for
Though the 8051 serial port can accommodate eight- or test pin monitoring or program control flags: control
nine-bit data transmissions, some protocols involve applications will use byte manipulation for parallel I/O
much longer bit streams. The algorithms presented in expansion or arithmetic calculations.
10-251
1515-11 MCS-51 MACRO ASSEMBLER Vl.0
OB.JECT MODULE PLACED I.N : FO: AP70. HEX
ASSEMBLER INVOKED BY: .: Fl.aom51 ap70 ore date(328)·
(
LOC OB.J LINE SOURCE.
0000 020040
LINE
49
:10
SOURCE
ORG
L.J.MP
OOOOH
INIT
RESET VECTOR
(
51
OOOB 52 ORG OOOBH TIMER 0 SERVICE VECTOR
OOOD 7:18CFO 53 MOV THO •• -16 HIGH TIMER BYTE AD.JUSTED TO CONTROL INT RATE
OOOE CODO 54 PUSH PSW EXECUTE CODE TO SAVE ANY REGISTERS USED BELOW
0010 0.154 55 A.JMP UPDATE (CONTINUE WITH REST .OF ROUTINE)
56
0040 57 ORG 0040H
0040 758AOO 58 INIT: MOV TLO •• O ZERO LOADED INTO LOW-ORDER BYTE AND
0043 7:18CFO 59 MOV THO •• -16 -16 IN HIGH-ORDER BYTE GIVES 4 MSEC PERIOD
0046 758961 60 MOV TMOD •• OI10000IB 8-BIT AUTO RELOAD COUNTER MODE FOR TIMER 1.
61 16-BIT TIMER MODE FOR T'IMER 0 SELECTED
0049 7520F4 62 MOV SUD_DIV •• 244 SUBDIVIDE INTERRUPT RATE BY 244 FOR I HZ
004C D2A9 63 SETB ETO USE TIMER 0 OVERFLOWS TO INTERRUPT PROGRAM
004E D2AF 64 SETB EA CONFIGURE IE TO GLOBALLY ENABLE INTERRUPTS
0050 D2BC 65 SETB TRO KEEP INSTRUCTION CYCLE COUNT UNTIL OVERFLOW
0052 BOFE ·66 S.JMP S START BACKGROUND PROGRAM EXECUTION
67
68
0054 D52038 ·69 UPDATE: D.JNZ SUD_DIV.TOSERV EXECUTE SYSTEM TEST ONLY ONCE PER SECOND
0057 7520F4 70 MOV. SUB_DIV •• 244 GET VALUE FOR NEXT ONE SECOND DELAY AND
71 GO THROUGH ELECTRICAL SYSTEM TEST CODE:
..... 005A 4390EO 72 ORL Pl •• 11100000B SET CONTROL OUTPUTS HIGH »
o
ro
(J1
005D
0060
43A007
C295
73
74
ORL
CLR
P2 •• 000pOll1B
LJRNT FLOAT DRIVE COLLECTOR
l'
......
t.)
0062 20D428 ·75 .JD TO. FAULT TO SHOULD BE PULLED LOW o
0065 D295 76 SETB L_FRNT PULL COLLECTOR BACK DOWN
0067 C297 -77 CLR L_DASH REPEAT SEGUENCE FOR L __ DASH.
0069 20D421 78 .JB TO. FAULT
006C D297 79 SETB L_DASH
006E C2Al 80 CLR L_REAR L REAR.
0070 20B41A 81 .JB TO. FAULT
0073 D2Al 82 SETB L_REAR
0075 C296 83 CLR R_FRNT R_FRNT.
0077 20B413 84 .JB TO. FAULT
007A D296 85 SETB RjRNT
007C' C2AO 86 CLR R_DASH R_DASH.
007E 20B40C 87 .JB TO. FAULT
0081 D2AO 88 SETB R_DASH
00B3 C2A2 89 CLR R_REAR AND R__REAR.
00B5 20B405 90 .JB TO. FAULT
0088 D2A2 91 SETB R_REAR
9;;1
93 WITH ALL COLLECTORS GROUNDED. TO SHOULD BE HIGH
94 IF SO. CONTINUE WITH INTERRUPT ROUTINE.
95
008A 20B402 96 .JB TO. TOSERV
008D B2A3 97 FAULT_ CPL S_FAIL ELECTRICAL FAILURE PROCESSING ROUTINE
98 (TOGGLE INDICATOR ONCE PEH SECOND)
99 +1 SE.JECT
203830-27
--
LoC DB.! LINE
100
101
102
103
SOURCE
II
CONTINUE WITH INTERRUPT I'RoCESSING:
COMPUTE LOW BULB INTENSITY WHEN PARKING LIGHTS ARE ON.
II cf
OOBF A201 104 TOSERV: l'IOV C.SUB_DIV I START WITH 50 PERCENT.
0091 B200 105 ANL C.SUB_DIV 0 MASK ·DOWN TO 25· PERCENT.
0093 7202 lOb ORL C. SUB_DIV 2 BUILD BACK TO b2. 5 PERCENT.
0095 B292 107 ANL C.PARK GATE WITH PARKING LIGHT SWITCH.
0097 92DI lOB 1'I0V DII'I.i; AND SAVE IN TEMP. IIARIABLE.
109
110 21 COMPUTE AND OUTPUT LEFT~iAND DASHBOARD INDICATOR.
III
0099 A293 112 1'I0V C. L_TURN SET CARRY IF TURN
009B 7291 113 ORL C.EI'IERG OR EMERGENCY SELECTED.
009D B207 114 ANL C.Lo_FREG IF SO. GATE IN I HZ SIGNAL
009F 9297 115 1'I0V L_DASH. C AND OUTPUT TO DASHBOARD.
lib
117 31 COMPUTE AND OUTPUT LEFT-HAND FRONT TURN SIGNAL.
liB
OOAI 92D5 119 l'IOV FO.C SAllE FUNCTION SO FAR.
00A3 72DI 120 ORL C.DII'I ADD IN PARKING LIGHT FUNCTION
00A5 9295 121 l'IOV L_FRNT. C ; AND OUTPUT TO TURN .SIGNAL.
122
..... 123 41 COMPUTE AND OUTPUT LEFT-liAND REAR TURN SIGNAL. :.
9 124 'U
•
....
I\)
....
U1
00A7
00A9
OOAB
A2'10
BO'13
72D5
125
126
127
1'I0V
ANL
oRL
C.BRAKE
C./L_TURN
C.FO
GATE BRAKE PEDAL SWITCH
WITH TURN LEVER.
INCLUDE TEMP. VARIABLE FROM DASH
II e
OOAD 72DI 12B ORL C.DII'I AND PARKING LIGHT FUNCTION
OOAF 92AI 129 1'I0V L_REAR. C AND OUTPUT TO TURN SIGNAL.
130
131 51 REPEAT ·ALL OF ABOIIE FOR IUGHT-HAND COUNTERPARTS.
132
0081 A294 133 MOil C:R_TURN SET CARRY IF ·TURN
00B3 7291 134 ORL C"-EI'IERG OR EMERGENCY SELECTED.
00B5 8207 135 ANL C. LO_FREG IF SO; GATE IN I HZ SIGNAL
00B7 92AO 13b MOil R_DASH. C AND OUTPUT TO DASHBOARD.
00B9 92D5 137 MOil FO.C SAVE FUNCTION SO FAR.
OOBB 72Dl 13B ORL C.DII'I ADD IN PARKING LIGHT FUNCTION
OOBD 929b 139 1'I0V R_FRNT. C AND OUTPUT TO TURN SIGNAL.
OOBF A290 140 l'IOV C.BRAKE GATE BRAKE PEDAL SWITCH
OOCI B094 141 ANL C./R_TURN WITH TURN LEVER.
00C3 72D5 142 oRL C.FO INCLUDE TEMP. VARIABLE FROM DASI!
DOCS 72Dl 143 ORL C.DII'I AND PARKING LIGHT FUNCTION
·00C7 92A2 144 1'I0V· R_REAR. C AND OUTPUT TO TURN SIGNAL.
145
14b RESTOR·E STATUS REGISTER AND RETURN.
147
00C9 DODO 14B POP PSW RESTORE PSW
OOCB 32 149 RETI ; AND RETURN FROM INTERRUPT ROUTINE
150
!51 END
203830-28
_.
XREF SYMBOL TABLE LISTING
<?
R_DASH ..
R_FRNT
N
N
BSEG
BSEG
OOAOH
0096H
3311 B6 BB 136
3111 B3 B5 139
»
"tI
I\)
R_REAR N BSEG OOA2H 3511 B9 91 144 •
.....
01
01 R_TURN
S_FAIL.
N
N
BSEG
BSEG
0094H
00A3H
2411 133 141
3711 97
I I C
November 1986
Designing Mi,crocontroller
Systems for Electrically
Noisy Environments
TOM WILLIAMSON
MCO APPLICATIONS ENGINEER
Digital circuits are often thought of as being immune to Types and Sources of Electrical Noise
noise problems, but really they're not. Noises in digital
systems produce software upsets: program jumps to ap- The name given to electrical noises other than those
parently random locations in memory. Noise-induced that are inherent in the circuit components (such as
glitches in the signal lines can cause such problems, but thermal noise) is EMI: electromagnetic interference.
the supply voltage is more sensitive to glitches than the Motors, power switches, fluorescent lights, electrostatic
signal lines. discharges, etc., are sources of EM!. There is a veritable
alphabet soup of EMI types, and these are briefly de-
Severe noise conditions, those involving electrostatic scribed below.
discharges, or as found in automotive environments,
can do permanent damage to the hardware. Electrostat-
ic discharges can blow a crater in the silicon. In the SUPPLY LINE TRANSIENTS
automotive environment, in ordinary operation, the
Anything that switches heavy current loads onto or off
"12V" power line can shown + and -400V transients.
of AC or DC power lines will cause large transients in
This Application Note describes some electrical noises these power lines. Switching an electric typewriter on
or off, for example, can put a 1000Y spike onto the AC
and noise environments. Design considerations, along
the lines of PCB layout, power supply distribution and power lines.
decoupling, and shielding and grounding techniques,
The basic mechanism behind supply line transients is
that may help minimize noise susceptibility are re-
shown in Figure I. The battery represents any power
viewed. Special attention is given to the automotive and
source, AC or DC. The coils represent the line induc-
ESD environments.
tance between the power source and the switchable
loads Rl and R2. If both loads are drawing current, the
line current flowing through the line inductance estab-
Symptoms of Noise Problems lishes a magnetic field of some value. Then, when one
Noise problems are not usually encountered during the of the loads is switched off, the field due to that compo-
development phase of a microcontroller system. This is nent of the line current collapses, generating transient
because benches rarely simulate the system's intended voltages, v = L(dildt), which try to maintain the cur-
environment. Noise problems tend not to show up until rent at its original level. That's called an "inductive
the system is installed and operating in its intended en- kick." Because of contact bounce, transients are gener-
vironment. Then, after a few minutes or hours of nor- ated whether the switch is being opened or closed, but
mal operation the system finds itself someplace out in they're worse when the switch is being opened.
left field. Inputs are ignored and outputs are gibberish.
The system may respond to a reset, or it may have to be An inductive kick of one type or another is involved in
turned off physically and then back on again, at which most line transients, including those found in the auto-
point it commences operating as though nothing had motive environment. Other mechanisms for line tran-
happened. There may be an obvious cause, such as an sients exist, involving noise pickup on the lines. The
electrostatic discharge from somebody's finger to a key- noise voltages are then conducted to a susceptible cir-
board or the upset occurs every time a copier machine cuit right along with the power.
is turned on or off. Or there may be no obvious cause,
and nothing the operator can do will make the upset EMP AND RFI
repeat itself. But a few minutes, or a few hours, or a few
days later it happens again. Anything that produces arcs or sparks will radiate elec-
tromagnetic pulses (EMP) or radio-frequency interfer-
One symptom of electrical noise problems is random- ence (RFI).
ness, both in the occurrence of the problem and in what
the system does in its failure. All operational upsets
that occur at seemingly random intervals are not neces- L
sarily caused by noise in the system. Marginal VCC,
inadequate decoupling, rarely encountered software
conditions, or timing coincidences can produce upsets
that seem to occur randomly. On the other hand, some v -
noise sources can produce upsets downright periodical- Rl R2
ly. Nevertheless, the more difficult it is to characterize
an upset as to cause and effect, the more likely it is to
be a noise problem. 210313-1
10-257
inter AP-125
Spark discharges have probably caused more software the classical "ground loop." By extension, the term is
upsets in digital equipment than any other single noise used to refer to any unwanted (and often unexpected)
source. The upsetting mechanism is the EMP produced currents in a ground line.
by the spark. The EMP induces transients in the cir-
cuit, which are what actually cause the upset.
"Radiated" and "Conducted" Noise
Arcs and sparks occur in automotive ignition systems,
electric motors, switches, static discharges, etc. Electric Radiated noise is noise that arrives at the victim circuit
motors that have commutator bars produce an arc as in the form of electromagnetic radiation, such as EMP
the brushes pass from one bar to the next. DC motors and RFI. It causes trouble by inducing extraneous volt-
and the "universal" (AC/DC) motors that are used to ages in the circuit. Conducted noise is noise that arrives
power hand tools are the kinds that have commutator at the victim circuit already in the form of an extrane-
bars. In switches, the same inductive kick that puts ous voltage, typically via the AC or DC power lines.
transients on the supply lines will cause an opening or
closing switch to throw a spark. One defends against radiated noise by care in designing
layouts and the use of effective shielding techniques.
One defends against conducted noise with filters and
ESD
GROUND NOISE
Vert: 5 Amps/DiY
Currents in ground lines are another source of noise. Time: 5 nSec/Diy
These can be 60 Hz currents from the power lines, or Displayed:
RF hash, or crosstalk from other signals that are shar- Ip: 40 Amps
Tr: 1 nSec
ing this particular wire as a signal return line. Noise in 500V
the ground lines is often referred to as a "ground loop" ,
problem. The basic concept of the ground loop is
shown in Figure 3. The problem is that true
earth-ground is not really at the same potential in all 210313-3
locations. If the two ends of a wire are earth-grounded (b)
at different locations, the voltage difference between the
two "ground" points can drive significant currents (sev- Figure 2. Waveforms of Electrostatic
eral amperes) through the wire. Consider the wire to be Discharge Currents From a
part of a loop which contains, in addition to the wire, a Hand-Held Metallic Object
voltage source that represents the difference in poten-
tial between the two ground points, and you have
10-258
AP-125
suppressors, although layouts and grounding tech- of the program to'some random location in memory.
niques.are important here, too. The person who has to iron out such problems is tempt-
ed to say the program counter went crazy. There is
usually no damage to the hardware, and normal opera-
Simulating the Environment tion can resume as soon as the EM! has passed or the
source is de-activated. Resuming normal operation usu-
Addressing noise problems after the design of a system ally requires manual or automatic reset, and possibly
has been completed is an expensive proposition. The ill re-entering of lost information.
will generated by failures in the field is not cheap either.
It's cheaper in the long run to invest a little time and Electrostatic discharges from operating personnel can
money in learning about noise and noise simulation cause not only software upsets, .but also permanent
equipment, so that controlled tests can be made on the ("hard") damage to the system. For this to happen the
bench as the design is developing. system doesn't even have to be in operation. Sometimes
the permanent damage is latent, meaning the initial
Simulating the intended noise environment is a two- damage may be marginal and require further aggrava-
step process: First you have to recognize what the noise tion through operating stress and time before perma-
environment is, that is, you have to know what kinds of nent failure takes place. Sometimes too the damage is
electrical noises are present, and which of them are go- . hidden.
ing to cause trouble. Don't ignore this first step, be-
cause it's important. If you invest in an induction coil One ESD-related failure mechanism that has been iden-
spark generator just because your application is auto- tified has to do with the bias voltage on the substrate of
motive, you'll be straining at the gnat and swallowing the chip. On some CPU chips the substrate is held at
the camel. Spark plug noise is the least of your worries - 2.5V by a phase-shift oscillator working into a capac-
in that environment. itor/diode clamping circuit. This is called a "charge
pump" in chip-design circles. If the substrate wanders
The second step is to generate the electrical noise in a too far in either direction, program read errors are not-
controlled manner. This is usually more difficult than ed. Some designs have been known to allow electrostat-
first imagined; one first imagines' the simulation in ic discharge currents to flow directly into port pins of
terms of a waveform generator and a few spare parts, an 8048. The resulting damage to the oxide causes an
and then finds that a wideband power amplifier with a increase in leakage current, which loads down the
200V dynamic range is als!, required. A good source of charge pump, reducing the substrate voltage to a mar-
information on who supplies what noise-simulating ginal or unacceptable level. The system is then unreli-
equipment is the 1981 "ITEM" Directory and Design able or completely inoperative until the CPU chip is
Guide (Reference 6). replaced. But if the CPU chip was subjected to a dis-
charge ~park once, it will eventually happen again.
Types of Failures and Failure Chips that have a grounded substrate, such as the 8748,
Mechanisms can sometimes sustain some oxide damage without ac-
tually becoming inoperative. In this case the damage is
A major problem that EMI can cause in digital systems present, and the increased leakage current is noted;
is intermittent operational malfunction. These software however, since the substrate voltage retains its design
upsets occur when the system is in operation at the time value, the damage is largely hidden.
an EMI source is activated, and are' usually character-
ized by a loss of information or a jump in the execution
EARTH-GROUND
ATB
\.POTENTIAL DIFFERENCE
BETWEEN A AND B
-GROUND LOOP"
210313-4
10-259
intJ AP-125
It must therefore, be recognized that connecting port to minimize the generation of noise voltages in the cir-
pins unprotected to a keyboard or to anything else that cuit. These methods involve grounding, shielding, and
is subject to electrostatic discharges, makes an extreme- wiring techniques that are directed toward the mecha-
lydangerous configuration. It doesn't make any differ- nisms by which noise voltages are generated in the cir-
ence what CPU chip is being used, or who makes it. If cuit. We'll also discuss methods of decoupling. Then
it connects unprotected to a keyboard, it will eventually we'll look at some schemes for making a graceful recov-
be destroyed. Designing for an ESD-environment will ery from upsets that occur in spite of preventive mea-
be discussed further on. sures. Lastly, we'll take another look at two special
problem areas: electrostatic discharges and the automo-
We might note .here that MOS chips are not the only tive environment. '
components that are susceptible to permanent, ESD
damage. Bipolar and linear chips can also be damaged
in this way. PN junctions are subject to a hard failure Current Loops
mechanism called thermal secondary breakdown, in
which a current spike, such as from an electrostatic The first thing most people learn about electricity is
discharge, causes microscopically localized spots in the that current won't flow unless it can flow in a closed
junction to approach melt temperatures. Low power loop. This simple fact is sometimes temporarily forgot-
TIL chips are subject to this tyPe of damage, as are ten by the ,overworked engineer who has spent the past
op-arnps. Op-amps, in addition, often carry on-chip several years mastering the intricacies of the DO loop,
MOS capacitors which are directly across an external the timing loop, the feedback loop, and maybe even the
pin combination, and these are susceptible to dielectric ground loop. The simple current loop probably owes its
breakdown. apparent demise to the invention of the ground symbol.
By a stroke, of the pen one avoids, having to draw the
We return now to the subject of software upsets. Noise return paths of most of the current loops in the circuit.
transients can upset the chip through any pin, even an Then "ground" turns into an infinite current sink, so
output pin, because every pin on the chip connects to that any current that flows into it is gone and forgotten.
the substrate through apnjunction. However, the most Forgotten it may be, but it's not gone. It must return to
vulnerable pin is probably ,the VCe line, since it has its source, SO that its path will by all the laws of nature
direct access to all parts of the chip: every register, gate, form a closed loop.
flip-flop lind buffer. .
The physical geometry of a given current loop is the
The, menu of possible upset mechanisms is quite key to why it generates EMI, why it's susceptible to
lengthy. A transient on the ,substrate at the wrong time EMI, and how to shield it. Specifically, it's the area of
will generally cause a program read error. A false level the loop that matters.
at a control input can cause an extraneous or misdirect-
ed opcode fetch. A disturbance on the supply line can Any flow of current generates a magnetic field whose
flip a bit in the program counter or instruction register. intensity varies inversely to the distance from the wire
A short interruption or reversal of polarity 'on the sup- that carries the current. Two parallel wires conducting
ply line can actually turn the processor off, but not long currents + I and - I (as in signal feed and return lines)
enough for the power-up reset capacitor to discharge. would generate a nonzero magnetic field near the wires,
Thus when the transient ends, the chip starts up again where the distance from a given point to one wire is
without 'Ii reset. '. noticeably different from the distance to the other wire,
but farther away (relative to the wire spacing), where
A common failure mode is for the processor to lock the distances from a given point to either wire are about
itself into a tight loop. Here it may be executing the the saine, the fields from both wires tend to cancel out.
data in a table, or' the program counter may have Thus, maintaining proximity between feed and return
jumped a notch, so that the processor is now executing paths is an important way to minimize their interfer-
operands instead of opcodes, or it may be. trying to ence with other signals. The way to maintain their
fetch opcodes from a nonexistent external program proximity is essentially to minimize their loop area.
memory. And, because the mutual inductance from current loop
It should be emphasized that mechanisms for upsets A to current loop B is the same as the mutualinduc-
have to do with the arrival of noise-induced transients timce from current loop B to current loop A, a circuit
at the pins of the chips, rather than with the generation that doesn't radiate interference doesn't receive it ei-
of noise pulses within the chip itself, that is, it's not the ther.
chip that is picking up noise, it's the circuit.
Thus, from the standpoint of reducing both generation
of EMI and susceptibility to EMI, the hard rule is to
The Game Plan keep loop areas small. To say that loop areas should be
minimized is the same as saying the circuit inductance
Prevention is usually cheaper than suppression, so first
we'll consider some preventive methods that might help
10-260
inter AP-125
should be minimized. Inductance is by definition the Another application of the Faraday shield is in the elec-
constant of proportionality between current and the trostatically shielded transformer. Here, a conducting
magnetic field it produces: <P. = LI. Holding the feed foil is laid between the primary and secondary coils so
and return wires close together so as to promote field as to intercept the capacitive coupling between them. If
cancellation can be described either as minimizing the a system is being upset by AC line transients, this type
loop area or as minimizing L. It's the same thing. . of transformer may provide the fix. To be effective in
this application, the shield must be connected to· the
greenwire ground.
Shielding
There are three basic kinds of shields: shielding against SHIELDING AGAINST INDUCTIVE COUPLING
capacitive coupling, shielding against inductive cou-
pling, and RF shielding. Capacitive coupling is electric With inductive coupling, the physical mechanism in-
field coupling, so shielding against it amounts to shield- volved is a magnetic flux density B from some external
ing against electric fields. As will be seen, this is rela- interference source that links with a current loop in the
tively easy. Inductive coupling is magnetic field cou- victim circuit, and generates a voltage in the loop in
pling, so shielding against it is shielding against mag- accordance·with Lenz's law: v = -NA(dB/dt), where
netic fields. This is a little more difficult. Strangely in this case N = 1 and A is the area of the current loop
enough, this type of shielding does not in genc:ral in- in the victiin circuit.
volve the use of magnetic materials. RF shielding, the
classical "metallic barrier" against all sorts of electro- There are two aspects to defending a circuit against
magnetic fields, is what most people picture when they inductive pickup. One aspect is to try to minimize the
think about shielding. Its effectiveness depends partly offensive fields at their source. This is done by minimiz-
on the selection of the shielding material, but mostly, as ing the area of the current loop at the source so as to
it turns out, on the treatment of its seams and the ge- promote field· cancellation, as described in the section
ometry of its openirigs. on current loops. The other aspect is to minimize the
inductive pickup in the victim circuit by minimizing the
area of that current loop, since, from Lenz's law, the
SHIELDING AGAINST CAPACITIVE COUPLING induced voltage is proportional to this area. So the two
aspects really involve the same corrective action: mini-
Capacitive coupling involves the passage of interfering mize the areas of the current loops. In other words,
signals through mutual or stray capacitances that aren't minimizing the offensiveness of a circuit inherently
shown on the circuit diagram, but which the experi- minimizes its susceptibility.
enced engineer knows are there. Capacitive coupling to
one's body is what would cause an unstable oscillator to
change its frequency when the person reaches his hand
over the circuit, for example. More importantly, in a c.
digital system it causes crosstalk in multi-wire cables. NOISE
SOURCE ----11--- VICTIM
CKT
10-261
inter Ap·125
v. v.
I I------~---------
I -I
210313-7
Figure 6b shows the situation when the cable is ground- The Twisted Pair-A cheaper way to minimize loop
ed at both ends. Does the shield carry all of the return area is to run the feed and return' wires right next to
current, or only a portion of it on account of the shunt- each other. This isn't as effective as a coaxial cable in
ing effect of the common ground connection? The an- minimizing loop area. An ideal coaxial cable adds zero
swer to that question depends on the frequency content area to the loop, whereas merely keeping the feed and
of the signal. In general, the current loop will follow the return wires next to each other is bound to add a finite
path of least impedance. At low frequencies, 0 Hz to area.
several kHz, where the inductive reactance is insignifi-
cant, the current will follow the path of least resistance. However, two things work to make this cheaper meth-
Above a few kHz, where inductive reactance predomi- od almost as good as a coaxial cable. First, real coaxial
nates, the current will follow the path of least induc- cables are not ideal. If the shield current isn't evenly
tance. The path of least inductance is the path of distributed around the center conductor at every cross-
10-262
AP-125
POTENTIAL DIFFERENCE
BETWEEN THE TWO
GROUND POINTS
v.
r---~..., J f--"\
I
_____ J I
I
I
I
I
I
--_/
210313-11
(b) Breaking the Ground Loop
Figure 7. Use of Optical Coupler
section of the cable (it isn't), then field cancellation ex- Thus, if the feed path for a given signal zigzags its way
ternal to the shield is incomplete. If field cancellation is across the PCB, the return path for this signal is free to
incomplete, then the effective area added to the loop by zigzag right along beneath it on the ground plarie, in
the cable isn't zero. Second, in the cheaper method the such a configuration as to minimize the energy stored
feed and return wires can be twisted together. This not in the magnetic field produced by this current loop.
only maintains their proximity, but the noise picked up Minimal magnetic flux means minimal effective loop
in one twist tends to cancel out the noise picked up in area and minimal susceptibility to inductive coupling.
the next twist down the line. Thus the "twisted pair"
turns out to be about as good a shield against inductive The Gridded-Ground PCB Layout-The next best
coupling as coaxial cable is. thing to a ground plane is to layout the ground traces
on a PCB in the form of a grid structure, as shown in
The twisted pair does not, however, provide electrostat- Figure 8. Laying horizontal traces on one side of the
ic shielding (Le., shielding against capacitive coupling). board and vertical traces on the other side allows the
Another operational difference between them is that passage of signal and power traces. Wherever vertical
the coaxial cable works better at higher frequencies. and horizontal ground traces cross, they must be con-
This is primarily because the twisted pair adds more nected by a feed-through.
capacitive loading to the signal source than the coaxial
cable does. The twisted pair is normally considered use- Have we not created here a network of "ground loops"?
ful up to only about 1 MHz, as opposed to near a GHz Yes, in the literal sense of the word, but loops in the
for the coaxial cable. ground layout on a PCB are not to be feared. Such
inoffensive little loops have never caused as much noise
The Ground Plane-The best way to minimize loop pickup as their avoidance has. Trying to avoid innocent
areas when many current loops are involved is to use a little loops in the ground layout, PCB designers have
ground plane. A ground plane is a conducting surface forced current loops into geometries that could swallow
that is to serve as a return conductor for all the current a whale. That is exactly the wrong thing to do.
loops in the circuit. Normally, it would be one or more
layers of a multilayer PCB. All ground points in the The gridded ground structure works almost as well as
circuit go not to a grounded trace on the PCB, but the ground plane, as far as minimizing loop area is con-
directly to the ground plane. This leaves each current cerned. For a given' current loop, the primary return
loop in the circuit free to complete itself in whatever path may have to zig once in a while where its feed path
configuration yields minimum loop area (for frequen- zags, but you still get a mathematically optimal dis-
cies wherein the ground path impedance is primarily
inductive).
10-263
inter AP-125
The near field goes out about 1/6 of a wavelength from The first expression indicates that E-field shielding is
the .source. At I MHz this is about 150 feet, and at 10 more effective if the shield material is highly conduc-
MHz it's about 15 feet. That means if an EMI source is tive, and less effective if the shield if ferromagnetic, and
in the same room with the victim circuit, it's likely to that low-frequency fields are easier to block than high-
be a near field problem. The reason this matters is that frequency fields. This is shown in Figure 9.
in the near field an RF interference problem could be
almost entirely due to E-field coupling or H-field cou- m 150
~
pling, and that could influence the choice of an RF II: 125
iii
shield or whether an RF shield will help at all. U>
0 100
.J
Z 75
In the near field of a whip antenna, the E/H ratio is 0
;::. 50
higher than 3770, which means it's mainly an E-field ...
U 25
generator. A wire-wrap post can be a whip antenna.
Interference from a whip antenna would be by electric
..
.J
10-264
inter AP·125
175.-----------r-------r-r-------~
300,-----------------------------~
150 !
'" 250
PLANE WAVE
III
!
'111
~
200 .
150 .,,
,
,,
I
,"
Cl
z
9 100 ----""'-
REFLECTION ----I--
%
III
,,
~ 50 ,.'
25 I!
f:! "
_-----ABSORPTION
O+----.----~-~-~-~--;-~---_.----_r--~
0.01 0.1 1.0 10 100 1000 10.000
10 10' 10 1 10~ 10$ 10' 10' .FREQUENCY (KILOHERTZ)
FREQUENCY (HERTZ) 210313-15
210313-14
Copper and aluminum both have the same permeabili- rents must be allowed to flow freely. If they have to
ty, but copper is slightly more conductive, and so pro- detour around slots and holes, as shown in Figure 12,
vides slightly greater reflection loss to an E-field. Steel the shield loses much of its effectiveness.
is less effective for two reasons. First, it has a somewhat
elevated permeability due to its iron content, and sec- As can be seen in Figure 12, the severity of the detour
ond, as tends to be the case with magnetic materials, it has less to do with the area of the hole than it does with
is less conductive. the geometry of the hole. Comparing Figure 12c with
12d shows that a long narrow discontinuity such as a
On the other hand, according to the expression for ab~ seam can cause more RF leakage than a line of holes
sorption loss to an H-field, H-field shielding is more with larger total area. A person who is responsible for
effective at higher frequencies and with shield material designing or selecting rack or chassis enclosures for an
that has both high conductivity and high permeability. EMI environment needs to be familiar with the tech-
In practice, however, selecting steel for its high perme- niques that are available for maintaining electrical con-
ability involves some compromise in conductivity. But tinuity across seams. Information on these techniques is
the increase in permeability more than makes up for the available in the references.
decrease in conductivity, as can be seen in Figure 10.
This figure also shows the effect of shield thickness.
Grounds
A composite of E-field and H-field shielding is shown
in Figure 11. However, this type of data is meaningful There are two kinds of grounds: earth-ground and sig-
only in the far field. In the near field the EMI could be nal ground. The earth is not an equipotential surface, so
90% H-fie1d, in which case the reflection loss is irrele- earth ground potential varies. That and its other electri-
vant. It would be advisable then to beef up the absorp- cal properties are not conducive to its use as a return
tion loss, at the expense of reflection loss, by choosing 'conductor in a circuit. However, circuits are often con-
steel. A better conductor than steel might be less expen- nected to earth ground for protection against shock
sive, but quite ineffective. hazards. The other kind of ground, signal ground, is an
arbitrarily selected reference node in a circuit-the
A different shielding mechanism that can be taken ad- node with respect to which other node voltages in the
vantage of for low frequency magnetic fields is the abili- circuit are measured.
ty of a high permeability material such as. mumetal to
divert the field by presenting a very low reluctance path
SAFETY GROUND
to the magnetic flux. Above a few kHz, however, the
permeability of such materials is the same as steel. The standard 3-wire single-phase AC power distribu-
tion system is represented in Figure 13: The white wire
In actual fact the selection of a shielding material turns is earth-grounded at the service entrance. If a load cir-
out to be less important than the presence of seams, cuit has a metal enclosure or chassis, and if the black
joints and holes in the physical structure of the enclo- wire develops a short to the enclosure, there will be a
sure. The shielding mechanisms are related to the in- shock hazard to operating personnel, unless the enclo-
duction of currents in the shield material, but the cur- sure itself is earth-grounded. If the enclosure is earth-
10-265
intJ AP-125
~~1
__ INDUCED _ - RECT:LNO;ULAR
SHIELD
CURRENTS·
--SECTION OF
SHIELD
(-) (b)
(e) (d)
210313-16
10-266
inter AP-125
BRAIDED CABLE
REF. POINT Ground impedance problems can be virtually eliminat-
210313-20 ed by using braided cable. The reduction in impedance
Multipoint Connection is due to skin effect: At higher frequencies the current
tends to flow along the surface of a conductor rather
Figure 14. Three Ways to Wire the Grounds
10-267
intJ AP-125
------------------------1
1 t( t( t( ~~_~M i
I 1
9 "WRITE" CIRCUITS
.
SIGNAL GROUNOS"
t
GREEN-WIRE
GROUND
210313-22
CONTROL FUNCTIONS
CONTROLLER
I----.....--~~
'----~--~~----GROUND
210313-23
10-268
AP-125
RACK 1 RACK 2
Figure 18_ Electronic Circuits Mounted in Equipment Racks Should Have Separate Ground
Connections_ Rack 1 Shows Correct Grounding, Rack 2 Shows Incorrect Grounding_
than uniformly threugh its bulk_ While this effect tends higher frequency cemponents .of EMI. This is illustrat-
to increase the impedance of a given conductor, it also ed in Figure 19b, which shows the capacitor supplying
indicates the way to minimize impedance, and that is to the current spike, during which VCC drops from 5V by
manipulate the shape of the cress-sectien se as te pre- the amount indicated in the figure. Between current
vide mere surface area. Fer its bulk, braided cable is spikes the capacitor recovers through the line imped-
almost pure surface. ance.
10-269
intJ AP-125
Vcc:
--------~-----------------. t
210313-25 210313-26
(a) Drawing Current Spikes (b) Drawing Current Spikes
through the Line Impedance from a Decoupllng Capacitor
Figure 19. What a Decoupling Capacitor Does
and will serve only to increase the cost of the board. ably so that each power trace is on the direct opposite
Good and bad placement of decoupling capacitors are side of the board from a ground trace.
illustrated in Figure 20.
Special-purpose power supply distribution buses which
Power distribution traces on the PC board need to be mount on the PCB are available. The buses use a paral-
laid out so as to obtain minimal area (miilimal induc- lel flat conductor configuration, one conductor being a
tance) in the loops formed by each chip and its decou- VCC line and the other a ground line. Used in conjunc-
pier, and by the chip decouplers and the board decou- tion with a gridded ground layout, they not only pro-
pier. One way to accomplish this goal is to use a power vide a' low-inductance distribution system, but can
plane. A power plane is the same as a ground plane, but themselves form part of the ground grid, thus facilitat-
at VCC potential. More economically, a power grid ing. the PCB layout. The buses are available with and
similar to the ground grid previously discussed (Figure without enhanced bus capacitance, under the names
8) can be used. Actually, if the chip decoupling loops MinilBus® and Q/PAC® from Rogers Corp. (5750 E.
are small, other aspects of the power layout are less . McKellips, Mesa, AZ 85205).
critical. In other words, power planes and power grid-
ding aren't needed, but power traces should be laid in .
the closest possible proximity to ground traces, prefer- SELECTING THE VALUE OF THE
DECOUPLING CAP
There must be a very low Inductance between decoupling capacitor
and the IC. The effectiveness of the decoupling cap has a lot to do
with the way the power and ground traces connect this
Poo,PI.cemen, ~I capacitor to the chip. In fact; the area formed by this
loop is more important than the value of the capaci-
~vcc
tance. Then, given that the area of this loop is indeed
miilimal, it can generally be said that the larger the
Better Pllleement value of the decoupling cap, the more effective it is, if
the cap has a mica, ceramic, glass, or polystyrene di-
electric.
. 210313-27 It's often said, and not altogether accurately, that the
The decreased area of loop between capacitor & IC decreases
, inductance. chip decoupler shouldn't have too large a value. There
are two reasons for this statement. One is that some
.Figure 20. Placement of Decoupllng Capacitors capacitors, because of the nature of their dielectrics,
tend to become inductive or lossy at higher frequencies.
This is true of electrolytic capacitors, but mica, glass,
10-270
inter AP-125
ceramic, and polystyrene dielectrics work well to sever- CPU chip and the PCB (or between the CPU socket
al hundred MHz. The other reason cited for not using and the PCB), it makes connection to pins 40 and 20,
too large a capacitance has to do with lead inductance. forming a leadless decoupling capacitor. It is obviously
a configuration of minimal inductance. Unfortunately,
The capacitor with its lead inductance forms a series the particular sample tested had only 0.07 J.tF of capac-
LC circuit. Below the frequency of series resonance, the itance and so was unable to prevent the 1 MHz ripple
net impedance of the combination is capacitive. Above as effectively as the configuration of Figure 21 d. It
that frequency, the net impedance is inductive. Thus a seems apparent, though, that with more capacitance
decoupling capacitor is capacitive only below the fre- this part will alleviate a lot of decoupling problems.
quency of series resonance. The frequency is given by
Figure 21 shows VCC waveforms, measured between Recovering Gracefully from a Software
pins 40 and 20 (VCC and VSS) of an 8751 CPU, for Upset .
several conditions of decoupling on a PC board that has·
a decoupling loop area slightly larger ihim necessary. Even when one follows all the best guidelines for de-
These photographs show the effects of increasing the signing for a noisy environment, it's always possible for
decoupling capacitance and decreasing the area of. the a noise transient to occur which exceeds the circuit's
decoupling loop. The indications are that a 1 J.tF capac- immunity level. In that case, one can strive at least for a
itor is better than a 0.1 J.tF capacitor,which in turn is graceful recovery.
better than nothing, and that the board should have
been laid out with more attention paid to the ·area of the Graceful recovery schemes involve additional hardware
decoupling loop. and/or software which is supposed to return the system
to a normal operating mode after a software upset has
Figure 21e was obtained using a special-purpose experi- occurred. Two decisions have to be made: How to rec-
mental capacitor designed by Rogers Corp. (Q-Pac Di- ognize when an upset has occurred, and what to do
vision, Mesa, AZ) for use as a decoupler. It consists of about it.
two parallel plates, the length of a 40-pin DIP, separat-
ed by a ceramic dielectric. Sandwiched between the
10-271
inter AP-125
PIN 40
PIN 40
. . . ALE
5CtrV 5V L _ "__
210313-28
(a) No Decoupllng Cap
PIN 40
5CmV 5V 501r.V 5V .
~ -~.
210313-'30 210313:'31 '
(c) 0.1 p.F Decoupler Stretched Directly' (d) 1.0 p.F Decoupler Stretched Directly
from Pin 40 to Pin 20, under the Socket. from Pin 40 to pin 20, under the Socket.
(The difference between this and 21b is (This prevents the 1 MHz,rlpple, but there's
due only to the change in loop geometry. no reduction In higher frequency components.
Also shown is the upward slope of a ripple Further Increases In capacitance
in VCC. The ripple frequency Is effected no further Improvement.)
1 MHz, the same as ALE.)
PIN 40
ALE
*' SV
210313-32
(e) Special-Purpose Decoupling Cap
under Development by Rogers Corp.
(Further discussion in text.)
Figure 21. Noise on VCC Line
10-272
inter AP-125
I
L t -f-· - .- - -.: ~ -~
I 1 • i
, I'
r-- -.. -T T .
r I ,
SPARK PROBE 50mV (TRIGGER)
Vee 500mV
210313-33
If the designer knows what kinds and combinations of NOPs and JMPs. It's still possible, of course, to get
outputs can legally be generated by the system, he can hung up in a data table or something. But you get a lot
use gates to recognize and flag the occurrence of an of protection, for the cost.
illegal state of affairs. The flag can then trigger a jump
to a recovery routine which then may check or re-ini- Further discussion of graceful recovery schemes can be
tialize data, perhaps output an error message, or gener- found in Reference 13.
ate a simple reset.
The most reliable scheme is to use a so-called watchdog Special Problem Areas
circuit. Here the CPU is programmed to generate a
periodic signal as long as the system is executing in- ESD
structionsin an expected manner. The periodic signal is
then used to hold off a circuit that will trigger a jump to MOS chips have some built-in protection against a stat-
a recovery routine. The periodic signal needs to be AC- ic charge build-up on the pins, as would occur during
coupled to the trigger circuit so that a "stuck-at" fault normal handling, but there's no protection against the
won't continue to hold off the trigger. Then, if the proc- kinds of current levels and rise times that occur in a
essor locks up someplace, the periodic signal is lost and genuine electrostatic spark. These kinds of discharges
the watchdog triggers a reset_ can blow a crater in the silicon.
In practice, it may be convenient to drive the watchdog It must be recognized that connecting CPU pins unpro-
circuit with a signal which is being generated anyway tected to a keyboard ()r to anything else that is subject
by the system. One needs to be careful, however, that to electrostatic discharges makes an extremely fragile
an upset does in fact discontinue that signal. Specifical- configuration. Buffering them is the very least one can
ly, for example, one could· use one of the digit drive do. But buffering doesn't completely solve the problem,
signals going to a multiplexed display. But display because then the buffer chips will sustain the damage
scanning is often handled in response to a timer-inter- (even TTL); therefore, one might consider mounting
rupt, whieh may continue operating even though the the buffer chips in sockets for ease of replacement.
main program is in a failure mode. Even so, with a little
extra software, the signal can be used to control the Transient suppressors, such as the TranZorbs® made
watchdog (see Reference 8 on this). by General Semiconductor Industries (Tempe, AZ),
may in the long run provide the cheapest protection if
Simpler schemes can work well for simpler systems. their "zero inductance" structure is used. The structure
For example, if a CPU isn't doing anything but scan- and circuit application are shown in Figure 23.
ning and decoding a keyboard, there's little to lose and The suppressor element is a pn junction that operates
much to gain by simply resetting it periodically with an like a Zener diode. Back-to-back units are available for
astable multivibrator. It only takes about 13 f.Ls (at 6 AC operation. The element is more or less an open
MHz) to reset an 8048 if the clock oscillator is already circuit at normal system voltage (the standoff voltage
running. rating for the device), and conducts like a Zener diode
at the clamping voltage.
A zero-cost measure is simply to fill all unused pro-
gram memory with NOPs and JMPs to a recovery rou- The lead inductance in the conventional transient sup-
tine. The effectiveness of this method is increased by pressor package makes the conventional package essen-
writing the program in segments that are separated by
10-273
inter AP-125
PULSE DIGITAL
H-r~--tB
FUNCTIONAL
H+,..,.--tc DECODER
H+-hr-:--tD
L ____ J
Patent Pending 210313-34 COMMON
(a) 210313-35
(b)
One needs to take a long, careful look at the tempera- The major problem, and the one that seems to come as
ture extremes. The allowable storage temperature range the biggest surprise to most people, is the line tran-
for most Intel MOS chips is -65°t to + 1500C, al" sients. Regrettably, the 12V battery is not. actually the
though some chips have a maximum storage tempera- source of power when the car is running. The charging
ture rating of + 125°C. In operation (or "under bias," system is, and it's not very clean. The only time the
as the data sheets say) the allowable ambient tempera- battery is the real source of power is when the car is
ture range, depends on the product grade, as follows: first being started, and in that condition the battery
terminals may be delivering about5V or 6V. As follows
is a brief description of the major idiosyncracies of the
"12V" automotive power line.
10·274
inter AP-125
60
50
5
Do 20
::E
'" 10
a
a ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
TIME (MILLISECONDS)
210313-36
• An abrupt reduction in the alternator load causes a • Mutual coupling between unshielded wires in long
positive voltage transient called "load dump." In a harnesses can induce 100V and 200V transients in
load dump transient the line voltage rises to 20V or unprotected circuits.
30V in a few /ks, then decays exponentially with a
time constant of about 100 J.Ls, as shown in Figure What all this adds up to is that people in the business of
24. Much higher peak voltages and longer decay building systems for automotive applications need a
times have also been reported. The worst case load comprehensive testing program. An SAE guideline
dump is caused by disconnecting a low battery from which describes the automotive environment is avail-
the alternator circuit while the alternator is running. able to designers: SAE Jl21l, "Recommended Envi-
NormallY.this would happen intermittently when ronmental Practices for Electronic Equipment Design,"
the battery terminal connections are defective. 1980 SAE Handbook, Part I, pp. 22.80-22.96.
• When the ignition is turned off, as the field excita-
tion decays, the line voltage' can go to between Some suggestions for protecting circuitry are shown in
-40V and -IOOV for 100 J.Ls or more. Figure 26. A transient suppressor is placed in front of
the regulator chip to protect it. Since the rise times in
• Miscellaneous solenoid switching transients, such as these transients are not like those in ESD pulses, lead
the one shown in Figure 25, can drive the line to + inductance is less critical and conventional devices can
or - 200V to 400V for several J.Ls. be used. The regulator itself is pretty much of a necessi-
ty, since a load dump transient is simply not going to be
removed by any conventional LC or RC filter.
OSEe.
t
OVOLTS -
-100 VOLTS/DIV
10ps/DIV --
210313-37
10-275
inter AP·125
ACCESSORY
+12V
o-J'l1J'......-r-t--'VI."'''..---I
.....---...- TO" PROCESSOR
~ 115V
DISTANCE
MEASURING COIL
,-0---------""',...._,.",-_ TO" pROCESSOR
5V
210313-38
Spe2ial I/O interfacing is aJso required, because of the The EMC Education committee has available a video
need for high tolerance to cvoltage transients, input tape: "Introduction to EMC-A Video Training
noise, input/output isolation, etc. In addition, switches Tape," by Henry Ott. Don White Consultants offers a
cthat are being monitored or driven by these buffers are series of training courses on many different aspects of
usually referenced to chassis ground instead of signal electromagnetic compatibility. Most organizations that
ground) and in a. ca.r there ca..'1 be ma.."lY volts difference sponsor El".fC courses also (jff~r in-plant presentatiuns.
between the two. I/O interfacing is discussed in Refer-
ence 2.
Parting Thoughts
The main sources of information cfor this Application
Note were the references by Ott and by White. Refer-
ence 5 is probably the finest treatment currently avail-
able on the subject. The other references provided spe-
cific information as cited in the text.
10-276
inter Ap·125
2. Kearney, M; Shreve, J.; and Vincent, W., "Micro- 9. TranZorb Quick Reference Guide. General Semi-
processor Based Systems in the Automobile: Custom conductor Industries, P.O. Box 3078, Tempe, AZ
Integrated Circuits Provide an Effective Interface," 85281.
Electronic Engine Management and Driveline Control
Systems, SAE Publication SP-481, 810160, pp. 93-102. 10. Tucker, T.I., "Spark Initiation Requirements of a
Secondary Explosive," Annals of the New York Acade-
3. King, W.M. and Reynolds, D., "Personnel Electro- my of Sciences, Vol 152, Article I, pp. 643-653, 1968.
static Discharge: Impulse Waveforms Resulting From
ESD of Humans Directly and Through Small Hand- 11. White, D., Electromagnetic Interference and Com-
Held Metallic Objects Intervening in the Discharge patibility, Vol. 3: EMI Control Methods and Techniques.
Path," Proceedings of the IEEE Symposium on Electro- Don White Consultants, 1973.
magnetic Compatibility, pp. 577-590, Aug. 1981. .
12. White, D., EMI Control in the Design of Printed
4. Ott, H., "Digital Circuit Grounding and Intercon- Circuit Boards and Backplanes. Don White Consul-
nection," Proceedings of the IEEE Symposium on Elec-· tants, 1981.
tromagnetic Compatibility, pp. 292-297, Aug. 1981.
13. Yarkoni, B. and Wharton, J., "Designing Reliable
5. Ott, H., Noise Reduction Techniques in Electronic Software for Automotive Applications," SAE Transac-
Systems. New York: Wiley, 1976. tions, 790237, July 1979.
10-277
intJ APpLICATION
NOTE
AP-155
December 1986
Oscillators
for Microcontrollers
TOM WILLIAMSON
MICROCONTROLLER
TECHNICAL MARKETING
Although we will neither "specify" nor "recommend" This equation has two solutions:
specific off-chip components, we do offer assistance in
these tasks. Intel application engineers are available to 1) "1 = 0;
provide whatever technical assistance may be needed or
desired by our customers in designing with Intel prod- 2) fjA = UO·.
ucts.
10-279
inter AP-155
In a given circuit, either or both of the solutions may be In order for the loop gain to have zero phase angle it is
in effect. In the first solution the circuit is quiescent (no necessary that the feedback element Zr have a positive
output signal). If you're trying to make an oscillator, a reactance. That is, it must be inductive. Then, the fre-
no-signal condition is unacceptable. There are ways to quency at which the phase angle is zero is approximate-
guarantee t,hat the second solution is the one that will ly the frequency at which
be in effect, and that the quiescent condition will be
excluded.
How Feedback Oscillators Work where Xr is the reactance of Zr (the total Zr being Rr +
jXr, and C is the series combination of Cx! and CX2.
A feedback oscillator amplifies its own noise and feeds
it back to itself in exactly the right phase, at the oscilla- c= CXl CX2
tion frequency, to build up and reinforce the desired , CXl + CX2
oscillations. Its ability to do that depends on its loop
gain. First, oscillations can occur only at the frequency In other words, Zr and C form·a parallel resonant cir-
for which the loop gain has a phase angle of 0 degrees. cuit.
Second build-up of oscillations will occur only if the
loop gain exceeds I at the frequency. Build-up contin- If Zr is an inductor, then Xr = wL; and the frequency
ues until nonlinearities in the circuit reduce the average at which the loop gain has zero phase is the frequency
value of the loop gain to exactly 1. at which
I 230659-2
10-280
AP-155
only 0.3% of the nominal frequency of a quartz crystal, To assure that an oscillator starts in the desired mode
and about 3% of the nominal frequency of. a ceramic on power-up, something must be done to suppress the
resonator. With relatively little design effort, frequency loop gain in the undesired frequency ranges. The crys-
accuracies of 0.03% or better -can be obtained with tal itself provides some protection against unwanted
quartz crystals, and 0.3% or better with ceramic reso- modes of oscillation; too much resistance in that mode,
nators. for example. Additionally, junction capacitances in the
amplifying devices tend to reduce the gain at higher
frequencies, and thus may discriminate against unwant-
QUARTZ CRYSTALS ed modes. In some cases a circuit fix is necessary, such
as inserting a trap, a phase shifter, or ferrite beads to
The crystal resonator is a thin slice of quartz sand- kill oscillations in unwanted modes.
wiched between two electrodes. Electrically, the device
looks pretty -much like a 5 or 6 pF capacitor, except
that over certain ranges of frequencies the crystal has a Crystal Parameters
positive (i.e., inductive) reactance.
-
JX RESPONSES
FREQUENCY
/ \ ---11'01-1- -
SYMBOL
-JX
Xeo
FUNDAMENTAL
/
FIFTH MECHANICAL
OVERTONE
THIRD MECHANICAL
-C:t:*J-
EQUIVALENT CIRCUIT
230659-4
OVERTONE
230659-3
Figure 4. Quartz Crystal: Symbol and
Equivalent Circuit
Figure 3. Crystal Reactance vs. Frequency
Co is called the shunt capacitance of the crystal. This is
Typically there are several ranges of frequencies where- the capacitance of the crystal's electrodes and the me-
in the reactance of the crystal is positive. Each range chanical holder. If one were to measure the reactance of
corresponds to a different mode of vibration in the crys- the crystal at a: freuqency far removed from a resonance
tal. The main resonsances are the so-called fundamen- frequency, it is the reactance of this capacitance that
tal resp9nse and the third and fifth overtone responses. would be measured. It's normally 3 to 7 pF.
Table 1. Typical Crystal Parameters
The overtone responses shouldn't be confused with the
harmonics of the fundamental. They're not harmonics, Frequency R1 L1 C1 Co
but different vibrational modes. They're not in general MHz ohms mH pF pF
at exact integer multiples of the fundamental frequency.
2 100 520 0.012 4
There will also be "spurious" responses, occurring typi-
cally a few hundred KHz above each main response. 4.608 36 117 0.010 2.9
11.25 19 8.38 0.024 5.4
10-281
AP-155
The series resonant frequency of the crystal is the fre- the antiresonant frequency of the parallel combination
quency at which LI and CI are in resonance. This fre~ of the crystal and CL. This frequency is given by
quency is given by .
1
fs=---
21T~L1C1
These frequency formulas are derived (in Appendix A)
At this frequency the impedance of the crystal is R I in from the equivalent circuit of the crystal, using the as-
parallel with the reactance of Co. For most purposes, sumptions that the Q of the crystal is extremely high,
this impedance is taken. to be just R J, since the reac- and that the circuit external to the crystal has no effect
tance of Co is so much larger than RI. on the frequency other than to·.provide the load capaci-
tance CL. The latter assumption is not precisely true,
but it is close enough for present ·purposes.
Load Capacitance
A crystal oscillator circuit such as the one shown in "Series" vs. "Parallel" Crystals
Figure 2 (redrawn in Figure 5) operates at the frequen-
cy for which the crystal is IlIltiresonant (ie, paral1el~res There is no such thing as a "series cut" crystal as op-
onant) ,with the total capacitance across the crystal ter- posed to. a "parallel cut" crystal. There are different
minals external to the crystal. This total capacitance cuts of crystal, having to do with the parameters of its
external to the crystal is called the load capacitance. . motional arm .jn various frequency ranges,. but there is
no special cut for series or parallel operation.
As shown in Figure 5, the load capacitance is given by
An oscillator is series resonant if the oscillation fre-
CX1 CX2 .. quency is fs of the crystal. To operate the crystal at fs,
CL = C C
X1 + X2
+ Cstray the amplifier has to be noninverting. When buying a
crystal for such an oscillator, one does not specify a
The crystal manufacturer needs to know the value of load c.apacitance. Rather, one specifies the loading con-
CL in order to adjust the crystal to the specified fre- dition as "series." '
.quency.
If a "series" crystal is put into an oscillator that has an
.inverting amplifier, it will oscillate in parallel resonance
with the load capacitance presented to the crystal by
the oscillator circuit, at a frequency slightly above fs. In
fact, at approximately .
r--------c-----------l et C~ C.0»)
!
I
-----------~~,---------
e" ex.
~
I
fa = fs ( 1+ 2(C
L
II I 1:
. .,...
) iI This frequency would typically be about 0.02% above
f s·
~--------------------~
. CRYSTAL
r---------~~---------~
Equivalent Series Resistance
II R, L, C, I
I The "series resistance" often listed on quartz' crystal
I I data sheets is the real part of the crystal impedance at
~--------------~-~--~ the crystal's calibration frequency. This will be Rl if
230659-6
the calibration frequency 18 the series resonant frequen-
Figure 5. Load CapaCitance cy of the crystal. If the crystal is calibrated for parallel
resonance with a load capacitance CL, the equivalent
The adjustment involves putting the cryst~l.in .series series resistance will be
\ .
with the specified CL, and then "trimming" the crystal
to obtain resonance of the series combination of the ESR = R1 ( 1 + ~~r
crystal and CL at the specified frequency. Because of
the high Q of the crystal, the resonant frequency of the
series combination of the crystal and CL is the same as The crystal manufacturer measures this resistance at
the calibration frequency during the same operation in
which the crystal is adjusted to the calibration frequen-
cy.
10-282
inter AP·155
10-283
inter AP-155
as Figure 3 is a'graph ofXrversus frequency.) Anum- frequency and the chip you want it to work with ..
ber of spurious responses are apparent in Figure 6. The They'll supply the resonators, a circuit diagram show-
manufacturers state that spurious responses are more ing the positions and -values of 'other external compo-
prevalent in the lower frequency resonators (kHz nents that may be required and a: guarantee that the
range) than in the higher frequency units (MHz range). circuit will work properly at the ,specified frequency.
For our purposes only the MHz range ceramics need to
be considered.
OSCILLATOR DESIGN
CONSIDERATIONS
----iIOI-I- - -
SYMBOL Designers of microcontroller systems have a number of
options to choose from for clocking the system. The
main decision is whether to use the "on-chip" oscillator
or an external oscillator. If the choice is to use the on-
chip oscillator, what kinds of external components are
EQUIVALENT CIRCUIT
needed to make it operate as advertised? If the choice is
230659-8 to use an external oscillator, what type of oscillator
should it be?
Figure 7. Ceramic Resonator: Symbol and
Equivalent Circuit The decisions have to be based on both economic and
technical requirements. In this section we'll discuss
Figure 7 shows the symbol and equivalent circuit for
r.l1..' \i
some of the factors that should be considered.
the ceramic resonator, both of which are the same as
for the crystal. The parameters have different values,
however, as listed in Table 2.
TALl
Table 2. Typical Ceramic Parameters ------1
Frequency R1 L1 C1 Co , '0 .
MHz ohms mH pF pF c __ T . .
3.56 7. 0.; ;3 ,19.6 140 .,!,.L..:.- I XTAL2I' ,
,I----.,.-.J
6.0 8 0.094 8.3 60
8.0 7 0.092 4.6 40 230659-9
11.0 10 0.057 3.9 30 Figure 8. Using the "On-Chip" Oscillator
10-284
AP-155
We are often asked what maximum crystal resistance tor is being used, and also on application-specific re-
should be specified. The best answer to this question is quirements on start-up time and frequency tolerance.
the lower the better, but use what's available. The crys-
tal resistance will have some effect on start-up time and Start-up time is sometimes more critical in microcon-
steady-state amplitude, but not so much that it can't be troller systems than frequency stability, because ofvari-
comperisated for by appropriate selection of the capaci- ous reset and initialization requirements.
tances CX! and CX2.
Less commonly, accuracy of the oscillator frequency is
Similar questions are asked about specifications of load also critical, for example, when the oscillator is being
capacitance and shunt capacitance. The best advice we used as a time base. As a general rule, fast start-up and
can give is to understand what these parameters mean stable frequency tend to pull the oscillator design in
and how they affect the operation of the circuit (that opposite directions.
being the purpose of this Application Note), and then
decide for yourself if such specifications are meaningful Considerations of both start-up time and frequency sta-
in your application or not. Normally, they're not, un- bility over temperature suggest that CX! and CX2
less your frequency tolerances are tighter than about should be about equal and at least 20 pF. (But they
0.1%. don't have to be either.) Increasing the value of these
capacitances above some 40 or SO pF improves frequen-
Part of the problem is that crystal manufacturers are cy stability. It also tends to increase the start-up time.
accustomed to talking "ppm" tolerances with radio en- There is a maximum value (several hundred pF, de-
gineers and simply won't take your order until you've pending on the value of R! of the quartz or ceramic
filled out their list of specifications. It will help if you resonator) above which the oscillator won't start up at
define your actual frequency tolerance requirements, all.
both for yourself and to the .crystal manufacturer.
Don't pay for 0.003% crystals if your actual frequency If the on-chip amplifier is a simple inverter, such as in
tolerance is 1%. . the 80SI, the user can select values for CX!and CX2
between some 20 and 100 pF, depending on whether
start-up time or frequency stability is the more critical
Oscillation Frequency parameter in a specific application. If the on-chip am-
plifier is a Schmitt Trigger, such as in the 8048, smaller
The oscillation frequency is determined 99.S% by the values of CX! must be used (S to 30 pF), in order to
crystal and up to about O.S% by the circuit external to prevent the oscillator from running in a relaxation
the crystal. The on-chip amplifier has little effect on the mode.
frequency, which is as it should be, since. the amplifier
parameters are temperature and process dependent. Later sections in this Application Note will discuss the
effects of varying CX! and CX2 (as well as other param-
The influence of the on-chip amplifier on the frequency eters), and will have more to say on their selection.
is by means of its input and output (pin-to-ground) ca-
pacitances, which parallel CX! and CX2, and the
XTALI-to-XTAL2 (pin-to-pin) capacitance, which Placement of Components
parallels the crystal. The input and pin-to-pin capaci-
tances are about 7 pF each. Internal phase deviations Noise glitches arriving at XTALI or XTAL2 pins at
from the nominal 180· can be modeled as an output the wrong time can cause a miscount in the internal
capacitance of 2S to 30 pF. These deviations from the clock-generating circuitry. These kinds of glitches can
ideal have less effect in the positive reactance oscillator be produced through capacitive coupling between the
(with the inverting amplifer) than in a comparable se- oscillator components and PCB traces carrying digital
ries resonant oscillator (with the noninverting amplifi- signals with fast rise and fall times. For this reason, the
er) for two reasons: first, the effect of the output capaci- oscillator components should be mounted close to the
tance is lessened, if not swamped, by the off-chip capac- chip and have short, direct traces to the XTALI,
itor; secondly, the positive' reactance oscillator is less XTAL2, and VSS pins.
sensitive, frequency-wise, to such phase errors.
Clocking Other Chips
Selection of CX1 and CX2 There are times when it would be desirable to use the
on-chip oscillator to clock other chips in the system.
Optimal values for the capacitors CX! and CX2 depend
on whether a quartz crystal or ceramic resona-
10-285
inter AP-155
CLOCK
OUT
lK
n~
-::
C
12 0
XTAL2
When technical requirements dictate the use of an ex-
ternal oscillator, the external drive requirements for the
XTALI microcontroller, as published in the data sheet, must be
C.. carefully noted. The logic levels are not in general TTL-
compatible. And each controller has its idiosyncracies
in this regard. The 8048, for example, re.quires that
both XTAL1 and XTAL2 be driven. The 8051 can be
230659-11 driven that way, but the data sheet suggest the simpler
B) DRIVING FROM XTAL 1
method of grounding XTAL1 and driving XTAL2. For
Figure 9. Using the On-Chip Oscillator this method, the driving source must be capable of sink-
to Drive Other Chips
ing some current when XTAL2 is being driven low.
10-286
inter AP-155
=~ ----
[E-
- - - - ---2.4 VDe
- - - ----14 VDe
INPUT
HS-100 HS-200 HS-500
3.5 MHz-20 MHz 20 + MHz-30 MHz 225 KHz-4.0 MHz 25 MHz-SO MHz
Supply Voltage
(Vcd 5V ±10% 5V ±10% 5V ±10% 5V ±10%
Supply Current
(Icd max. 30mA 40mA 85mA 50mA
OUTPUT
HS-100 HS-200 HS-500
3.5 MHz-20 MHz 20 + MHz-30 MHz 225 KHz-4.0 MHz 25 MHz-SO MHz
VOH (Logic "1 ") +2.4Vmin. 1 +2.7Vmin.2 +2.4V min.l +2.7V min. 2
VOL (Logic "0") +O.4V max. 3 +0.5V max. 4 +0.4Vmax. 3 +0.5V max. 4
Symmetry S0/40%5 S0/40%5 55/45%5 60/40%5
TR, TF (Rise &
Fall Time) < 10 ns 6 < 5 ns6 < 15 ns 6 < 5 ns 6
Output Short
Circuit Current 18 mA min. 40 mAmin. 18mAmin. 40mAmin.
Output Load 1 to 10 TTL Loads 7 1 t9 10 TTL Loads8 1 to 10 TTL Loads 7 1 to 10 TTL Loads 8
CONDITIONS
110 source = - 400 p.A max. 410 sink = 20.00 mA max. 71.6 mA per load
210 source = -1;0 mA max. 5Vo = 1.4V 82.0 mA per load
310 sink = 1S.0 mA max. 6(0.4V to 2.4V)
Prepackaged oscillators are available from most crystal The feedback resistance has to be quite low, however,
manufacturers, and have the advantage that the system since it must conduct current sourced by the input pin
designer can treat the oscillator as a black box whose without allowing the DC input voltage to get too far
performance is guaranteed by, people who carry many above the DC output voltage. For biasing purposes, the
years of experience in designing and' building oscilla- feedback resistance should not exceed a- few k-ohms.
tors. Figure 10 shows a typical' data sheet for some But shunting the crystal with such a low resistance does
prepackaged oscillators. Oscillators are also available not encourage, start-up:
with complementary outputs.
10-288
AP-155
10-289
inter Ap·155
vee PHASE
.1 00'.j:--:---_
50'
F. MHz
0' ~--+---_\+_----+-
4.607, 4.609
-50'
XTALl XTAL2
-'
Ro
~I' lit
1
I I'
I 5
I I
z,---.- :---1
L.._ • ..l I
I 4.607 4.609 4.609
v, I--lkHz-1
c.. I CXI I
L. _____________,.JI
I
L._
___ ..II
I
! Figure 14; Loop Gain versus Frequency
230659-18
The analysis used here is mathematically straightfor- And the loop gain is
ward but algebraically intractable. That means it's rela-
tively easy to understand andprogr8.Jll into a computer, , Zj AvZL
but it will not yield a neat formula that gives, say, f3A = ~j + Zt x ZL + Ro
steady-state amplitudl; as ,a function of this or that list
of parameters. A listing of a BASIC program that im- The impedances ZL, Zr, and Zj are defined in Figure
plements the analysis will be found in Appendix II. 13B. .
When the circuit is first powered, up, and before' the Figure 14 shows the way the loop gain thus calculated
oscillations have commenced(and if the oscillations/ail (using typical 805 I-type parameters and a 4.60~ MHz
to commence), the oscillator can be treated as a small crystal) varies with frequency. The frequency ofmterest
signal linear amplifier with feedback. In that case, stan- is the one for which the phase of the loop gain is zero.
dard small-signal analysis techniques can be used to The accepted criterion for start-up is that the magni-
determine start-up characteristics. The circuit model tude of the loop gain must exceed unity atthis frequen-
used in this analysis is shown in Figure 13. cy. This is the frequency at which· the circuit is in reso-
nance. It cOrresponds very closely with the antiresonant
The circuit approximates that there are no high~f~e frequency of the motional arm of the crystal in parallel
quency effects within the amplifier itslef, such that. Its with CL. ' .
high-frequency behavior is dominated by the load Im-
pedance ZL. This is a reasonable approximation for sin" Figure 15 shows the way the loop gain varies with fre-
gle-stage amplifiers of the type used in BOSl-type devic- quency when the parameters of a 3.58 MHz cei'~ic
es. Then the gain of the amplifier as 'a function of fre- resonator are used in place of a crystal (the amplifier
quency is parameters being typical 8051, as in Figure 14). Note
the different frequency scales.
10-290
AP-155
PHASE I...
x ,·pl.".
-8 a Af\Of\".1
SO'
x
\]V \TV 4
O'+---+--t---<--+",,""+---+--t-__
230659-20
-50' A) Poles In Ihe Left-Hall Plane: 1(1) - e- at sin (",I + 8)
J...
'"P"'" X
+a a
MAGNITUDE
20
X
15
230659-21
10 B) Poles In Ihe Right-Hail Plane: I(t) - e+ 8t sin (",t + 8)
f\f\f\f\f\.t
3.55
~~
3.57 3.59 F,MHz
V VVV \
230659-19
230659-22
Figure 15. Loop Gain versus Frequency C) Poles the J", Axis: I(t) - sin (",t + 8)
(3.58 MHz Ceramic)
Figure 16. Do You Know Where Your
Poles Are Tonight?
Start-Up Characteristics
The gain function of interest in oscillators is 1/(1
It is common, in studies of feedback systems, to exam- fJA). Its poles are at the complex frequencies where fJA
ine. the behavior of the closed loop gain as a function of = 1LO", because that value of fJA causes the gain func-
complex frequency s = CT + jCll; specifically, to deter- tion to go to infinity. The oscillator will start up if the
mine the location of its poles in the complex plane. A real part of the pole frequency is positive. More impor-
pole is a point on the complex plane where the gain tantly, the rate at which it starts up is indicated by how
function goes to infinity. Knowledge of its location can much greater than 0 the real part of the pole frequency
be used to predict the response of the system to an is.
input disturbance.
The circuit in Figure 13B can be used to find the pole
The way that the response function depends on the lo- frequencies of the oscillator gain function. All that
cation of the poles is shown in Figure 16. Poles in the needs to be done is evaluate the impedances at complex
left-half plane cause the ·response function to take the frequencies CT + jCll rather than just at CIl, and find the
form of a damped sinusoid. Poles in the right-half plane value of CT + jCll for which fJA = 1LO·. The larger that
cause the response function to take the form of an expo- value of CT is, the faster the oscillator will start up.
nentially growing sinusoid. In general,
Of course, other things besides pole frequencies, things
vet) - eat sin (wt + 8) like the VCC rise time, are at work in determining the
start-up time. But to the extend that the pole frequen-
where a is the real part of the pole frequency. Thus if cies do affect start-up time, we can obtain results like
the pole is in the right-half plane, a is positive and the those in Figures 17 and 18.
sinusoid grows. If the pole is in the left-half plane, a is
negative and the sinusoid is damped. To obtain these figures the pole frequencies were com-
puted for various values of capacitance Cx from
The same type of analysis can usefully be applied to XTAL1 and XTAL2 to ground (thus CX! = CX2 =
oscillators. In this case, however, rather than trying to ex). Then a "time constant" for start-up was calculat-
ensure that the poles are in the left-half plane, we 1
ed as Ts = - where CT is the real part of the pole fre-
would seek to ensure that they're in the right-half plane. CT
An exponentially growing sinusoid is exactly what is quency (rad/sec), and this time constant is plotted ver-
wanted from an oscillator that has just been powered sus Cx.
up.
10-291
inter AP-155
vee:
IE ---
... .... .... .
230659-23
c:;
•
TB• ,.sEC
50
-
i
I
It
~
• I
I
:40
30
I 20
~
--
X2: ~
III ...
·' ·
··· n 10 Cx-pF
[1.
- II
230559-24
o.~-+
40 , 60
__ ~
60
__
100
+-~
120
__~__~__
140 160
230659-26
vec:
X2:
230659-25
10-292
inter AP-155
1c~a XTAL2
Its function is to limit the positive voltage at the gate of
o 8051
the input FET to the avalanche voltage of the drain
junction. If the input pin is driven below VSS, the drain
XTALI
"::" C.
and source of the protection FET interchange roles, so
its gate is connected to what is now the drain. In this
• condition the device resembles a diode with the anode
connected to VSS.
20 40 60 80 100 120 140
There is a parasitic pn junction between the ohmic re-
·160 180 200 220
-1 sistor and the substrate. In the ROM parts (8015, 8048,
Ca-pF
etc.) the substrate is held at approximately - 3V by the
-2
on-chip back-bias generator. In the EPROM parts
230659-29
A) Signal Levels at XTAL 1
(8751, 8748, etc.) the substrate is connected to VSS.
VOLTS
The effect of the input protection circuitry on the oscil-
5
__ calculated lator is that if the XTALI signal goes negative, its nega-
• experimental tive peak is clamped to - VDS of the protection FET in
pol,n'. the ROM parts, and to about -0.5V in the EPROM
parts. These negative voltages on XTALI are in this
application self-limiting and nondestructive.
VOL at XTAL2
The clamping action does, however, raise the DC level
at XTALl, which in turn tends to reduce the positive
20 40 60 80 100 120 140 160 180 200 220
-1
peak at XTAL2. The waveform at XTAL2 resembles a
230659-30
sinusoid riding on a DC level, and whose negative
B) Signal Levels at XTAL2' peaks are clipped off at zero.
Figure 19. Calculated and Experimental Steady- Since it's normally the XTAL2 signal that drives the
State Amplitudes vs. Bulk Capacitance from internal clocking circuitry, the question naturally arises
XTAL 1 and XTAL2 to Ground as to how large this signal must be to reliably do its job.
In fact, the XTAL2 signal doesn't have to meet the
same VIH and VIL specifications that an external driv-
Steady·State Characteristics er would have to. That's because as long as the oscilla-
tor is working, the on-chip amplifier is driving itself
Steady-state analysis is greatly complicated by the fact through its own 0-to-1 transition region, which is very
that we are dealing with large signals and nonlinear nearly the same as the O-to-l transition region in the
circuit response. The circuit parameters vary with in- internal buffer that follows the oscillator. If some pro-
stantaneous voltage, and a number of clamping and cessing variations move the transition level higher or
clipping mechanisms come into play. Analyses that lower, the on-chip amplifier tends to compensate for it
take all these things into account are too complicated to by the fact that its own transition level is correspond-
be of general use, and analyses that don't take them ingly higher or lower. (In the 8096, it's the XTAL1
into account are too inaccurate to justify the effort. signal that drives the internal clocking circuitry, but the
same concept applies.)
. There is a steady-state analysis in Appendix B that
takes some of the complications into account and ig- The main concern about the XTAL2 signal amplitude
nores others. Figure 19 shows the way the steady-state is an indication of the general health of the oscillator.
amplitudes thus calculated (using typical 8051 parame- An amplitude of less than about 2.5V peak-to-peak in-
ters and a 4.608 MHz crystal) vary with equal bulk dicates that start-up problems could develop in some
capacitance placed from XTALl and XTAL2 to units (with low gain) with some crystals (with high R!).
'ground. Experimental results are shown for compari- The remedy is to either adjust the values of CX! and/or
son. CX2 or use a crystal,with a lower R!.
The waveform at XTALl is a fairly clean sinusoid. Its The amplitudes at XTALl and XTAL2 can be adjusted
negative peak is normally somewhat below zero, at a by changing the ratio of the capacitors from XTAL1
level which is determined mainly by the input protec- and XTAL2 to ground. Increasing the XTAL2 capaci-
tion circuitry at XTAL 1. tance, for example, decreases the amplitude at XTAL2
and increases the amplitude at XTALI by about the
The input protection circuitry consists of an ohmic re- same amount. Decreasing both caps increases both am-
sistor and an enhancement-mode FET with the gate plitudes.
10-293
inter AP·155
Pin Capacitance used than those which minimize start-up time: Larger
values than those can be used in applications where
Internal pin-to-ground and pin-to-pin capacitances at increased frequency stability is desired, at some sacri-
XTALl and XTAL2 will have some effect on the oscil- fice in start-up time.
lator. These capacitances are normally taken to be in
the range of 5 to 10 pF, but they are extremely difficult Standard Crystal Corp. (Reference B) studied the use of
to evaluate. Any measurement of one such capacitance their crystals with the MCS-51 family using skew sam-
will necessarily include effects from the others. One ad- ple supplied by Intel. They suggest putting 30 pF ca~
vantage of the positive reactance oscillator is that the pacitors from XTALl and XTAL2 to ground, if the
pin-to-ground capacitances are paralleled by external crystal is specified as described in Reference B. They
bulk capacitors, so a precise determination of their val~ noted that in that configuration and with crystals thus
ue is unnecessary. We would suggest that there is little specified, the frequency accuracy was ± 0.01 % and the
justification for more precision than to assign them a frequency stability was ± 0.005%, and that a frequency
value of 7 pF (XTAL1-to-ground and XTAL1-to- accuracy of ±0.005% could be obtained by substitut-
XTAL2). This value is probably not in error by J:l1ore ing a 25 pF fixed cap in parallel with a 5-20 pF trim-
than 3 or 4 pF. mer for one of the 30 pF caps.
The XTAL2-to-ground capacitance is not entirely "pin MCS-51 skew samples have 'also been supplied to a
capacitance," but more like an "equivalent output ca- number of ceramic resonator manufacturers for charac-
pacitance" of some 25 to 30 pF, having to include the terization with their products. These companies should
effect of internal phase delays. This value will vary to be contacted for application information on their prod-
some extent with temperature, processing, and frequen- ucts. In general, however, ceramics tend to want some-
cy. what larger values for CX! and CX2 than quartz crys-
tals do. As shown in Figure 1B, they start up a lot faster
that way.
MCS®·51 Oscillator
The on-chip amplifier on the HMOS MCS-51 family is In some application the actual frequency tolerance re-
shown in Figure 20. The drain load and feedback "re- quired is only 1% or so, the user being concerned main-
sistors" are seen to be field-effect transistors. The drain ly that the circuit will osci!!ate. In that case, eXt and
load FET, RD, is typically equivalent to about lK to 3 Cxz can be selected rather freely in the range of 20 to
K-ohms. As an ,amplifier, the low frequency voltage BOpF.
gain is normally between - 10 and - 20, and the out-
put resistance is effectively RD. As you can see, "best" values for these components and
their tolerances are strongly dependent on the applica-
,tion and its requirements. In any case, their suitability
VCC
should be verified by environmental testing before the
design is submitted to production.
VCC
XTAL2
230659-31
TO INTERNAL
CIRCUITRY
Figure 20_ MCS®·51 Oscillator Amplifier
10-294
AP-155
input by less than 180 degrees (or lag by more than ISO Kyocera, a ceramic resonator manufacturer, studied
degrees), by an amount that depends on the signal am- the use of some of their resonators (at 6.0 MHz, S.O
plitude, as shown in Figure 24. At higher frequencies, MHz, and 11.0 MHz) with the S049H. Their conclu-
there are additional phase shifts due to the various reac- sion as to the value of capacitance to use at XTAL 1 and
tances in the circuit, but the phase shift due to the hys- XTAL2 was that 33 pF is appropriate at all three fre-
teresis is still present. Since the total phase shift in the quencies. One should probably follow the manufactur-
oscillator's loop gain is necessarily 0 or 360 degrees, it er's recommendations in this matter, since they will
is apparent that as the oscillations build up, the fre- guarantee operation.
quency has to change to allow the reactances to com-
pensate for the hysteresis. In normal operation, this ad- Whether one should accept these recommendations and
ditional phase shift due to hysteresis does not exceed a guarantees without further testing is, however, another
few degrees, and the resulting frequency shift is negligi- matter. Not all users have found the recommendations
ble. to be without occasional problems. If you run into diffi-
27pF
h~
XTALI
VCC:
0 8048
XTAL2
230659-34 XTAL2:
A) When VCC Comes Up Fast, Relaxation Oscillations '
Start First. But Then the Crystal Takes Over.
230659-37
vee
h
lMIl
27pF VCC:
XTALI
, 0 8048
1--6----l XTAL2
.... 27pF XTAL2:
230659-35
B) Weak Pullup (1 Mn or More) on XTAL 1
Discourages Relaxation Mode.
230659-38
27pF
XTALI VCC:
h"
8048
XTAL2
230659-36 XTAL2:
C) No Relaxation Oscillations When VCC Comes Up
More Slowly.
230659-39
10-296
inter AP-155
culties using their recommendations, both Intel and the It will be helpful to build a test jig that will allow the
ceramic resonator manufacturer want to know about it. oscillator circuit to be tested independently of the rest
It is to their interest, and ours, that such problems be of the system. Both start-up and steady-state character-
resolved. istics should be tested. Figure 25 shows the circuit that
.+5V
PI.G vee
P1.1
230659-41
B) Inverter With Hysteresis: Output Leads
Input by Less than 180'.
Preproduction Tests
PI.Gor P1.1 vee
TO
An oscillator design should never be considered ready OSCILLOSCOPE
for production until it has proven its ability to function TRIGGER 8051
acceptably well under worst-case environmental condi- Ell
tions and with parameters at their worst-case tolerance ALE
TO FREQ.
limits. Unexpected temperature effects in parts that COUNTER
may already be near their tolerance limits can prevent
start-up of an oscillator that works perfectly well on the
bench. For example, designers often overlook tempera-
ture effects in ceramic capacitors. (Some ceramics are
down to 50% of their room"temperature values at 230659-42
- 20"C and + 60°C). The problem here isn't just one of B) Oscillator Test Circuit (Shown for 8051 Test)
frequency stability, but also involves start-up time and
steady-state amplitude. There may also be temperature Figure 25. Oscillator Test Circuit and Software
effects in the resonator and amplifier.
10-297
AP-155
was used to obtain the oscillator start-up photographs Frequency checks should be made with only the oscilla-
in this Application Note. This circuit or a modified tor circuitry connected to XTALI and ·XTAL2. The
version of it would make a convenient test-vehicle. The ALE frequency can be counted, and the oscillator fre-
oscillator and its relevant components can be physically quency derived from that. In systems where the fre-
separated from the control circuitry, and placed in a quency tolerance is only "nominal," the frequency
temperature chamber. should still be checked to ascertain that the oscillator
isn't running in a spurious resonance or relaxation
Start-up should be observed under a variety of condi- mode. Switching VCC off and on ag~n repeatedly will
tions, including low VCC and using slow and fast VCC help reveal a tendency to go into unwanted modes of
rise times. The oscillator should not be reluctant to oscillation.
start up even when VCC is below its spec value for the
rest of the chip. (The rest of the chip may not function, The operation of the oscillator should then be verified
but the oscillator should work.) It should also be veri- under actual system running conditions. By this stage
fied that start-up occurs when the resonator has more one will be able to have some confidence that the basic
than its upper tolerance limit of series resistance. (Put selection of components for the oscillator itself is suit~
some resistance in series with the resonator for this able, so if the oscillator appears to malfunction in the
test.) The bulk capacitors from XTALI and XTAL2 to system the fault is not in the selection of these compo-
ground should also be varied to their tolerance limits. nents.
,b IL...
c.:::\
or -5V It is not unusual to find that the grounded ends of CX!
XTAL2
and CX2 eventually connect up to the VSS pin only
I
TO after looping around the farthest ends ofthe board. Not
'0---+-- OSCILLOSCOPE good.
JUMPER FOR
GATE PROTECTION Finally, it should not be overlooked that software prob-
lems sometimes imitate the symptoms of a slow-starting
oscillator or incorrect frequency. Never underestimate
-'-
-5V the perversity of a software problem.
230659-43
REFERENCES
1. Frerking, M. E., Crystal Oscillator Design and Tem- 7. Eaton, S. S., Micropower Crystal-Controlled Oscilla-
perature Compensation. Van Nostrand Reinhold, 1978. tor Design Using RCA COS/MOS Inverters. RCA Ap-
plication Note ICAN-6539.
2. Bottom, V., "The Crystal Unit as a Circuit Compo-
nent," Ch. 7, Introduction to Quartz Crystal Unit De- 8. Fisher, J. B., Crystal Specifications Jor the Intel
sign. Van Nostrand Reinhold, 1982. 8031/8051/8751 Microcontrollers. Standard Crystal
Corp. Design Data Note #2F.
3. Parzen, B., Design oj Crystal and Other Harmonic
Oscillators. John Wiley & Sons, 1983. 9. Murata Mfg. Co., Ltd., Ceramic Resonator
"Cera lock " Application Manual
4. Holmbeck, J. D., "Frequency Tolerance Limitations
with Logic Gate Clock Oscillators, 31st Annual Fre- 10. Kyoto Ceramic Co., Ltd., Adaptability Test Between
quency Control Symposium. June, 1977. Intel 8049H and Kyocera Ceramic Resonators.
5. Roberge, J. K., "Nonlinear Systems," Ch. 6, 11. Kyoto Ceramic Co., Ltd., Technical Data on Ce-
Operational Amplifiers: Theory and Practice. Wiley, ramic Resonator Model KBR-6.0M, KBR-8.0M, KBR-
1975. l1.0M Application Jar 8051 (Intel).
6. Eaton, S. S. Timekeeping Advances Through 12. NTK Technical Ceramic Division, NGK Spark
COS/MOS Technology. RCA Application Note ICAN- Plug Co., Ltd., NTKK Ceramic Resonator Manual
6086.
10-299
intJ AP-155
APPENDIX A
QUARTZ AND CERAMIC RESONATOR FORMULAS
where CT is the capacitance of Cl in series with Co: The resonant ("series· resonant") frequency is the fre-
quency at which the phase angle is zero and the imped-
ance is low. The antiresonant ("parallel resonant") fre-
quency is the frequency at which the phase angle is zero
and the impedance is high.
The impedance of the crystal in parallel with an exter-
nal load capacitance CL is the same expression, but Each of the above 8-expressions contains two arctan
with Co + CL substituted for Co: functions. Setting the denominator of the argument of
the first arctan function to zero gives (approximately)
Z II 1 1 - w2L1C1 + j ooR 1C1 the "series resonant" frequency for that configuration.
XTAL CL = jOO(C1 + Co + CLl • 1 - oo2L1C'T + jooR1C'T Setting the denominator of the argument of the second
arctan function to zero gives (approximately) the "par-
where C'T is the capacitance of Cl in series with (Co + allel resonant" frequency for that configuration.
Cd:
For example, the resonant frequency of the crystal is
C'T';' C1(CO + CLl the frequency at which
C1+ CO+ CL
1 - oo2L1C1 = 0
The impedance of the crystal in series with the load
capacitance is Thus
1
ZXTAL + CL = ZXTAL + ~C 1
jW L or f ----
s - 2'ITA1C1
= CL + C1 + Co. 1 - oo2L1C'T + jooR1C'T
jooCL (C1 + Co) 1 - oo2L1CT + jooR1CT
OOR1C1
8XTAL = arctan
1 -w2L1C1
10-300
infef AP·155
It will be noted that the series resonant frequency of the Equivalent Series Resistance
"XTAL+ CL" configuration (crystal in series with CL)
is the same as the parallel resonant frequency of the ESR is the real part of ZXTAL at the oscillation fre-
"XTALllcL" configuration (crystal in parallel with quency. The oscillation frequency is the parallel reso-
Cd. This is the frequency at which nant frequency of the "XTALllcL" configuration
(which is the same as the series resonant frequency of
the "XTAL + CL" configuration). Substituting this fre-
quency into the ZXTAL expression yields, after some
Thus algebraic manipulation,
or
p = I~ R1 = (I~~I r R1
10-301
AP·155
APPENDIX B
OSCILLATOR ANALYSIS PROGRAM·
The program is written in BASIC. BASIC is excruciat- It should be noted that the analysis ignores a number of
ingly slow, but it has some advantages. For one thing, important items, such as high-frequency effects in the
more people know BASIC than FORTRAN. In addi- on-chip circuitry. These effects are difficult to predict,
tion, a BASIC program is easy to develop, modify, and and are no doubt dependent on temperature, frequency,
"fiddle around" with. Another important advantage is and device sample. However, they can be simulated to a
that a BASIC program can run on practically any small reasonable degree by adding an "output capacitance" of
computer system. about 20 pF to the circuit model (i.e" in parallel with
CX2) as described below.
Its slowness is a problem, however. For example, the
routine which calculates the "start-up time constant"
discussed in the text may take several hours to com- Notes on Using the Program
plete. A person who finds this program useful may pre-
fer to convert it to FORTAN, if the facilities are avail- The program asks·the user to input values for various
able. circuit parameters. First the crystal (or ceramic resona-
tor) parameters are asked for. These are RI, LI, CI,
and CO. The manufacturer can supply these values for
Limitations of the Program selected samples. To obtain any kind of correlation be-
tween calculation and experiment,· the values of these
The program was developed with specific reference to parameters must be known for the specific sample in
805 I-type oscillator circuitry. That means the on-chip the test circuit. The value that should be entered for CO
amplifier is a simple inverter, and not a Schmitt Trig- is the CO of the crystal itself plus an estimated 7 pF to
ger. The 8096, the 80C51, the 80C48 and 80C49 all account for theXTALI-to-XTAL2 pin capacitance,
have simple inverters. The 8096 oscillator is almost plus any other stray capacitance paralleling the crystal
identical to the 8051, differing mainly in the input pro- that the user may feel is significant enough to beinclud-
tection circuitry. The CHMOS amplifiers have some- ed.
what different parameters (higher gain, for example),
and different transition levels than the 8051. Then the program asks for the values of the XTALI-to-
ground and XTAL2-to-ground capacitances. For.
The MCS-48 family is specifically included in the pro- CXTALl, enter the value of the externally connected
gram only to the extent that the input-output curve bulk capacitor plus an estimated 7 pF for pin capaci-
used in the steady-state analysis is that of a Schmitt tance. For CXTAL2, enter the value of the externally
Trigger, if the user identifies the device under analysis connected bulk capacitor plus an estimated 7 pF for pin
as an MCS-48 device. The analysis does not include the capacitance plus about 20 pF to simulate high-frequen-
voltage dependent phase shift of the Schmitt Trigger. cy roll-off and phase shifts in the on-chip circuitry.
The clamping action of the input protection circuitry is Next the program asks for values for the small-signal
important in determining the steady-state amplitudes. parameters of the on-chip amplifier. Typically, for the
The steady-state routine accounts for it by setting the 8051/8751,
negative peak of the XTALl signal at a level which Amplifier Gain Magnitude = IS
depends on the amplitude of the XTALl signal in ac- Feedback Resistance = 2300 Kn
cordance with experimental observations. It's an exer- Output Resistance = 2 Kn
cise in curve-fitting. A user may fmd a different type of
curve works better. Later steppings of the chips may The same values can be used for MCS-48 (NMOS and
behave differently in this respect, having somewhat dif- HMOS) devices, but they are difficult to verify, because
ferenf types of input protection circuitry. the Schmitt Trigger does not lend itself to small-signal
measurements.
10-302
AP-155
10-303
inter Ap·155
7900 PRINT
8000 INPUT N
8100 IF N=I THEN PRINT ELSE 8600
8200 REM
8300 REM ------------- ------.- LIST PARAMETERS ---.-----------------------.--
8400 (lOSUS 17100
8500 OOTO 6800
8600 IF N-2 THEN PRINT ELSE 9400
8700 REM
8800 REM - --.---------------.--- CIRCUIT ANALYSIS - --------------------------
,8900 PRINT " FREQUENCY' S-+,}F TVPE CS I, IF I "
9000 INPUT SQ.FQ
9100 (lOSUS 20200
9200 (lOSUS 26600
9300 (lOTO 6800
9400 IF N=3 THEN 10300 ELSE 11000
9500 REM
9600 REM ------------------ OSCILLATION FREQUENCY ------------------------
9700 CL • CX*CY/CCX+C~1 + CO
9800 FO = FIXC I/C2*PI4S0RCL1*CI*CL/CCl-+CU I I)
9900 SO ~ 0
10000 DF= FIXCIO A INTCLOGCFA-FSI/LOOCIOI-2)+. 5)
10100 DS • 0
10200 RETURN
10300 (lOSUS 9700
10400 (lOSUS 30300
10500 PRINT
10600 PRINT
10700 PRINT "FREOUENCY AT WHICH LOOP GAIN HAS ZERO PHASE ANGLE. "
10800 (lOSUB 26600
10900 (lOTO 6800
11000 IF N=4 THEN PRINT ELSE 12200
IIIOO·REM
11200 REM ---------------- START-UP TIME CONSTANT -------------------------
11300 PRINT "THIS WILL TAV.E SOME TIME
11400 (lOSUB 9700
11500 (lOSUB 37700
11600 PRINT
11700 PRINT
11800 PRINT "FREQUENCV AT WHICH LOOP GAIN = I AT 0 DEGREES:"
11900 (lOSUB 26600
12000 PRINT: PRINT "THIS YIELDS A START-UP TIME CONSTANT OF "i CSNGCIOOOOOO!/C2*PHSQ))i" MICROSECS"
12100 (lOTO 6800 ~
12200 IF N=5 THEN PRINT ELSE 7300
12300 REM
12400 REM ---------------- STEADY-STATE ANALYSIS ---------------------------
12500 PRINT "STEADY-STATE ANALYSIS"
12600 PRINT
12700 PRINT "SELECT: 1. 803118051"
12800 PRINT 2. 8751"
12900 PRINT " 3. 8035/8039/8040/8048/8049"
13000 PRINT 4. 8748/8749"
13100 INPUT ICiI
13200 IF ICX<I OR ICX)'; THEN 12600
13300 (lOSUB 46900
13400 (lOTO 7300
13500 REM SUBROUTINE 3ELOW DEFINES INPUT-OUTPUT CURVE OF OSCILLATOR CV.T
13600 IF ICiI>2 AND VO=5 AND VI'~2 THEN RETURN
13700 VO= -IO*VI + 15
13800 IF va>' THEN va = 5
13900 IF VO<.2 THEN va = 2
14000 IF ICiI>2 AND VO>2 THEN VO = 5
14100 RETURN
14200 REM
14300 REM ******.************************ .... **+ .... ***.*.****.*.*********
14400 REM
14500 REM DEFINE CIRCUIT PARAMETERS
14600 REM
14700 INPUT" Rl COHMS)"iRI
14800 INPUT" Ll (HENRY) "i Ll
1490'0 INPUT" CI (PF) "i X
15000 Cl • X*IE-12
15100 INPUT" 'CO (PF) "i X
15200 CO = X*IE-12
15300 INPUT" CXTALI (PF)"iX
15400 CX = X*IE-12
15500 INPUT" CXTAL2 (PF)"i X
15600 CV • X*IE-12
230659-45
10-304
inter Ap·155
230659-46
10·305
inter AP-155
23500 REM
23600 DRII = FNRR(RI. XI. IRI+RF). CXI+XF) I
23700 Bill = FNXRCRI.XI. (RI+RFI. (XI+XF))
23800 REM
23900 REM 7. Amplifier gain ill magnitu"de/phase form" AR+JAI A at AP d~grees
24000 REM
24100 A = FNZMCARII.AIII)
24200 AP = FNZP(ARII.AI.)
24300 REM
24400 REM 8 Cbeta).n magnitude/phase form D~+JBI B at BP deg . . es
24500 REM
24600 B = FNZMCDR •• DI.)
24700 UP = FNZPCBR •• BI.)
24800 REM
24900 REM 9 Loop ga.n 'G = CB~+JBI).tAR+JAI)
25000 REM = G(real) • JG( lmag inartj)
25100 REM
25200 GR = FNRMCAR •• AI •• BR •• BI.)
25300 GI = FNXM(AR •• AI •• BR •• BI.)
25400 REM
25500 REM 10. Loop 951n in magnitude/p~ase form. GR+JGI AL at AB degrees
25600 REM
25700 AL = FNZM(GR.GI)
25800 AO = FNZP(GR.GI!
25900 RETURN
26000 REM
26100 REM
26200 REM ************_**_********._ ••• ****************************** •••
26300 REM
26400 REM PRINT CIRCUIT ANALYSIS RESULTS
26500 REM
26600 PRINT
26700 PRINT" FREOUENCY = "'SO," + J",FO," HZ"
26800 PRINT" HAL IMPEDANCE = ".FNZM(RE.XE)," OHMS.AT ",FNZPCRE.XE)," DEGREES"
26900 PRINT" CRE = ",CSNG(RE)," OHMS)"
27000 PRINT" (XE = ", CSNG(XE), " OHMS)"
27100 PRINT" LOAD IMPEDANCE = ",FNZMCRL.Xl), " OHMS AT ",FNZP(RL.XL), " DEGREES"
27200 PRINT" AMPLIFIER GAIN = ", A," AT ", AP, ,,' DEGREES"
27300 PRINT" FEEDBACK RATIO = ".D." AT ",BP," DEGREES"
27400 PRINT" LOOP GAIN = ", AL," AT ",.AQ," DEGREES"
27500 RETURN
27600 REM
27700 REM
27800 REM ***************************************************.**********
27900 REM
28000 REM SEARCH FOR FREOUENCY CS+JF)
28100 REM AT WHICH LOOP GAIN HAS ZERO PHASE ANGLE
28200 REM
28300 REM This routine s.arc~e5 for the fre~uenc~ at which the imaginar~ part
28400 REM of the loop gain is zero. The algorithm is as fDl1a~s:
28500 REM 1. Calculate the sign of the ima91nar~ part of the loop gain (01),
28600 REM 2. Increment the fre~uency.
28700 REM 3. Calculate the sIgn of GI at the incremented frequency.
28800 REM 4. If the sign of GI has not changed. go back to 2.
28900 REM 5. If th@ sign of GI ha!> ct'tanged. and this frequenc~ is lIIithin
29000 REM 1Hz of the previous Sign-change. exit the routine.
29100 REM 6. Otherlilise. divide the frequency increment b~ -10.
29200 REM 7. Go back to 2.
29300 REM The routine is entered lIIlth the starting frequency SO+JFO and
29400 REM starting increment DS+JDF already defined by the calling program.
29500 REM In actual use either DS or DF is·zero. so the routine sear~hes·.fDr
29600 REM a GI=O pOInt by lncrementlng either SO Dr FO while holding the other
29700 REM constant. It returns control to t~e calling program ~ith the
29800 REM increm~nted part of the frequency being within 1Hz of the actual
29900 REM GI=O point.
30000 REM
30100 REM 1. CALCULATE THE SIGN OF THE !l1AGINARY PART OF THE LOOP GAIN (GI).
30200 REM
30300 GOSUU 20200
30400 GOSUB 26600
30500 IF GI=O THEN RETL'RN
30600 SXX = INT(SGNCGI))
30700 IF SXX=+I THEN OS -OS
30800 REM (REVERSAL OF OS FO~ GIOO IS FOR THE POLE-SEARCH ROUTINE. )
30900 REM
31000 REM 2 INCREMENT THE FREQUENCY.
31100 REM
31200 SP =50
230659-47
10,306
AP-155
31300 FP = FQ
31400 Sel = sa ? OS
31500 Fel ~ FQ + OF
31600 REt1
31700 REM 3 CALCULATE THE SIGll OF GI AT THE INCREMENTED FREOUENCY.
31800 REM
31900 GOSUB 20200
32000 GOSUB 26600
32100 IF INTISGNIGI))=O THEN RETURN
32200 REM
32300 REM 4 IF THE SIGN OF III HAS Imr CHANGE!), GO BACK TO 2.
32400 REM
32~00 IF SX7.?INT(SGN(GI))=O THEN PRINT ELSE 31400
32600 SX7. = -SX7.
32700 REM
32800 REM 5 IF THE SIGN OF GI f(AS CHANGED, ANO .IF THIS FREOUENCY IS WITHIN
32900 REM 1HZ OF 'T'"4E PREVIOUS SIGN-CHANGE; AND !F G! IS NEGATIVE. THEN
33000 REM EXIT THE ROUTINE CTHF ADDITIONAL REClUIREMENT FOR NEGATIVE GI
33100 REM IS FOR THt:: POLE-SEARCH ROUTINE. t
33200 REt1
33300 IF ABS(5P-50)<:1 AND ADS(FP-FO)<:1 AND 5X'l.=-1 THEN RETURN
33400 REM
33500 REM 6. DIVIDE THE FREQUI::NCY INCREt1ENT BY -10
33600 REM
33700 OS = -05/10.
33800 OF = -DF/IO.
33900 REM
34000 REM 7. GO BACK TO 2
34100 REM
34200 GOTO 31200
34300 REM
34400 REM
34500 REM •• * ••••• ***** ••••• ** ••••• ** ••••• ** •••• **** •• ** ••• ** ••• ********
34600 REM
34700 REM SEARCH FOR POLE FREQUENCY
34800 REM
34900 REM This routine searches for the frequency at which the loop gain = 1
35000 REM at 0 degrees. That fre~uency 1~ t~e pole frequency of the closed-
35100 REM loop gain function. The pole frequl"ncy is a complex number, SO+JFG
35200 REM CHz). Oscillator start-up ensues 1f 5Q~O. The algorithm is based on
3~300 REM the calculated behaVior of the phase angle of the loop gain in the
3~400 REM reglon of interest on the complex plane. The locus of points of zero
35500 REM phase angle crosses the J-axis at the oscillation frequenc~ and at
35600 REM some higher irequency. In between these two crossings of the J-axis.
35700 REM the locus lies in Quadrant I of the comple, plane. forming an
35800 REM approximate parabola which opens to the left. The basic plan is to
35900 REM follow the locus from where, It crosses the J-axis at the oscillation
36000 REM frequenc~. into Quadrant I. and find the point on that locus where
36100 REM the loop gain has a magnltude of 1. The algorithm' is as follows:
36200 REM 1. Find thi' oscillation freQ.uency. O+JFG.
36300 REM 2. At thlS frequenc~ calculate the sign of (AL-l) (AL = magnitude
36400 REM of loop gain. )
36500 REM· 3. IneTement FQ.
36600 REM 4. For this value of FQ, find the value of SQ for which the loop
36700 REM gain has zero phase
36800 REM 5. For this value of SQ+JFQ, calculate the sign of (AL-11.
36900 REM 6. If the sign of (AL-l) t'las not changed, go back to 3.
37000 REM 7. If the sign of CAL-I) has changed. and this value of FO is
37100 REM within 1Hz of the previous slgn-change, exit the routine.
37200 REM S. OtherWlse, dIvide the FO-increment by -10.
37300 REM 9. Go bat\!: to 3
37400 REM
37500 REM I. FIND THE OSCILLATION FREQUENCY, O"'JFCl
37600 REM
37700 GOSUB 9700
37800 GOSUB 30300
37900 REM
38000 REM 2. AT THIS FREQUENCY, CA'-CUL.ATE THE SIGN OF (AL··I)
38100 REM
38200 SY7. = INTlSGN(AL··I'))
38300 IF SY7.=-1 THEN STOP
38400 REM ESTABLISH INITIAL INCREMEIHAT ION VALUE FOR FO
38500 FI = FO
38600 OF = (FA-Flt/IO.
38700 GOSUB 30300
38800 DE (FQ-Flt/IO.
38900 OF 0
39000 FQ FI
230659-48
10-307
intJ AP-155
39100 REM
39200 REM 3. INCREMENT FO
39300 REM
39400 Fa - Fa + DE
39:100 REM
39600-REM 4. FOR THIS VALUE OF FO. FIND THE VALUE OF SO FOR WHICH THE LOOP
39700 REM GAIN HAS ZERO PHASE. CTHE ROUTINE WHICH DOES THAT NEEDS OF • O.
39BOO REM 50 THAT IT CAN HOLD FO CONSTAr~T. AND NEEDS AN INITIAL VALUE FOR
39"00 REM OS. WHICH IS ARBITRARILY SET TO 05 c 1000. I .
40000 REM
40100 OS c 1000.
40200 SO • 0
40300 GOSUB 30300
40400 IF AL-I! THEN RETURN
40500 REM
40600 REM 5. FOR THIS VALUE OF SO+.iFO. CALCULATE THE SIGN OF CAL-II.
40700 REM 6. IF THE SIGN OF CAL-II HAS NOT CHANGED. GO BACK TO 3.
40BOO REM
40900 IF SYX+INTCSGNCAL-I!II=O THEN PRINT ELSE 39400
41000· REM
41100 REM 7. IF THE SIGN OF CAL-II HAS CHANGED. AND THIS VALUE OF Fa IS WITHIN
41200 REM 1HZ OF THE PREVIOUS SIGN-CHANGE. EXIT THE ROUTINE.
41300 REM
41400 IF ABSCFI-FOI<I THEN RETURN
41500 REM
41600 REM 8. DIVIDE THE Fa-INCREMENT BY -10.
41700 REM
41BOO DE - -DEliO.
41900 FI • FO
42000 BYX • -SYX
42100 REM
42200 REM 9. GO BACK TO 3.
42300 REM
42400 GOTO 39400
42500 REM
42600 REM
42700 REH ••••• * ••• * ••••••••••• ** •••• *** ••••••••••••••••••••••••• *.****••
42800 REM
42900 REM STEADY-STATE ANALYSIS
43000 REM
43100 REM The circuit model. u~ed in this anal~sis is similar to the Dn~ used
43200 REM in the small-signal anal~si5j but differs from it in twa respects.
43300 REM First, it includes clamping and clipping effects described in the
43400 REM text. Second, the voltage source in th'. Theve"i" equivalent of the
43500 REM .mplifier is controlled b~ t~e input voltage in accordance with an
43600 REM input-output curve defined' elsewhere in the program.
43700 REM The analvsis applies a sinusoidal "input signal of arbitraT~
43800 REM amplitude, at the oscillation freq,uency, to the XTALl pin, then
43900 REM calculates the resulting lafaveform from ·the voltage source. Using
44000 REM standard Fourier techni~ues, the fundamental frequency component of
44100 REM this waveform is extracted. This fre~uency component is then
44200 REM multiplied by the factor :ZL/(ZL+RO):. and the result is taken to be
44300 REM the signal appearing at the XTAL2 pin. This signal is ·then
44400 REM mU,ltiplied by the feedback ratiO (beta), and the result is taken to
44500 REM be the signal .. ppe-aring at the XTALl p.in. The algorithm is no ...
44600 REM repeated using this co'mputed XTALI signal a5 the assumed input
44700 REM sinusoid. Every time the algorithm is repeated, nt'I&I,v.alue. appear at
44BOO REM XTALI and XTAL2, but the values cl1ange less and less ",ith· each
44900 REM repetition, Eventually tl1ey stop changing. ,This is the steady-stat~.
45000 REM The algortthm is as fo1101&15; ,
45100 REM 1. Compute approximate oscillation f~equency,
45200 REM 2. Call a circuit analysts at this frequency.
45300 REM 3. Find the ~uie5cent levels at XTALI and XTAL2 cto .stablish the
45400 REM beginning DC level at XTALl). .
45500 REM 4. Assume an initial amplitude far the XTALI signal.
45600 REM 5. Correct the DC l.vel at XTALI for clamping effects; if neces •• rv.
45700 REM 6. Using th9 appropriate input-out'put curve, extract a DC level and
45BOO REM the fundamental frequency component Cmult1plying the latter by
45900 REM :ZL/CZL+ROI: I.
. 46000 REM 7. Clip Qff the negatlv~ portion of this output sig~.l, if the
46100 REM neqative peak fa!l~ below zero.
46200 REM 8 If thi~ s1gnaL multiplied by <beta). differs from the input
46300 REM amplltude by less than JmV· or 1f the algorithm has been repeated
46400 REM 10 times. v.it the routine
46500 REM or. Otherlalise. multipl~ the X1A!....i2 amplitude by (beta) and feed it
46600 REM baclI: to )t'TALl. and go bactr to 5.
46700 REM
46BOO REM 1. COMPUTE APPROXIMATE OSCILLATION FREOUENCY.
230659-49
10-308
AP-155
10·309
APPLICATION AP-252
NOTE
September 1987
TOM WILLIAMSON
MCO APPLICATIONS ENGINEER
"10-311
inter Ap·252
NOISE CONSIDERATIONS
LOGIC LEVELS AND INTERFACING
One of the major reasons for going to CMOS has tradi-
PROBLEMS tionally been that CMOS is less susceptible to noise. As
CMOS logic levels. differ from TTL levels in two ways. previously noted, its low susceptibility to noise is
Vee = 5V
Logic State
74HC 74HCT LSTTL 8051 80C51BH
VIH 3.5V 2.0V 2.0V 2.0V 1.9V
VIL 1.0V O.SV O.SV O.SV 0.9V
VOH 4.9V 4.9V 2.7V 2.4V 4.5V
VOL O.W O.W 0.5V 0.45V 0.45V
Figure 1. Logic Level Comparison. (Output voltage levels depend on load current.
, Data sheets list guaranteed output levels for several load currents. The output
levels listed here are for minimum loading.)
10-312,
inter AP-252
partly due to superior noise margins, and partly due to current in extremely sharp spikes at the clock edges.
its slow speed. The VHF and UHF components of these spikes are not
drawn from the power supply, but from the decoupling
Noise margin is the difference between VOL and VIL, capacitor. If the decoupling circuit is not sufficiently
or between VOH and VIH. If VOH from a driving cir- low in inductance, Vee will glitch at each clock edge.
cuit is 2.7V and VIH to the driven circuit is 2.0V, then We suggest that a 0.1 J.LF decoupler cap be used in a
the driven circuit has 0.7V of noise margin at the logic minimum-inductance configuration with the microcon-
high level. These kinds of comparisons show that an troller. A minimum-inductance configuration is one
all-CMOS system has wider noise margins than an all- that minimizes the area of the loop formed by the chip
TTL system. (Vee to Vss), the traces to the decoupler cap, and the
decoupler cap. PCB designers too often fail to under-
Figure 2 shows noise margins in CMOS and LS TTL , stand that if the traces that connect the decoupler cap
systems when both have Vee = 5V. It can be seen that to the Vee and Vss pins aren't short and direct, the
CMOS/CMOS and CMOS/CHMOS systems have an decoupler loses much of its effectiveness.
edge over LS TTL in this respect.
Overshoot and ringing in signal lines are potential
Noise margins can be 'misleading, however, because sources of logic upsets. These can largely be controlled
they don't say how much noise energy it takes to induce by circuit layout. Inserting small resistors (about 1000.)
in the circuit a noise voltage of sufficient amplitude to in series with signal lines that seem to need them will
cause a logic error. This would involve consideration of also help.
the width of the noise pulse as compared with the cir-
cuit's response speed, and the impedance to ground The sharp edges produced by high-speed CMOS can
from the point of noise introduction in the circuit. cause RFI problems. The severity of these problems is
largely a function of the PCB layout. We don't mean to
When these considerations are included, it is seen that imply that all RFI problems can be solved by a better
using the slower 74C- and 4000-series circuits with a 12 PCB layout; It may well be, for example, that in some
or 15V supply voltage does offer a truly improved level RFI-sensitive designs high-speed CMOS is simply not
of noise immunity, but that high-speed CMOS at 5V is the answer. But circuit layout is a critical factor in the
not significantly better than TTL. noise performance of any electronic system, and more
so in high-speed CMOS systems than others.
One should not mistake the wider supply voltage toler-
ance of high-speed CMOS for Vee glitch immunity. Circuit layout techniques for minimizing noise suscepti-
Supply voltage tolerance is a DC rating, not a glitch bility and generation are discussed in References 3
rating. through 6.
10-313
AP-252
Figure 3a. Conditions defining the minimum During bus operations. the port uses internal pullups to
value for R. PO. X is emitting a logic low. R must emit Is. The D.C. Characteristics in the data sheet list
be large enough to not cause IOL to exceed guaranteed VOH levels for given IOH currents. (The "-"
data sheet specifications. sign in the IOH value means the pin is sourcing that
current to the external load, as shown in Figure 4.) To
ensure the VOH level listed in the data sheet, the resis-
80C51BH
R
I 80C51 BH ~ -1!!!..
~ .JJtt... Po.xt---_o----- E~1J:J4s'L
po.x t---_----E~1,E:~L
R
10-314
inter Ap·252
VOH
- + I I
IIH:5: IOH DRIVE CAPABILITY OF THE
R INTERNAL PULLUPS
tor has to satisfy where I IH is the input high current to There's an important difference between HMOS and
the external loads. CHMOS port drivers. The pins of Ports 1, 2, and 3 of
the CHMOS parts each have three pullups: strong, nor-
When the pin goes into a high impedance state, the mal, and weak, as shown in Figure S. The strong pullup
pulldown resistor will have to sink leakage current (p 1) is only used during O-to-l transitions, to hasten the
from the pin, plus whatever other current may be transition. The weak pullup (p2) is on whenever the bit
sourced by other loads connected to the pin, as shown latch contains a 1. The "normal" pullup (p3) is con-
in Figure 4b. The Port 0 leakage current is ILl on the trolled by the pin voltage itself.
data sheet. The resistor should be selected so that the
voltage developed across it by. these currents will be The reason that p3 is controlled by the pin voltage is
seen as a logic low by whatever circuits are connected that if the pin is being used as an input, and the external
to it (including the 80CSIBH). In CMOS/CHMOS ap- source pulls it to a low, then turning offp3 makes for a
plications, SOk .n is normally a reasonable maximum lower IlL. The data sheet shows an "ITL" specification.
value. This is the current that p3 will source during the time
the pin voltage is making its I-to-O transition. This is
what IlL would be if an input low at the pin didn't tum
80C51BH ...!!:!..... p3 off.
po.xt---.....- - - - E~1J:~:L Note, however, that this p3 tum-off mechanism puts a
restriction on the drive capacity of the pin if it's being
R used as an output. If you're trying to output a logic
high, and the external load pulls the pin voltage below
the pin's YIHMIN spec, p3 might tum off, leaving only
VOL =(ILl + ilL) x R the weak p2 to provide drive to the load. To prevent
this happening, you need to ensure that the load doesn't
270068-4
draw more than the IOH spec for a valid YOH. The idea
Figure 4b. Conditions defining the maximum is to make sure the pin voltage never falls below its own
value for R. PO.X is In a high impedance state. YIHMIN ,specification.
R must be small enough to keep VOL
acceptably low.
Q
FROM PORT
LATCH
READ
PO AT PIN
270068-5
10-315
inter AP-252
POWER CONSUMPTION CMOS circuits draw current in sharp spikes during log-
ical transitions. These current spikes are made up of
The main reason for going to CMOS, of course, is to two components. One is the current that flows during
conserve power. (There are other reasons, but this is the the transition time when pullup and pulldown FETs are
main one.) Conserving power doesn't mean just reduc- both active. The average (DC) value of this component
ing your electric bill. Nor does it necessarily relate to is larger when the transition times of the input signals
battery operation, although battery operation without are longer. For this reason, if the current draw is a
CMOS is pretty unhandy. The main reason for conserv- critical factor in the design, slow rise and fall times
ing power is to be able to put more functionality into a should be~voided, even when the system speed doesn't
smaller space. The reduced power consumption allows seem to justify a need for nanosecond switching speeds.
the use of smaller and lighter power supplies, and less
heat being generated allows denser packaging of circuit The other component is the current that charges stray
components. Expensive fans and blowers can usually be and. load capacitance at the nodes of a CMOS logic
eliminated. . gate. The average value of this current spike is its area
(integral over time) multiplied by its rep rate. Its area is
A cooler running chip is also more reliable, since most the amount of charge it takes to raise the node capaci-
random and wearout failures relate to gie temperature. tance, C, to Vee. That amount of charge is just C )Ii
And finally, the lower power dissipation will allow Vee. So the average value of the current spike is C x
more functions to be integrated onto the chip. Vee x f, where f is the clock frequency.
The reason CMOS consumes less power than NMOS is This component of current increases linearly with clock
that when it's in a stable state there is no path of con- frequency. For minimal current draw, the 80CS2BH-2
duction from Vee to Vss except through various leak- is spec'd to run at frequencies as low as 500 kHz.
age paths. CMOS does draw current when it's changing
states. How much current it draws depends on how Keep in mind, though, that other component of current
often and how quickly it changes states. that is due to slow rise and fall times. A sinusoid is not
the optimal waveform to drive the XTALI pin with.
Yet crystal oscillators, including the one on the
80C5lBH, generate sinusoidal waveforms. Therefore, if
the on-chip oscillator is being used, you can expect the
device to draw more current at 500 kHz, than it does at
1.5 MHz, as shown in Figure 6. If you derive a good
sharp square wave from an external oscillator, and use
ICC
that to drive XTALI, then the niicrocontroller will
draw less current. But the external oscillator will prob-
ably make up the difference.
CPU
INTERRUPT
SERIAL PORT .
TIMER/COUNTERS
270068-7
Figure 7. Oscillator and Clock Circuitry Showing Idle and Power Down Hardware
10-316
Ap·252
Idle: In the Idle Mode (IDL = 0 in Figure 7), the CPU There are two ways to terminate Idle. Activation 'of any
puts itself to sleep by gating off its own clock. It doesn't enabled interrupt will cause the hardware to clear bit 0
stop the oscillator. It just stops the internal clock signal of the PCON register, terminating the Idle mode. The
from getting to the CPU. Since the CPU draws SO to 90 interrupt will be serviced, and following RETI the next
percent of the chip's power, shutting it off represents a instruction to be executed will be the one following the
fairly significant power savings. The on-chip periperals instruction that invoked Idle.
(timers, serial port, interrupts, etc.) and RAM continue
to function as normal. The CPU status is preserved in The other way is with a hardware reset. Since the clock
its entirety: the Stack Pointer, Program Counter, Pro- oscillator is still running, RST only needs to be held
gram Status Word, Accumulator, and all other regis- active for two machine cycles (24 oscillator periods) to
ters maintain their data during Idle. complete the reset. Note that this exit from Idle writes
Is to all the ports, initializes all SFRs to their reset
The Idle Mode is invoked by setting bit 0 (IDL) of the values, and restarts program execution from location O.
PCON register. PCON is not bit-addressable, so the bit
has to be set by a byte operation, such as Power Down: In the Power Down Mode (PD = 0 in
Figure 7), the CPU puts the whole chip to sleep by
ORL PCON,#l turning off the oscillator. In case it was running from
an external oscillator, it also gates off the path to the
The PCON register also contains flag bits GFO and internal phase generators, so no internal clock is gener-
GFl, which can be used for any general purposes, or to ated even if the external oscillator is still running. The
give an indication if an interrupt occurred during nor- on-chip RAM, however, saves its data, as long as Vee
mal operation or during Idle. In this application, the is maintained. In this mode the only IcC that flows is
instruction that invokes Idle also sets one or both of the leakage, which is normally in the micro-amp range.
flag bits. Their status can then be checked in the inter-
rupt routines. The Power Down Mode is invoked by setting bit 1 in
the PCON register, using a byte instruction such as
While the device is in the Idle Mode, ALE and PSEN
emit logic high (VOH), as shown in Figure S. This is so ORL PCON,#2
external EPROM can be deselected and have its output
disabled. While the device is in Power Down, ALE and' PSEN
emit lows (VOU, as shown in Figure S. The reason they
The port pins hold the logical states they had at the are designed to emit lows is so that power can be re-
time the Idle was activated. If the device was executing moved from the rest of the circuit, if desired, while the
out of external program memory, Port 0 is left in a high SOCS51BH is in its Power Down mode.
impedance state and Port 2 continues to emit the high
byte of the program counter (using the strong pullups The port pins continue to emit whatever data was writ-
to emit Is). If the device was executing out of internal ten to them. Note that Port 2 emits its P2 register data
program memory, Ports 0 and 2 continue to emit what- even if execution was from external program memory.
ever is in the PO and P2 registers.
10-317
AP-252
Port 0 also emits its PO register data, but if execution If Vee is going to be held to the entire circuit, one
was from external program memory, the PO register would want to write values to the port latches that
data is FF. The oscillator is stopped, and the part re- would deselect peripherals before invoking Power
mains in this stl\te as long as Vee is held, and until it Down. For example, if external memory is being used,
receives an external reset signal. the P2 SFR should be loaded with a value which will
not generate an active chip select to any- memory de-
The only exit from Power Down is a hardware reset. vice.
Since the oscillator was stopped, RST must be held ac-
tive long enough for the oscillator to re-start and stabi- In some applications, Vee to part of the system may be
lize. Then the reset function initializes all the Special shut. off during Power Down, so that even quiescent
Function Registers (ports, timers, etc.) to their reset and standby currents are eliminated. Signal lines that
values, and re-starts the program from location o. connect to those chips must be brought to a logic low,
Therefore, timer reloads, interrupt enables, baud rates, whether the chip in question is CMOS, NMOS, or
port status, etc. need to be re-established. Reset does TTL, before Vee is shut off, to them. CMOS pins have
not affect the·content of the on-chip data RAM. If Vee parasitic pn junctions to Vee, which will be forward
was held .during Power Down, the RAM data is still biased if Vee is reduced to zero while the pin is held at
good. a logic high. NMOS pins often have FETs that look
like diodes to Vee. TTL circuits may actually be dam-
aged by an input high if Vee = o. That's why the
USING THE POWER DOWN MODE 80C5IBH outputs lows at ALE and PSEN during Pow-
er Down.
The software-invoked Power Down feature offers a
means of reducing the power consumption to a mere Figure 9 shows a circuit that can be used to tum Vee
trickle in systems which are to remain dormant for off to part of the system during Power Down. The cir-
some period of time, while retaining important data. cuit will ensure that the secondary circuit is not de-en-
ergized until after the 80C31BH is in Power Down, and
The user should give some thought to what state the that the 80C3lBH does not receive a reset (terminating
port pins should be left in during the time the clock is the Power Down mode) before the secondary circuit is
stopped, and write those values to the port latches be- re-energized. Therefore, the program memory itself can
fore invoking Power Down. be part of the secondary circuit.
VCC1
C1
1,.1
R VCC2
20K
270068-8
Figure 9. The 80C31BH de-energizes part of the circuit (VCC2) when it goes into Power Down.
Selections of R arid Q2 depend on VCC2 current draw.
10-318
AP-252
10-319
inter AP-252
~II~
VCC2
VCC
t----!
: BACKUP
BATTERY
80C51BH
80C31BH
t--.......- - - - t I N T O
Zl
.01,,1
Ql
2N3904
OR EQUIV. VSS
270068-10
Figure 11. Power Failure Detector with Battery Backup. When AC power fails,
VCC1 goes down and VCC2 is held.
perform the same function, if one prefers.) The way it Automatic wake~up on power restoration is also possi-
works is if the line voltage reaches an acceptably high ble. If the CPU is in Idle, it can continue to respond to
level, it breaks over Zl, drives QI to saturation, and any interrupts that might be generated by QI. The in-
interrupts the 80C51BH. The interrupt would be tran- terrupt service routine determines from the status of
sition-activated, in this application. The interrupt serv- flag bits GFO and GFI in PCON that it is in Idle be-
ice routine reloads one of the C5IBH's timers to a value cause there was a power outage. It can then sample
that will make it roll over in something between one Veel through a voltage comparator similar to ZI, QI
and two half-cycles of line frequency. As long as the in Figure II. A satisfactory level of Veel would be
line voltage is healthy, the timer never rolls over, be- indicated by the transistor being in saturation.
cause it is reloaded every half-cycle. If there is a single
half-cycle in which the line voltage doesn't reach a high But perhaps you can't spare the timer that is the key to
enough level to generate the interrupt, the timer rolls the operation of the circuit in Figure II. In that case a
over and generates a timer interrupt. retriggerable one-shot, triggered by the AC line voltage,
can perform essentially the same function. Figure 12
The timer interrupt then commences the transition to shows an example of this type of power failure detector.
battery backup. Critical data needs to be copied into A retriggerable one-shot (one half of a 74HC123) moni-
protected RAM. Signals to circuits that are going to tors the AC line voltage through transistor QI. QI re-
lose power must be written to logic low. Protected cir- triggers the one-shot every half-cycle of line frequency.
cuits (those powered by Vee2) that communicate with If the output pulse width is between one and two half-
unprotected circuits must be deselected. The microcon- cycles of line frequency, then a single missing or low
troller itself may be put into Idle, so that it can contin- half-cycle will generate an active low warning flag,
ue some level of interrupt-driven functionality, or it which can be used to interrupt the microcontroller.
may be put into Power Down.
The interrupt routine takes care of the transition to
Note that if the CPU is going to invoke Power Down, battery backup. From this point Veel mayor may not
the Special Function Registers may also need to be cop- actually drop out: The missing half-cycle of line voltage
ied into protected RAM, since the reset that terminates that caused the power down sequence may have been
the Power Down mode will also intialize all the SFRs nothing more than a short glitch. If the AC line comes
to their reset values. back strong enough to trigger the one-shot while Veel
is still up (as indicated by the state of transistor Q2),
The circuit in Figure II does not show a wake-up then the other half of the 74HCI23 will generate a
mechanism. A number of choices are available, howev- wake-up signal.
er. A pushbutton could be used to generate an inter-
rupt, if the CPU is in Idle, or to activate reset, if the
CPU is in Power Down.
10-320
Ap·252
1/1/1/1
20K
12K
47K 1,,1
VCC2
Y.z74HC123
RIC C
Q CLR Q WAKE·UP
a Q WAKE·UP
A VSS
'f.!74HC123
1,,1
INTO
(80C51BH)
270068-11
Figure 12. Power Failure Detector uses retriggerable one-shots to flag impending power outage and
generate automatic wake-up when power returns.
Having been awakened, the 80C51BH will stay awake POWER SWITCHOVER CIRCUITS
for at least another half-cycle of line frequency (another
5,000 or so instructions) before possibly being told to Battery backup systems need to have a way for the
arrange another transfer of power. Consequently, if the protected circuits to draw power from the line-operated
line ,voltage is jittering erratically around the switch- power supply when that source is available, and to
over point (determined by diode ZI), the system will switch over to battery power when required. The
limp along executing in half-cycle units of line frequen- switchover circuit is simple if the entire system is to be
cy. battery powered in the event of a line power outage. In
that case a pair of diodes suffice, as shown in Figure 12,
On the other hand, if the power outage is real and provided Vee MIN specs are still met after the diode
lengthy, Veel will eventually fall below the level at drop has been subtracted from its respective power
which the backup battery takes over. The backup bat- source.
tery maintains power to the 80C5lBH, and to the
74HC123, and to whatever other circuits are being pro- The situation becomes more complicated when part of
tected during this outage. The battery voltage must be the circuit is going to be allowed to die when the AC
high enough to maintain VeeMIN specs to the power goes out. In that case it is difficult to maintain
80C5lBH. equal Vees to protected and unprotected circuits (and
possibly dangerous not to).
If the microcontroller is an 80C3lBH, executing out of
external ROM, and if the C3lBH is put into Idle dur- The problem can be alleviated by using a Schottky di-
ing the power outage, then the external ROM must also ode instead of a lN4001, for its lower forward voltage
be supplied by the battery. On the other hand, if the drop. The IN5820, for example, has a foward drop of
C31BH is put into Power Down during the outage, about 0.35V at lA.
then the ROM can be allowed to die with the AC pow-
er. The considerations here are the same as in Figure 9: Other solutions are to use a transistor or power MOS-
Vee to the ROM is still up at the time Power Down is FET switch, as shown in Figure 13. With minor modifi-
invoked, and we must ensure (through selection of di- cations this switch can be controlled by port pins.
ode Z2 in Figure 12) that the 80C31BH is not awak-
ened till ROM power is back in spec.
10~321
inter AP-252
270068-27
The timing waveforms for this configuration are shown
in Figure 14b. In Figure 14b the signals and timing
a. Using a pnp Transistor . parameters in parenthesis are those of the 27C64, and
the others are of the 80C31BH, except Tprop is a pa-
rameter of the address latch. The requirements for tim-
ing compatibility are
TAVIV - Tprop > tACC
TLLlV> tCE
TPLlV> tOE
TPXIZ> tDF
8OC31BH 27C64
~----------~--------~CE
P~EN~----~--~----------~Oi
270068-26
10-322
inter AP-252
select the EPROM when the CPU is in Power Down. If TLLAX> tLA
Idle is never invoked, CE of the EPROM can be con- TLLlV> tACL
nected to P2.7 of the 80C3lBH, as shown in Figure
15a. In normal operation, P2.7 will be emitting the TPLlV> tOE
MSB of the Program Counter, which is 0 if the pro-
gram contains less than 32K of code. Then when the TLLPL> tCOE
CPU goes into Power Down, the Port 2 pins emit P2
SFR data, which puts a 1 at P2.7, thus deselecting the TPXIZ> tOHZ
EPROM.
The same considerations apply to the 87C64 as to the
If Idle and Power Down are both going to be used, CE 27C64 with regards to the Idle and Power Down
of the EPROM can be driven by the logical OR of ALE modes. Basically you want CS = 1 if Vee is main-
and P2.7, as shown in Figure 15b. In Idle, ALE = I tained to the EPROM, and CS = OE = 0 if Vee is
will deselect the EPROM, and in Power Down, P2.7 = removed.
1 will deselect it.
SCANNING A KEYBOARD
P2.7 FE
of - - - - - . . . ; . . . . . of There are many different kinds of keyboards, but alpha-
80C31 BH 27C64
numeric keyboards generally consist of a matrix of 8
270068-14 scan lines and 8 receive lines as shown in Figure 17.
a. Power Down Is used but not Idle. Each set of lines connects to one port of the microcon-
troller. The software has written Os to the scan lines,
of
80C31BH
{ALE~ CE
P2.7~ 27~64
_ and Is to the receive lines. Pressing a key connects a
scan line to a receive line, thus pulling the receive line'
270068-15 to a logic low.
b. Idle and Power Down both used.
The 8 receive lines are ANDed to one of the external
Figure 15. Modifications to 80C31BH/27C64 interrupt pins, so that pulling any of the receive lines
Interface low generates an interrupt. The interrupt service rou-
tine has to identify the pressed key, if only one key is
Pulldown resistors are shown in Figure 14a under the down, and convert that information to some useful out-
assumption that something on the bus is going to have put. If more than one key in the line matrix is found to
its Vee removed during Power Down. If this is not the be pressed, no action is taken. (This is a "two key lock-
case, pullups can be used as well as pulldowns. out" scheme.)
10-323
inter AP-252
On some keyboards, certain keys (Shift, Control, Es- terrupt, which terminates the Idle. The interrupt serv-
cape, etc.) are not a part of the line matrix. These keys ice routine would first call a 30 ms (or so) delay to
would connect directly to a port pin on the microcon- debounce the key, and then set about the task of identi-
troller, and would not cause lock-out if pressed simulta- fying which key is down.
neously with a matrix key, nor generate an interrup,t if
pressed singly. First, the current state of the receive lines is latched
into an internal register. If a single key is down, all but
Normally the microcontroller would be in- idle mode one of the lines would be read as Is. Then Os are written
when a key has not been pressed, and another task is to the receive lines and 1s to the scan lines, and the scan
not in progress. Pressing a matrix key generates an in- lines are read. If a single key is down, all but one of
r
10K XI
PO /8 0.-0,
...
8OC31BH 87C64
/8 ArA,
P2
/5 -I ArAI~
ALE FE
PSEN OE
270068-16
270068-17
10-324
intJ AP-252
SCAN LINES
rC RECEIVE
LINES
aOCSleH
'-- f----"
- I-------"
)Pl P2
INTO
270068-18
10-325
inter AP-252
Notice that RESPONSE_TO~EY_CLOSURE For example, with.a 3.58 MHz oscillator frequency, a
does not change the Accumulator, the PSW, nor any of 30 ms delay could be obtained using a preload value of
the registers RO through R7. Neither do SCAN or DE- - 8950, or DDOA, in hex digits.
BOUNCE_DELAY.
In the debounce delay routine (Figure 19), the timer
What we come out with then is a one-byte key address interrupt is enabled'and set to a higher priority than the
(ADDRESS) which identifies the pressed key. The keyboard interrupt, because as we invoke Idle, the key-
key's scan line number is in the upper nibble of AD- board .interrupt is still "in progress". An interrupt of
DRESS, and its receive line number is in the lower the same priority will not be acknowledged, and will
nibble. ADDRESS can be used in a look-up table to not terminate the Idle mode. With the timer interrupt
generate a key code to transmit to a host computer, set to priority 1, while the keyboard interrupt is a prior-
and/or to a display device. ity 0, the timer interrupt, when it occurs, will be ac-
knowledged and will wake up the CPU. The timer in-
The keyboard interrupt itself'must be edge-triggered, terrupt service routine does not itself have to do any-
rather than level-activated, so that the interrupt routine thing. The service routine might be nothing more than
is invoked when a key is pressed, and is not constantly a single RETI instruction. RETI from the timer inter-
being repeated as long as the key is held down. In edge- rupt service routine then returns execution to the de-
triggered mode, the on-chip hardware clears the inter- bounce delay routine, which shuts down the timer and
rupt flag (EXO, in this case) as the service routine is returns execution to the keyboard service routine.
being vectored to. In this application, however, contact
bounce will cause several more edges to occur after the
service routine has been vectored to,· during the DE- DRIVING AN LCD
BOUNCE_DELAY routine. Consequently it is neces-
sary to clear EXO again in software before executing An LCD (Liquid Crystal Display) consists of a back-
RETI. plane arid any number of segments or dots which will
be used to form the image being displayed. Applying a
The debounce delay routine also takes advantage of the voltage (nominally 4 or 5V) between any segment and
Idle mode. In this routine a timer must be preloaded the backplane causes the segment to darken. The only
with a value appropriate to the desired length of delay. catch is that the polarity of the applied voltage has to
This would be be periodically reversed, or else a chemical reac-
10-326
inter AP-252
DEBOUNCE_DELAY:
MOV TLI, ..TLI_PRELOAD ; Preload low blJte.
MDV TH1,4tTH1JRELOAD j Preload high byte.
SETB ETI Enable Timer 1 interrupt.
SETB PTt Set TimeT' 1 intel'T"upt to high priority.
SETB TR1 Start timer l'unning.
ORL peON. ttl j Invoke Idle mode.
The next instruction will not be executed until the delay times out.
Figure 19. Subroutine DEBOUNCLDELAY Puts the 80C51BH Into Idle During the Delay Time
tion takes place in the LCD which causes deterioration tasks are not requiring servicing. When the timer rolls
and eventual failure of the liquid crystal. over it generates an interrupt, which brings the
80C5IBH out of Idle. The service routine reloads the
To prevent this happening, the backplane and all the timer (for the next rollover), and inverts the logic levels
segments are driven with an AC signal, which is de- of all the pins that are connected to the LCD. It might
rived from a rectangular voltage waveform. If a seg- look like this:
ment is to be "off" it is driven by the same waveform as
the backplane. Thus it is always at backplane potential. LCD_DRIVE_INTERRUPT:
If the segment is to be "on" it is driven with a wave- MOV TL1,#LOW( - XTAL_FREQI
form that is the inverse of the backplane waveform. MOV TH1,#HIGH( - XTAL_FREQI
Thus it has about 5V of periodically changing polarity XRL TENS_DIGIT,#OFFH
between it and the backplane. XRL ONES_DIGIT,#OFFH
RETI
With a little software overhead, the 80C51BH can per-
form this task without the need for additional LCD To update the display, one would use a look-up table to
drivers. The only drawback is that each LCD segment generate the characters. In the table, "on" segments are
uses up one port pin, and the backplane uses one more. represented as Is, and "off" segments as Os. The back-
If more than, say, two 7-segment digits are being driv- plane bit is represented as a O. The quantity to be dis-
en, there aren't many port pins left for other tasks. played is stored in RAM as a BCD value. The look-up
Nevertheless, assuming a given application leaves table operates on the low nibble of the BCD value, and
enough port pins available to support this task, the con- produces the bit pattern that is to be written to either
siderations for driving the LCD are as follows. the ones digit or the tens digit. Before the new patterns
can be written to the LCD, the LCD drive interrupt has
Suppose, for example, it is a 2-digit display with a deci- to be disabled. That is to prevent a polarity reversal
mal point. One port (TENS_DIGIT) connects to the 7 from taking place between the times the two digits are
segments of the tens digit plus the backplane. Another written. An update subroutine is shown in Figure 20.
port (ONES~IGIT) connects to a decimal point plus
.the 7 segments of the ones digit.
USING AN LCD DRIVER
One of the 80C5IBH's timers is used to mark off half-
periods of the drive voltage waveform. The LCD drive As was noted, driving an LCD directly with an
waveform should have a rep rate between 30 and 100 80C51BH uses a lot of port pins. LCD drivers are avail-
Hz, but it's not very critical. A half-period of 12 ms will able in CMOS to interface an 80C5IBH to a 4-digit
set the rep rate to about 42 Hz. The preload/reload display using only 7 of the C5IBH's I/O pins. Basical-
value to get 12 ms to rollover is the 2's complement ly, the C51BH tells the LCD driver what digit is to be
negative of the oscillator frequency in kHz: if the oscil- displayed (4 bits) and what position it is to be displayed
lator frequency is 3.58 MHz, the reload value is in (2 bits), and toggles a Chip Select pin to tell the
- 3580, or F204 in hex digits. driver to latch this information. The LCD driver gener-
ates the display characters (hex digits), and takes care
Now, the 80C51BH would normally be in Idle, to con- of the polarity reversals using its own RC oscillator to
serve power, during the time that the LCD and other generate the timing.
10-327
Ap·252
Figure 25 shows an 80C51BH working with an When the frequency or period measurement is complet-
ICM72llM to drive a 4-digit LCD, and the software ed, the C5IBH wakes itself up for a very short time to
that updates the display. perform a sanity check on the measurement and con-
vert it in software to any scaling of the measured quan-
One could equally well send information to the LCD tity that may be desired. The software conversion can
driver over the bus. In that case, one would set up the include corrections for nonlinearities in the transduc-
Accumulator with the digit select and data input bits, er's transfer function.
and execute a MOVX@ RO,A instruction. The LCD
driver's chip select would be driven by the CPU's WR Resolution is also controlled by software, and can even
signal. This is a little easier in software than the direct be dynamically varied to meet changing needs as a situ-
bit manipulation shown in Figure 21. However, it uses ation becomes more critical. For example, in a process
more I/O pins, unless there is already some external controller you can increase your resolution ("fine tune"
memory involved. In that case, no extra pins are used the control, as it were) as the process approaches its
up by adding the LCD driver to the bus. target.
UPDATE_LCD:
CLR ETl Disable LCD drive interrupt.
MOV DPTR. !lTABLE_ADDRESS Look-up table begins at TABL.E_ADDRESS
MOV A. BCD_VALUE Digits to be ,displayed.
SWAP A Move tens digit to low nibble.
ANL A.!lOFH Mask off high nibble.
MOVC A.C!!A+DPTR Tens digit pattl'r" to accumulator:
MOV TENS_DIGIT. A Update LCD tens digit.
MOV A. BCD_VALUE Digits to be displayed.
ANL A,4tOFH Mask off tens digit.
MOVC A,@A+DPTR Ones digit pattern to accum'ulator.
MOV C. DECIMAL_POINT Add 'dec 1mal point to segment
MOV ACC.7.C pattern. Update LCD decimal point
MOV ONES_DIGIT. A and ones di"git.
SETB ETl Re-enable LCD drive inteT'T'upt.
RET
270068-21
10-328
AP-252
range is Tx(Fmax-Fmin). For n-bit resolution For example, 8-bit resolution in the measurement of a
frequency that varies between 7 kHz and 9 kHz would
1 LSB = Tx(Fmax-Fmin) require, according to this formula; a sample time of 128
2" ms. The maximum acceptable frequency count would
be 128 ms X 9 kHz = 1152 counts. The minimum
Therefore the sample time required for n-bit resolution would be 896 counts. Subtracting 896 from each fre-
is quency count (or presetting the frequency counter to
- 896 = OFC80H) would allow the frequency to be
2" reported on a scale of 0 to FF in hex digits.
T = ::---=-=,---,--
Fmax-Fmin
BOC51BH
1 ) DIGIT )
{
2 SELECT
,.,
PORT
M}
B1
B2
DATA
INPUT
-v
)
L.
C.
D.
B3 v
"-
cs v
270068-22
UPDATE_LCD:
MOV A. DISPLAY _HI High byte of 4-digit display.
SETB DIGIT _SELECT _2 Select leftmost digit of LCD,
SETB DIGIT SELECT 1 (Digit address = lIB.)
CALL SHIFT -AND LOAD High nibble of high byte to selected digit
CLR DIGIT:=SELECT_1 Select second digit of LCD (address = lOB)
CALL SHIFT _AND_LOAD Low nibble of high byte to selected digit.
MOV A. DISPLAY LO Low byte of 4-digit display.
CLR DIGIT _SELECT_2 Select third digit of LCD.
SETB DIGIT _SELECT_1 (Digit address = DIE. 1
CALL SHIFT _AND_LOAD Hlgh nibble of low byte to selected digit.
CLR DIGIT _SELECT_1 Select fourth digit (address = OOBl.
CALL SHIFT_AND_LOAD Low nibble of low byte to selected digit.
RET
SHIFT _AND_LOAD:
RLC A MSB to carry bit (CY>
MOV DATA INPUT _B3. C CY to Oata Input pin B3.
RLC A Next bit to CY.
MOIJ DATA WPUT_B2. C CY to Oata Input pin B2.
RLC A
- Next bit to CV
DATA INPUT _E 1, C CV to Data Input pln 81.
MOV
RLC A
- Last bit to CV.
MOV DATA_INPUT_BO.C CV to Data Input pin eo.
CLR CHIP _SELECT Toggle Chip Select.
SETB CHIP _SELECT O-to-1 transition latches info.
RET
270068-23
10-329
inter AP-252
VSS
PERIOD MEASUREMENTS
270068-24 Measuring the period of the transducer signal means
measuring the total elapsed time over a known number,
Figure 22. Resonant Transducer Does Not N, of transducer pulses. The quantity that is directly
Require an AID Converter measured is NT, where T is the period of the transduc-
er signal in machine cycles. The relationship between T
To implement the measurement, one timer is used to in machine cycles and the transducer frequency F in
establish the sample time. The timer is preset to a value arbitrary frequency units is
that causes it to roll over at the end of the sample time,
generating an interrupt and waking the CPU from its Fxtal
Idle mode. The required preset value is the 2's comple· T = -F- x (1/12).
ment negative of the sample time measured in machine
cycles. The conversion from sample time to machine where Fxtal is the SOCS IBH clock frequency, in the
cycles is to multiply it by 1/12 the clock frequency. For same units as F.
example, if the cloqk frequency is 12 MHz, then a sam-
ple time of 128 ms is The full scale range then is Nx (Tmax-Tmin). For
n-bit resolution.
(128 ms) x (12000 kHz)/12 = 128000 machine cycles.
1 LSB = Ns(Tmax-Tmin).
Then the required preset value to cause the timer to roll 2n
over in 128 ms is '
Therefore the number of periods over which the elapsed
- 128000 = FEOCOO, in hex digits.
time should be measured is
Note that the preset value is 3 bytes wide whereas the 2n
timer is only 2 bytes wide. This means the timer must N = =T-m-ax-.=Tm---:-in
be augmented in software in the timer interrupt routine
to three bytes. The SOCS IBH has a DJNZ instruction
However, N must also be an integer. It is logical to
(decrement and jump if not zero) that makes it easier to
evaluate the above formula (don't forget Tmax and
code the third timer byte to count down instead of up.
Tmin have to be in machine cycles) and select for N the
If the third timer byte counts down, its reload value is
next higher integer. This selection gives a period mea-
the 2's complement of what it would be for an up-coun-
surement that has somewhat more than n-bit resolu-
ter. For example, if the 2's complement of the sample
tion, but it can be scaled back if desired.
time is FEOCOO, then the reload value for the third
timer byte would be 02, instead of FE. The timer inter-
For example, suppose we want 8-bit resolution in the
rupt routine might then be:
measurement of the period of a signal whose frequency
varies from 7.1 kHz to 9 ~Hz. If the clock frequency is
TIMER_INTERRUPT_ROUTINE:
12 MHz, then Tmax is (12000 kHz/1.1 kHz) x (1/12)
DNJZ THIRD_TIMER_BYTE,OUT
= 141 machine cycles. Tmin is 111 machine cycles.
MOV TLO,#O
The required value for N, then, is 256/(141-111) =
MOV THO,#OCH
8.53 periods, according to the formula. Using N = 9
MOV THIRD_TIMERBYTE,#2
periods will give a maximum NT value of 141 x 9 =
MOV FREQUENCY,COUNTER_LO
1269 machine cycles. The minimum NT will be III X
;Preset COUNTER to -896:
9 = 999 machine cycles. A lookup table can be used to
MOV COUNTER_LO,#80H
MOV COUNTER_HI,#OFCH
OUT: RETI
10·330
intJ AP-252
10-332
AP-252
10-333
APPLICATION AP-281
NOTE
July 1986
CHRISTOPHER SCOTT
TECHNICAL MARKETING ENGINEER
INTEL CORPORATION
UPI·452 iAPX 286 SYSTEM Programmable FIFO channel Thr~sholds are another
CONFIGURATION unique feature of the UPI-452. The Thresholds provide
for interrupting the Host only when the Threshold
The interface described in this application note is number of bytes can be read or written to the FIFO
shown in Figure I, iAPX 286 UPI-452 System Block
buffer. This further decouples the Host UPI-452 inter"
Diagram. The iAPX 286 system is configured in a local face by relieving the Host of polling the buffer to deter-
bus architecture design. DMA between the Host and mine the number of bytes that can be read or written. It
the UPI-452 is supported by the 82258 Advanced also red \Ices the chances of overrun and underrun er-
DMA Controller. The Host microprocessor accesses all rors which must be processed.
UPI-452 externally addressable registers through ad-
o dress decoding (see Table 3, UPI-452 External Address The UPI-452 also provides a means of bypassing the
Decoding). The timings and interface descriptions be- FIFO, in both directions, for an immediate interrupt of
low are given in equation form with examples of specif- either the Host or internal CPU. These commands are
ic calculations. The goal of this application note is a set called Immediate Commands. A complete description
of interface analysis equations. These equations are the of the internal FIFO logic operation is given in the
tools a system designer can use to fully utilize the fea- FIFO Data Structure section.
tures of the UPI-452 to achieve maximum system per-
formance.
10-335
l
- PCLK
READY
CLK
RST
h
r°'-'
MRDC
MWRC
WAIT
STATE ~
X2 XI -
10RC
10WC
h GENERATOR
~ MRDC
50,51
M/iO II MWRC
:!II
ID
RE' . E T t l
RES READY
50,51 DEN
READY DT/R I •
...
C
CD
1 CLK
RESET
PCLK
-
-
CLK
82288
ALE
INTA
I ADDRESS
"
RAM/EPROM
cs
-
:'" I II I •
.
DECODE
~ 82284 LOGIC ,...., ~
_rD~
"U
>< l ......
~
RESET PORTO
-I/o PORTS
~
I\) RST
III
aI ~~ READ PORTI OR
-LOCAL
~..
- Milo WRITE
I:: EXPANSION
....
0
c.,
:!!
J,.
en
80286
.£t
STB
OE
-
.,....-- P CS
AO-A2
PORT2
PORT3
BUS
-ALTERNATE
FUNCTIONS .
»
."
t.) I\)
en
AI5-AO -- LATCH PORT4
N
....
Q)
-
Ol BHE
UPI-452
'<
III HLD/ IN~
HLDA DO-DI5
DACK I-
CD DRQIN/
3 INTRQIN
~
UI DRQOUT!
0- TRAN5CEIVER INTRQOUT
n
;0;-
C ""! LL"[I ~ OE
00-07
...s-i
INTRQ
bk:
SO,S I HLDA DO
iii' ........ READY EN
ID ' - - ........ CL~ AI5-AO,,_
iii ...... M/IO
0!CS
3 RO
ViR IRO
82258
OMA
AO-Al IRI f+-1
INTA IR2
INT
8259A
ORQO
ORQl
~
OACK 0,1
292018-1
AP-281
UPI-4S2 INITIALIZATION Host read/write access of the FIFO. The internal CPU
sets the Slave Control (SLCON) SFR FIFO DMA
The UPI-4S2 at power-on reset automatically performs Freeze/Normal Mode (FRZ) bit high (= 1) to activate
a minimum initialization of itself. The UPI-4S2 notifies Normal Mode. Ths causes the Slave Status (SSTAT)
the Host that it is in the process of initialization by and Host Status (HSTAT) SFR FIFO DMA Freeze
setting a Host Status SFR bit. The user UPI-4S2 pro- Mode bits to be set to Normal Mode. Table 2, UPI-4S2
gram must release the UPI-4S2 from initialization for Initialization Event Sequence Example, shows a sum-
the FIFO to be accessible by the Host. This is the mini- mary of the initialization events described above.
mum Host to UPI-4S2 initialization sequence. All fur-
ther initialization and configuration of the UPI-4S2, in- Table 1. FIFO SpeCial Function
cluding the FIFO, is done by the internal CPU under Register Default Values
user program control. No interaction or programming
Reset
is required by the Host 80286 for UPI-4S2 initializa- SFR Name Label
Value
tion.
Channel Boundary Pointer CBP 40H/640
At power-on reset the UPI-4S2 automatically enters Output Channel Read Pointer ORPR 40H/640
Output Channel Write Pointer OWPR 40H/640
FIFO DMA Freeze Mode by resetting the Slave Con-
Input Channel Read Pointer IRPR OOH/DO
trol (SLCON) SFR FIFO DMA Freeze/Normal Mode Input Channel Write Pointer IWPR DOH/OO
bit to FIFO DMA Freeze Mode (FRZ = "0"). This Input Threshold ITH DOH/OO
forces the Slave Status (SSTAT) and Host Status Output Threshold OTH 01 H/1 0
(HSTAT) SFR FIFO DMA Freeze/Normal Mode bits
to FIFO DMA Freeze Mode In Progress. FIFO DMA Table 2. UPI-452 Initialization
Freeze Mode allows the FIFO interface to be config- Event Sequence Example
ured, by the internal CPU, while inhibiting Host access
Event Description SFR/bit
to the FIFO.
Power-on Reset
The MODE SFR is forced to zero at reset. This dis- UPI-4S2 forces FIFO OMA SLCON FRZ = 0
ables, (tri-states) the DRQIN/INTRQIN, DRQOUT/ Freeze Mode (Host access to
INTRQOUT and INTRQ output pins. INTRQ is in- FIFO inhibited)
hibited from going active to reflect the fact that a 'Host UPI-4S2 forces Slave Status and SSTAT SSTS = 0
Status SFR bit, FIFO DMA Freeze Mode, is active. If Host Status SFR to FIFO OMA HSTAT HST1 = 1
the MODE SFR INTRQ configure bit is enabled Freeze Mode In Progress
(= 'I '), before the Slave Control and Host Status SFR
FIFO DMA Freeze/Normal Mode bit is set to Normal UPI-4S2 forces all SFRs,
Mode, INTRQ will go active immediately. including FIFO SFRs, to default
values.
The first action by the Host following reset is to read • UPI-4S2 user program enables MOOEM04 = 1
the UPI-4S2 Host Status SFR Freeze/Normal Mode INTRa, INTRa goes active, high
bit to determine the status of the interface. This may be • Host READ's UPI-4S2 Host
done in response to a UPI-4S2 INTRQ interrupt, or by Status (HSTAT) SFR to
polling the Host Status SFR. Reading the Host Status determine interrupt source,
SFR resets the INTRQ line low. INTRa goes low
Any of the five FIFO interface SFRs, as well as a vari- • UPI-4S2 user program initializes
ety of additional features, may be programmed by the any other SFRs; FIFO, Interrupts,
internal CPU following reset. At power-on reset, the Timers/Counters, etc.
five FIFO Special Function Registers are set to their User program sets Slave Control SLCON FRZ = 1
default values as listed in Table 1. All reserved location SFR to Normal Mode (Host
bits are set to one, all other bits are set to zero in these access to FIFO enabled)
three SFRs. The FIFO SFRs listed in Table I can be UPI-4S2 forces Slave and Host SSTAT SST5 = 1
programmed only while the UPI-4S2 is in FIFO DMA Status $FRs bits to Normal HSTAT HST1 = 0
Freeze Mode. The balance of the UPI-4S2 SFRs default Operation
values and descriptions are listed in the UPI-4S2 Ad-
• Host polls Host Status SFR to
vance Data Sheet in the Intel Microsystems Compo- determine when it can access the
nent Handbook Volume II and Microcontroller Hand- FIFO
book. -or-
• Host waits for UPI-4S2 Request
The above sequence is the minimum UPI-4S2 internal for Service interrupt to access
initialization required. The last initialization instruction
FIFO
must always set the UPI-4S2 to Normal Mode. This
causes the UPI-4S2 to exit Freeze Mode and enables • user option
10-337
AP-281
The UPI-4S2 provides three means of communication A Data Stream Command (DSC) acts as an internal
between the Host microprocessor and the UPI-4S2 in service routine vector. The DSC generates an interrupt
either direction; to a service routine which reads the DSC. The DSC
byte acts as an address vector to a user defined service
Data routine. The address can be any program or data mem-
Data Stream Commands ory location with no restriction on the number of DSCs
Immediate Commands or address boundaries.
Data and Data Stream Commands (DSC) are trans- A Data Stream Command (DSC) can also be used to
ferred between the Host and UPI-4S2 through the UPI- clear data from the FIFO or "FLUSH" the FIFO. This
4S2 FIFO buffer. The third, Immediate Commands, is done by appending a DSC to the end of a block of
provides a means of bypassing the FIFO entirely. These data entered in the FIFO which is less than the pro-
three data types are in addition to direct access by ei- grammed threshold number of bytes. The DSC will
ther Host or Internal CPU of dedicated Status and cause an interrupt, if enabled, to the respective receiv-
Control Special Function Registers (SFR). ing CPU. This ensures that a less than Thresholdnum-
ber of bytes in the FIFO will be read. Two conditions
The FIFO appears to both the Host 80286 and the in- force a Request for Service interrupt, if enabled, to the
ternal CPU as 8 bits wide. Internally the FIFO is logi- Host. The first is due to a Threshold number of bytes
cally nine bits wide. The ninth bit indicates whether the having been written to the FIFO Output channel; the
byte is a data or a Data Stream Command (DSC) byte; second is if a DSC is written to the Output FIFO chan-
o = data, 1 = DSC. The ninth bit is set by the FIFO nel. Ifiess than the Threshold number of bytes are writ-
logic in response to the address specified when writing ten to the Output FIFO channel, the Host Status SFR
to the FIFO by either Host or internal CPU. The FIFO flag will not be set, and a Request for Service interrupt
uses the ninth bit to condition the UPI-4S2 interrupts will not be generated, if enabled. By appending a DSC
and status flags as a byte is made available for a Host or to end of the data block, the FIFO Request for Service
internal CPU read from the FIFO. Figures 2 and 3 flag and/or interrupt will be generated.
show the structure of each FIFO channel and the logi-
cal ninth bit. An example of a FIFO Flush application is a mass stor-
age subsystem. The UPI-4S2 provides the system inter-
It is important to note that both data and DSCs are face to a subsystem which supports tape and disk stor-
actually entered into the FIFO buffer (see Figures 2 age. The FIFO size is dynamically changed to provide
and 3). External addressing of the FIFO determines the the maximum buffer size for the direction of transfer.
state ofthe internal FIFO logic ninth bit. Tabie 3 shows Large data blocks are the norm in this application. The
the UPI-4S2 External Address Decoding used by the FIFO Flush provides a means of purging the FIFO of
Host and the corresponding action. The internal CPU the last bytes of a transfer. This guarantees that the
interface to the FIFO is essentially identical to the ex- block, no matter what its size, will be transmitted out of
ternal Host interface. Dedicated internal Special Func- the FIFO.
tion Registers provide the interface between the FIFO,
internal CPU and the internal two channel DMA proc- Immediate Commands allow more direct communica-
essor. FIFO read and write operations by the Host and tion between the Host processor and the UPI-4S2 by
internal CPU are interleaved by the UPI-4S2 so they bypassing the FIFO in either direction. The Immediate
appear to be occurring simultaneously. Command IN and OUT SFRs are two more unique
address locations externally and internally addressable.
The ninth bit provides a means of supporting two data Both DSCs and Immediate Commands have internal
types within the FIFO buffer. This feature enables the interrupts and interrupt priorities associated with their
Host and UPI-4S2 to transfer both commands and data operation. The interrupts are enabled or disabled by
while maintaining the decoupled interface a FIFO buff- setting corresponding bits in the Slave Control
. er provides. The logical ninth bit provides both a means (SLCON), Interrupt Enable (IEC), Interrupt Priority
of embedding commands within a block of data and a (IPC) and Interrupt Enable and Priority (IEP) SFRs. A
means for the internal CPU, or external Host, to dis- detailed description of each of these may be found in
criminate between data and commands. Data or DSCs the UPI-4S2 Advance Information Data Sheet.
may be written in any order desired. Data Stream
10-338
AP-281
o
i3
g
..J
o
a::
9TH I-
z
INPUT o
FIFO
o
B
I CHANNEL '-
T
INTERNAL CPU
(DATA PROCESSOR)
292018-2
10-339
intJ AP-281
o
§
...J
o
9TH e:z
OUTPUT
B rlFO 8
I
T
CHANNEL
"....
01----------......
§
o
~I¢:==:~
;;:
INTERNAL CPU
(DATA PROCESSOR)
292018-3
10-340
AP-281
Below is a detailed description of each FIFO channel's UPI-4S2 Internal Write to the FIFO
operation, including the FIFO logic response to the
ninth bit, as a byte moves through the channel. The The internal CPU writes data and Data Stream Com-
description covers each of the three data types for each mands into the FIFO through the FIFO OUT (FOUT)
channel. The details below provide a picture of the vari- and Command OUT (COUT) SFRs. Wh,~n a Thresh-
ous FIFO features and operation. By understanding the old number of bytes has been written, the Host Status
FIFO structure and operation the user can optimize the SFR Output FIFO Request for Service bit is set and an
interface to meet the requirements of an individual de- interrupt, if enabled, is generated to the Host. Either
sign. the INTRQ or DRQOUT/INTRQOUT output pins
can be used for this interrupt as determined by the
MODE and Host Control (HCON) SFR setting. The
OUTPUT CHANNEL Host responds to the Request for Service interrupt by
reading the Host Status (HSTAT) SFR to determine
This section covers the data path from the internal the source of the interrupt. The Host then reads the
CPU to the HOST. Data Stream Command or Immedi- Threshold number of bytes from the FIFO. The inter-
ate Command processing during ,Host DMA Opera- nal CPU may continue to write to the FIFO during the
tions is covered in the DMA section. Host read of the FIFO Output channel.
10-341
AP-281
Data Stream Commands may be written to the Output The most efficient Host read operation of the FIFO
FIFO channel at any time during a write of data bytes. Output channel is through the use of Host DMA. The
The write instruction need only specify the Command UPI-452 fully supports external DMA handshaking.
Out (coUT) SFR in the direct register instruction The MODE and Host Control SFRs control the config-
used. Immediate Commands may also be written at any uration of UPI-452 Host DMA handshake outputs. If
time to the Immediate Command OUT (IMOUT) SFR. Host DMA is used the Threshold Request for Service
The Host reads Immediate Commands from the Imme- interrupt asserts the UPI-452 DMA Request
diate Command OUT (IMOUT). (DRQOUT) output. The Host DMA processor ac-
knowledges with DACK which acts as a chip select of
The internal CPU can determine the number of bytes to the FIFO channels. The DMA transfer would stop
write to the FIFO Output channel in one of three ways. when either the threshold byte count had been read, as
The first, and most efficient, is by utilizing the internal programmed in the Host DMA processor, or when the
DMA processor which will automatically manage the DRQOUT output is brought inactive by the UPI-452.
writing of data to avoid Underrun or 'Overrun Errors.
The second is for the internal CPU to read the Output
FIFO channels Read and Write Pointers and compare INPUT CHANNEL
their values to determine the available space. The third
method for determining the available FIFO space is to This section covers the data path from the HOST to the
always write the programmed channel size number of internal CPU or internal DMA processor. The details
bytes to the Output FIFO. This method would use the of. Data Stream Command or Immediate Command
Overrun Error flag and interrupt to halt FIFO writing processing during internal DMA operations are cov-
whenever the available space was less than the channel ered in the DMA section below.
size. The interrupt service routine could read the chan-
nel pointers to determine or monitor the available chan-
nel space. The time required for the internal CPU to Host Write to the FIFO
write data to the Output FIFO channel is a function of
the individual instruction cycle time and the number of The Host writes data and Data Stream Commands into
bytes to be written. the FIFO through the FIFO IN (FIN) and Command
IN (CIN) SFRs. When a Threshold number of bytes
has been read out of the Input FIFO channel by the
Host Read from the FIFO internal CPU, the Host Status SFR Input FIFO Re-
quest for Service bit is set and an interrupt, if enabled,
The Host reads data or Data Stream Commands (DSC) is generated to the Host. The Input. FIFO Threshold
from the FIFO in response to the Host Status interrupt tells the Host that it may write the next block
(HSTAT) SFR flags and interrupts, if enabled. All of data into the FIFO. Either the INTRQ or DRQIN/
Host read operations access the same UPI-452 internal INTRQIN output pins can be used for this interrupi as
I/O ButTer Latch. At the end of the previous Host determined by the MODE and Host Control (HCON)
FIFO read' cycle a byte is loaded from the FIFO into SFR settings. The Host may continue to write to the
the I/O Buffer Latch and Host Status (HSTA T) SFR FIFO Input channel during the internal CPU read of
bit 5 is set or cleared (I = DSC, 0 = data) to reflect the FIFO. Data Stream Commands may be written to
the state of the byte'S FIFO ninth bit. If the FIFO ninth the FIFO Input channel at any time during a write of
bit is set (= 1) indicating a DSC, an interrupt is gener- data bytes. Immediate Commands may also be written
ated to the external Host via INTRQ pin or at any time to the Immediate Command IN (IMIN)
INTRQIN/INTRQOUT pins as determined by Host SFR.
Control (HCON) SFR bit 1. The Host then reads the
Host Status (HSTAT) SFR to determine the source of
the interrupt.
10-342
inter AP-281
The Host also has three methods for determining the reads the Slave Status (SSTAT) SFR to determine the
available FIFO space. Two are essentially identical to source of the interrupt and service the Immediate Com-
that of the internal CPU. They involve reading the mand.
FIFO Input channel pointers and using the Host Status
SFR Underrun and Overrun Error flags and Request
for Service interrupts these would generate, if enabled FIFO INPUTIOUTPUT CHANNEL SIZE
in combination. The third involves using the UPI-4S2
Host DMA controller handshake signals and the pro-
grammed Input FIFO Threshold. The Host would re- Host
ceive a Request for Service interrupt when an Input
FIFO channel has a Theshold number of bytes able to The Host does not have direct control of the FIFO
be written by the Host. The Host service routine would Input or Output channel sizes or configuration. The
then write the Threshold number of bytes to the FIFO. Host can, however, issue Data Stream Commands or
Immediate Commands to the UPI-4S2 instructing the
If a Host DMA is used to write to the FIFO Input UPI-4S2 to reconfigure the FIFO interface by invoking
channel, the Threshold Request for Service interrupt FIFO DMA Freeze Mode. The Data Stream Com-
could assert the UPI-4S2 DRQIN output. The Host mand or Immediate Command would be a vector to a
DMA processor would assert DACK and the FIFO service routine which performs the specific reconfigura-
write would be completed by Host the DMA processor. tion.
The DMA transfer would stop when either the Thresh-
old byte count had been written or the DRQIN output
was removed by the UPI-4S2. Additional details on UPI-452 Internal
Host and internal DMA operation is given below.
The default power-on reset FIFO channel sizes are list-
ed in the "Initialization" section and can be set only by
Internal Read of the FIFO the internal CPU during FIFO DMA Frcczc Mode.
The FIFO channel size is selected 10 ac:hicve Ihe opli-
At the end of an internal CPU read cycle a byte is mum application performance. The enlirc 12H hyle
loaded from the FIFO buffer into the FIFO IN/Com- FIFO can be allocated to either the Input or Output
mand IN SFR and Slave Status (SSTAT) SFR bit lis . channel. In this case the other channel consists of a
set or cleared (I = data, 0 = DSC) to reflect the state single SFR; FIFO IN/Command IN or FIFO OUT/
of the FIFO ninth bit. If the byte is a DSC, the FIFO Command OUT SFR. Figure 4 shows a FIFO division
ninth bit is set (= I) and an interrupt is generated, if with a portion devoted to each channel. Figure 5 shows
enabled, to the Internal CPU. The internal CPU then a FIFO configuration with a11128 bytes assigned to the
reads the Slave Status (SSTAT) SFR to determine the Output channel.
source of the interrupt.
The FIFO channel Threshold feature allows the user to
Immediate Commands are written by the Host and match the .FIFO channel size and the performance of
read by the internal CPU through the Immediate Com- the internal and Host data transfer rates. The pro-
mand IN (IMIN) SFR. Once written, an Immediate grammed Threshold provides an elasticity to the data
Command sets the Slave Status (SSTAT) SFR flag bit transfer operation. An example is if the Host FIFO
and generates an interrupt, if enabled, to the internal
CPU. In response to the interrupt the internal CPU
HOST CPU
FIFO
INPUT FIFOINSFR ~
CHANNEL CHANNEL
INTERNAL
BOUNDRY ~.t---"'" CPU
POINTER FIFO
(CBP) OUTPUT FIFO OUT SFR
CHANNEL
HOST CPU
292018-4
10-343
AP-281
CHANNEL
HOST cpu-+I FIFO IN SFR 1-+
INTERNAL
BOUNDRY -+ CPU
POINTER FIFO
(CBP) INPUT
CHANNEL
H fiFO OUT SFR . J+-
~
HOST CPU
292018-5
data transfer rate is twice as fast as the internal FIFO this example the default 64 bytes per channel might be
DMA data transfer rate. In this example the FIFO In- adequate for both channels.
put channel size is programmed to be 64 bytes and the
Input channel Threshold is programmed to be 20 bytes.
The Host writes the first 64 bytes to the Input FIFO. INTERRUPT RESPONSE TIMING
When the internal DMA processor has read 20 bytes
the Threshold interrupt, or DMA request (DRQIN), is Interrupts enable the Host UPI"452 FIFO buffer inter-
generated to signal the Host.to begin writing.more data face and the internal CPU FIFO buffer interface to
to the Input FIFO channel. The internal DMA proces- operate with a minimum of overhead on the respective
sor continues to read data from the Input channel as CPU. Each CPU is "interrupted" to service the FIFO
the Host, or Host DMA processor, writes to the FIFO. on an as needed basis only. In configuring the FIFO
The Host can write 40 bytes to the FIFO Input chan- buffer Thresholds and choosing the appropriate inter-
nels in the time it takes for the internal DMA processor nal DMA Mode the user must take into account the
to read 20 more bytes from it. This will keep both the interrupt response time for both CPUs. These response
Host and internal DMA operating at their maximum times will affect the DMA transfer rates for each chan-
rates without forcing one to wait for the other. nel. By choosing FIFO channel Thresholds which re-
flect both the respective DMA transfer rate and the
Two methods of managing the FIFO size are possible; interrupt response time the user will achieve the maxi-
fixed and variable channel size. A fixed channel size is mum data throughput and system bus decoupling. This
one where the channel is configured at initialization in turn will mean the overall available system bus band-
and remains unchanged throughout program execution. width will increase.
In a variable FIFO channel size. the configuration is
changed dynamically to meet the data transmission re- The following section describes the FIFO interrupt in-
quirements as needed. An example of a variable chan- terface to the Host and internal CPU. It also describes
nel size application is the mass storage subsystem de- an analysis of sample interrupt response times for the
scribed earlier. To meet the demands of a large data Host and UPI-452 internal cpu. These equations and
block transfer the FIFO size could be fully allocated to the example times shown are then used in the DMA
the Input or Output channel as needed. The Thresholds section to further analyze an optimum Host UPI-452
are also reprogrammed to match the respective data interface.
transfer rates.
10-344
AP-281
(OTHR) SFRs. Additional interrupts are provided for To initiate the interrupt the UPI-452 activates the
FIFO Underrun and Overrun Errors, Data Stream INTRQ output. The interrupt acknowledge sequence
Commands, and Immediate Commands. Table 4 lis~s requires two bus cycles, 400 ns (10 MHz iAPX 286),
the eight UPI-452 interrupt sources as they appear In for the two INTA pulse sequence.
the HSTAT SFR to the Host processor. Equation 1. Host Interrupt Response Time
Table 4 UPI-4S2 to Host Interrupt Sources
Bus
HSTAT Action Time
Interrupt Source Cycles'
SFR Bit Current instruction execution
HST7 Output FIFO Underrun Error completion 800 ns 4
HST6 Immediate Command Out SFR Status INTA sequence 400 ns .2
Interrupt service routine (time
HST5 Data Stream Command/Data at Output to host first READ of UPI-452) 2000 ns 10
FIFO Status
Total Interrupt Response Time 2.3/Ls 16
HST4 Output FIFO Request for Service Status
HST3 Input FIFO Overrun Error Condition NOTE:
10 MHz iAPX 286 bus cycle, 200 ns each
HST2 Immediate Comamnd In SFR Status
HST1 FIFO DMA FreezelNormal Mode
Status UPI-4S2 Internal
HSTO Input FIFO Request for Service
The internal CPU FIFO interrupt interface is essential-
ly identical to that of the Host to the FIFO. T~ree
. The interrupt response time required by the Host proc- internal interrupt sources support the FIFO operatIOn;
essor is application and system specific. In general, a FIFO-Slave bus Interface Buffer, DMA Channel 0 and
typical sequence of Host interrupt response eve~ts a~d DMA Channell Requests. These interrupts provide a
the approximate times associated with each are listed In maximum decoupling of the FIFO buffer and the inter-
Equation 1. nal CPU. The four different internal DMA Modes
available add flexibility to the interface.
The example assumes the hardware configuration
shown in Fjgure 1, iAPX 286IUPI-452 Block Diagram, The FIFO-Slave Bus Interface interrupt response is
with an 8259A Programmable Interrupt Controller. also similar to the Host response to an INTRQ Request
The timing analysis in Equation I also assumes the fol- for Service interrupt. The internal CPU responds to the
lowing; no other interrupt is either in process or pend- interrupt by reading the Slave Status (SSTAT) SFR to
ing, nor is the 286 in a LOCK condition. The current determine the source of the interrupt. This allows the
instruction completion time is 8 clock cycles (800 ns @ user to prioritize the Slave Status flag response to meet
10 MHz), or 4 bus cycles. The interrupt service routine the users application needs.
first executes a PUSHA instruction, PUSH All General
Registers, to save all iAPX 286 internal registers. This The internal interrupt response time is dependent on
requires 19 clocks (or 2.0 /Ls @ 10 MHz), or 10 bus the current instruction execution, whether the interrupt
cycles (rounded to complete bus cycle). The next serv- is enabled, and the interrupt priority. In general, to fin-
ice routine instruction reads the UPI-452 Host Status ish execution of the current instruction, respond to the
SFR to determine the interrupt source. interrupt request,·push the Program Counter (PC) and
vector to the first instruction of the interrupt service
It is important to note that any UPI-452 INTRQ inter- routine requires from 38 to 86 oscillator periods (2.38
rupt service routine should ALWAYS mask for the to 5.38 /Ls @ 16 MHz). If the interrupt is due to an
Freeze Mode bit first. This will insure that Freeze Immediate Command or DSC, additional time is re-
Mode always has the highest priority. This will also quired to read t.he Immediate Command or DSC SFR
save the time required to mask for bits which are forced and vector to the appropriate service routine. This
inactive during Freeze Mode, before checking the means two service routines back to back. One service
Freeze Mode bit. Access to the FIFO channels by the routine to read the Slave Status (SSTAT) SFR to deter-
Host is inhibited during Freeze Mode. Freeze Mode is mine the source of the Request for Service interrupt,
covered in more detail below. and second the service routine pointed to by the Imme-
diate Command or DSC byte read from the respective
SFR.
10-345
inter Ap-281
The maximum DMA transfer rate is achieved by the 2 Cycle DMA Transfer-I/O (UPI-452) to System
minimum DMA transfer cycle time to accomplish a Memory
source to destination move. The minimum Host UPI- FIFO channel size' (DMA READ/WRITE
452 FIFO DMA cycle time possible is determined by FIFO time + DMA WRITE/READ Memory
the READ and WRITE pulse widths, UPI-452 com- Time)
mand recovery times in relation to the DMA transfer 128 bytes' (200 ns + 200 ns)
timing and DMA controller transfer mode used. Table 51.2 Jks
5 shows the relationship between the iAPX-286, iAPX- 256 bus cycles'
186 and UPI-452 for various DMA as well as non-
DMA byte by byte transfer modes versus processor fre- NOTES:
quencies. '10 MHz iAPX 286, 200 ns bus cycles.
Host processor speed vs wait states required with UPI- The UPI-452 design is optimized for high speed DMA
452 running at 16 MHz: ' transfers between the Host and the FIFO buffer. The
10-346
intJ AP-281
UPI-452 internal FIFO buffer control logic provides The third handshake signal pin is DACK which is used
the necessary synchronization of the external Host as a chip select during DMA data transfers. The UPI-
event and the internal CPU machine cycle during 452 Host READ and WRITE input signals select the
UPI-452 RD/WR accesses. This internal synchroniza- respective Input and Output FIFO channel during
tion is addressed by the TCC AC specification of the DMA transfers. The CS and address lines provide
UPI-452 shown in Figure 6. TCC is the time from the DMA acknowledge for processors with onboard DMA
leading or trailing edge of a UPI-452 RD/WR to the controllers which do not generate a DACK signal.
same edge of the next UPI-452 RD/WR. The TCC
time is effectively another way of measuring the system The iAPX 286 Block I/O Instructions provide an alter-
bus cycle time with reference to UPI-452 accesses. native to two cycle DMA data transfers with approxi-
mately the same data rate. The String Input and Out-
In the iAPX-286 10 MHz system depicted in this appli- put instructions (INS & OUTS) when combined with
cation note the bus cycle time is 200 ns. Alternate cycle the Repeat (REP) prefix, modifies INS and OUTS to
accesses of the UPI-452 during two cycle DMA opera- provide a means of transferring blocks of data between
tion yields a TCC time of 400 ns which is more than the I/O and Memory. The data transfer rate using REP
TCC minimum time of 375 ns. Back to back Host INS/OUTS instructions is calculated in the same way
UPI-452 READ/WRITE accesses may require wait as two cycle DMA transfer times. Each READ or
states as shown in Table 5. The difference between 10 WRITE would be 200 ns in a 10 MHz iAPX 286 sys-
MHz iAPX-186 and 10 MHz iAPX 286 required wait tem. The maximum transfer rate possible is 2.5
states is due to the number of clock cycles in the respec- MBytes/second. The Block I/O FIFO data transfer
tive bus cycle timings. The four clocks in a 10 MHz calculation is the same as that shown in Equation 2 for
iAPX 186 bus cycle means a minimum TCC time of two cycle DMA data transfers including TCC timing
400 ns versus 200 ns for a 10 MHz iAPX 286 with two effects.
clock cycle zero wait state bus cycle.
DMA handshaking between the Host DMA controller FIFO Data Structure and Host DMA
and the UPI-452 is supported by three pins on the UPI-
452; DRQIN/INTRQIN, DRQOUT/INTRQOUT During a Host DMA write to the FIFO, if a DSC is to
and DACK. The DRQIN/INTRQIN and DRQOUT/ be written, the DMA transfer is stopped, the DSC is
INTRQOUT outputs are two multiplexed DMA or in- written and the DMA restarted. During a Host DMA
terrupt request pins. The function of these pins is con- read from the FIFO, if a DSC is loaded into the I/O
trolled by MODE SFR bit 6 (MD6). DRQIN and Buffer Latch the DMA request, DRQOUT, will be de-
DRQOUT provide a direct interface to the Host system activated (see Figure 2 above). The Host Status
DMA controller (see Figure 1). In response to a (HSTAT) SFR Data Stream Command bit is set and
DRQIN or DRQOUT request, the Host DMA control- the INTRQ interrupt output goes active, if enabled.
ler initiates control of the system bus using HLD/ The Host responds to the interrupt as described above.
HLDA. The FIFO Input or Output channel transfer is
accomplished with a minimum of Host overhead and
system bus bandwidth.
RD#/WR# ----J-\~ I I ~
____T_R_V_~ TRR/TWW, ~
TRR/TWW \-4t
292018-6
10-347
inter AP-281
Once INTRQ is deactivated and the DSC·has been read (Memory Mapped or I/O) to 286 System Memory
by the Host, the DMA request,DRQOUT, is reassert- transfer as described earlier. The equations do not ac-
ed by the UPI-452. The DMA request then remains count for the latency of intiating the DMA transfer.
active until the transfer is complete or another DSC is
loaded into the I/O Buffer Latch. Equation 3. Minimum host FIFO DMA Transfer
Rate Including Data Stream Command(s)
An Immediate Command written by the internal CPU
during a Host riMA FIFO transfer also causes the Minimum Host/FIFO DMA Transfer Rate wI DSC
Host- Status flag and INTRQ to go active ifenabled. In FIFO size· Host DMA 2 cycle time transfer rate
this case the Immediate Command would not terminate + iAPX 286 interrupt response time (Eq. # 1)
the DMA transfer unless terminated by the Host. The (32 bytes· (200 ns + 200ns)) + 2.3 p.s
INTRQ line remains active until the Hostreads the 15.1 p.s -
Host Status (HSTAT) SFR to determine the source of 75.5 bus cycles (@10 MHz iAPX286, 200ns
the interrupt. bus cycle)
Machine
Source Destination @12MHz @16MHz
Cycles'·
Internal Data Internal Data
Mem.orSFR Mem.orSFR 1 1 p.s 750 ns
Internal Data External Data
Mem.orSFR Mem. 1 1 p.s 750 ns
External Data Internal Data
Mem. Mem.orSFR 1 1 p.s 750ns
·External Data External Data
Memory Memory 2 2 p.s 1.5 p.s
. NOTES:
"External Data Memory DMA transfer applies to UPI-4S2 Local Bus only.
··MSC-S1 Machine cycle = 12 clock cycles (TCLCL).
10-348
inter AP-281
It is important to note that the internal DMA processor A DMA transfer between the Host and UPI-452 FIFO
modes and the internal FIFO logic work together to with a block size greater than the programmed FIFO
automatically manage internal DMA transfers as data channel size introduces additional overhead. This addi-
moves into and out of the FIFO.· The two most appro- tional overhead is from three sources; first, is the time
priate internal DMA processor modes for the FIFO are to actually perform the DMA transfer. Second, the
FIFO Demand Mode and FIFO Alternate Cycle Mode. overhead of initializing the DMA processor, third; the
In FIFO Demand Mode, once the correct Slave Con- handshaking between each FIFO block required to
trol and DMA Mode bits are set, the internal Input transfer the entire data block. This could be time to
FIFO channel DMA transfer occurs whenever the wait for the FIFO to be emptied and/or the interrupt
Slave Control Input FIFO Request for Service flag is response time to restart the DMA transfer of the next
set. The DMA transfer continues until the flag is portion of the block. A fourth component may also be
cleared or when the Input FIFO Read Pointer SFR the time required to respond to Underrun and Overrun
(IRPR) equals zero. If data continues to be entered by FIFO Errors.
the Host, the internal DMA continues until an internal
interrupt of higher priority, if enabled, interrupts the Table 7 shows six typical FIFO Input/Output channel
DMA transfer, the internal DMA byte count reaches sizes and the Host DMA transfers times for each. The
zero or until the Input FIFO Read Pointer equals zero. timings shown reflect a 10 MHz system bus two cycle
A complete description of interrupts and DMA Modes I/O tq Memory DMA transfer rate of 2.5 MBytes/sec-
can be found in the UPI-452 Data Sheet. ond as shown in Equation 1. The times given would be
the same for iAPX 286 I/O block move instructions
REP INS and REP OUTS as described earlier..
DMAModes
Table 7_ Host DMA FIFO Data Transfer Times
The internal DMA processor has four modes of opera-
tion. Each DMA channel is software programmable to FIFO Size: 32 43 64 85 96 128 I bytes
operate in either Block Mode or Demand Mode. De- Full or Empty % % % % % Full or Empty
mand Mode may be further programmed to operate in Time 12.8 1i2 25.6 34.0 38.4 51.21 /Ls
Burst or Alternate Cycle Mode. Burst Mode causes the
internal processor to halt its execution and dedicate its
resources exclusively to the DMA transfer. Alternate Table 8 shows six typical FIFO Input/Output channel
Cycle Mode causes DMA cycles and instruction cycles sizes and the internal DMA processor data transfers
to occur alternately. A detailed description of each times for each. The timings shown are for a UPI-452
DMA Mode can be found in the UPI-452 Data Sheet. single cycle Burst Mode transfer at 16 MHz or 750 ns
per machine cycle in or out of the FIFO channels. The
10-349
inter AP-281
machine cycle time is that of the MSC-51 CPU; 6 channel. As described above in the FIFO Data Struc-
states, 2 XTAL2 clock cycles each or 12 clock cycles ture section, the block size would have to be deter-
per machine cycle. Details on the MSC-51 machine cy- mined by reading the channel read and write pointer
cle timings and operation may be found in the Intel and calculating the space available. Another alternative
Microcontroller Handbook. uses the FIFO Overrun and Underrun Error flags to
manage the tr~sfers by accepting error flags. In either
Table 8. UPI-452 Internal DMA FIFO case the instructions needed have a significant impact
Data Transfer Times on the internal FIFO data transfer rate latency equa-
tion.
FIFO Size: 32 43 64 85 96 I
128 bytes
Full or Empty 114 113 % % % Full or Empty A typical effective internal FIFO channel transfer rate
Time 24.0 32.3 48.0 64.6 72.0 96.0 I /Ls using internal DMA is shown in Equation 4. Equation
5 shows the latency using byte by byte transfers with an
arbitrary factor added for internal CPU block size cal-
A larger than programmed FIFO channel size data culation. These two equations contrast the effective
block internal DMA transfer requires internal arbitra- transfer rates when using internal DMA versus individ-
tion. The UPI-452 provides a variety of features which ual instructions to transfer 128 bytes. The effective
support arbitration between the two internal DMA transfer rate is approximately four times as fast using
channels and the FIFO. An example is the internal DMA versus using individual instructions (96 /Ls with
DMA processor FIFO Demand Mode described above. DMA versus 492 /Ls non-DMA).
FIFO Demand Mode DMA transfers occur continu-
ously until the Slave Status Request for Service Flag is Equation 4. Effective Internal FIFO
deactivated. Demand Mode is especially useful for con-
Transfer Time Using Internal DMA
tinuous data transfers requiring immediate attention.
FIFO Alternate Cycle Mode provides for interleaving Effective Internal FiFO Transfer Rate with DMA
DMA transfers and instruction cycles to achieve a FiFO channel size • Internal DMA Burst Mode
maximum of software flexibility. Both iriternal DMA Single Cycle DMA Time
channels can be used simultaneously to provide contin- 128 Bytes • 750 ns
uous transfer for both Input and Output FIFO chan- 96/Ls
nels.
Equation 5. Effective FIFO Transfer
Byte by byte transfers between the FIFO and internal Time Using Individual Instructions
CPU timing is a function of the specific instruction cy- Effective Internal FIFO Transfer Rate without DMA
cle time. Of the 111 MCS-51 instructions, 64 require 12 FIFO channel size * Instruction Cycle Time +
clock cycles, 45 require 24 clock cycles and 2 require 48 Block size calculation Time
clock cycles. Most instructions involving SFRs are 24 128 Bytes • (24 oscillator periods @ 16 MHz) +
clock cycles except accumulator (for example, MOV 20 instructions (24 oscillator period each .
direct, A) or logical operations (ANL direct, A). Typi- @ 16MHz)
cal instruction imd their timings are shown in Table 9. 128 *1.5 /Ls + 300 /Ls
492/Ls .
Oscillator Period: @ 12 MHz = 83.3 ns
@ 16 MHz = 62.5 ns
'FIFO DMA FREEZE MODE
Table 9. Typical Instruction Cycle Timings INTERFACE
OSCillator FIFO DMA Freeze Mode provides a means of locking
Instruction @12MHz @16MHz the Host out of the FIFO Input and Output channels.
Periods
FIFO DMAFreeze Mode can be invoked for a variety
MOV directt, A 12 1 /Ls 750 ns of reasons, for example, to reconfigure the UPI-452 Lo-
MOV direct, direct 24 2/Ls 1.5/Ls cal Expansion Bus, or change the baud rate on the seri-
al channel. The primary reason the FIFO DMA Freeze
NOTE: Mode is provided is to ensure that the Host does not
t Direct = a·bit internal datil locations address. This could read from or write to the FIFO while the FIFO inter-
be an Internal Data RAM location (0-255) or a SFR Ii.e., II face is being altered. ONLY the internal CPU has the
o port, control register, etc.]
capability of altering the FIFO Special Function Regis-
ters, and these SFRs can ONLY be altered during
Byte by byte FIFO data transfers introduce an addi- FIFO DMA Freeze Mode. FIFO DMA Freeze Mode
tional overhead factor not found in internal DMA op- inhibits Host access of the FIFO while the internal
erations. This factor is the FIFO block size to be trans- CPU reconfigures the FIFO.
ferred; the number of empty locations in the Output
channel, or the number of bytes in the Input FIFO
10-350
infef Ap·281
FIFO DMA Freeze Mode should not be arbitrarily in- operations described in this section are only valid after
voked while the UPI-452 is in normal operation. Be- SST5 is cleared.
cause the external CPU runs asynchronously to the in-
ternal CPU, invoking freeze mode without first proper- Either. the Host or internal CPU can request FIFO
ly resolving the FIFO Host interface may have serious DMA Freeze Mode. The first step is to issue an Imme-
consequences. Freeze Mode may be invoked only by diate Command indicating that FIFO DMA Freeze
the internal CPU. Mode will be invoked. Upon receiving the Immediate
Command, the external CPU should complete servicing
The internal CPU invokes Freeze Mode by setting bit 3 all pending interrupts and DMA requests, then send an
of the Slave Control SFR (SC3). This automatically Immediate Command back to the internal CPU ac-
forces the Slave and Host Status SFR FIFO DMA knowledging the FIFO DMA Freeze Mode request.
Freeze Mode to In Progress (SSTAT SST5 =. 0, After issuing the first Immediate Command, the inter-
HSTAT SFR HSTl = 1). INTRQ goes active, if en- nal CPU should not perform any action on the FIFO
abled by MODE SFR bit 4, whenever FIFO DMA until FIFO DMA Freeze Mode is invoked. The hand-
Freeze Mode is invoked to notify the Host. The Host shaking is the same in reverse if the HOST CPU initi-
reads the Host Status SFR to determine the source of ates FIFO DMA Freeze Mode.
the interrupt. INTRQ and the Slave and Host Status
FIFO DMA Freeze Mode bits are reset by the Host After the slave bus interface is frozen, the internal CPU
READ of the Host Status SFR. can perform the operations listed below on the FIFO
Special Function Registers. These operations are al-
During FIFO DMA Freeze Mode the Host has access lowed only during FIFO DMA Freeze Mode. Table 11
to the Host Status and Control SFRs. All other Host summarizes the characteristics of all the FIFO Special
FIFO interface access is inhibited. Table 10 lists the Function Registers during Normal and FIFO DMA
FIFO DMA Freeze Mode status of all slave bus inter- Freeze Modes.
face Special Function Registers. The internal DMA
processor is disabled during FIFO DMA Freeze Mode For FIFO 1. Changing the Channel Boundary
and the internal CPU has write access to all of the Reconfiguration Pointer SFR.
FIFO control SFRs (Table 11). 2. Changing the Input and Output
Threshold SFR.
If FIFO DMA Freeze Mode is invoked without stop-
ping the host, only the last two bytes of data written To Enhance the 3. Writing to the read and write
into or read from the FIFO will be valid. The timing testability pointers of the Input and Output
diagram for disabling the FIFO module to the external FIFO's.
Host interface is illustrated in Figure 7. Due to this 4. Writing to and reading the Host
synchronization sequence, the UPI-452 might not go Control SFRs.
into FIFO DMA Freeze Mode immediately after the 5. Controlling some bits of Host and
Slave Control SFR FIFO 7 DMA Freeze Mode bit Slave Status SFRs.
(SC3) is set = 0. A special bit in the Slave Status SFR
(SST5) is provided to indicate the status of the FIFO 6. Reading the Immediate Command
DMA Freeze Mode. The FIFO DMA Freeze Mode Out SFR and Writing to the 1m,
mediate Command in SFR.
INTRQ OR
DRaIN/DRaoUT
..J
292018-7
NOTE:
Timing Diagram of disabling of FIFO Module-External Host Interface.
The sequence of events for invoking FIFO DMA 4. The Immediate Command interrupt is responded to
Freeze Mode are listed in Figure 8. immediately-highest priority-by Host and inter-
nal CPU.
1. Immediate Command to request FIFO DMA 5. Respective interrupt response times
Freeze Mode (interrupt) a. Host (Equation 3 above)=approximately 1.6 pos
b. Internal CPU is 86 oscillator periods or approxi-
2. Host/internal CPU interrupt response/service
mately 5.38 pos worst case.
3. Host/internal CPU clear/service all pending
interrupts and FIFO data Event Time
4. Internal CPU sets Slave Control (SLCON) Immediate'Command from Host 0.30 pos
FIFO DMA to UPI-452 to request FIFO DMA -
Freeze Mode bit ,:: 0, FIFO DMA Freeze Freeze Mode (iAPX286 WRITE)
Mode, Host Status SFR FIFO DMA Freeze Internal CPU interrupt response/ 5.38 pos
Mode Status bit = 1, INTRQ active (high) service
5. Host READ Host Status SFR Internal CPU clears FIFO-128 96.00 pos
6. Internal CPU reconfigures FIFO SFRs bytes DMA
7. Internal CPU resets Slave Control (SLCON) Internal CPU sets Slave Control 0.75 pos
FIFO DMA Freeze Mode bit
Freeze Mode bit = 1, Normal Mode, Host Immediate Command to Host- 2.3 pos
Status FIFO DMA Freeze Mode Status bit = Freeze Mode in progress Host
O. Immediate Command interrupt
response
8. Internal CPU issues Immediate Command to
Host indicating that FIFO DMA Freeze Mode is Internal CPU reconfigures FIFO
complete ; SFRs
Channel Boundary Pointer SFR 0.75 pos
or InputThreshold SFR 0.75 pos
Host polls Host Status SFR FIFO DMA Freeze Output Threshold SFR 0.75 pos
Mode bit to determine end of reconfiguration Internal CPU resets Slave 2.3 pos
Figure 8. Sequence of Events to Invoke Control (SLCON) Freeze Mode
bit = 1, Normal Mode, and
FIFO DMAFreeze Mode automatically resets Host Status
FIFO DMA Freeze Mode bit
EXAMPLE CONFIGURATION Internal CPU writes Immediate 0.75 pos
Command Out
An example of the time required to reconfigure the Host Immediate Command 2.3 pos
FIFO 180 degrees, for example from 128 bytes Input to interrupt service -
128 bytes Output, is shown in Figure 9. The example
Total Minimum Time to 112.33 pos
approximates the time based on several assumptions;
Reconfigure FIFO
1. The FIFO Input channel isfull-128 bytes of data
2. Output FIFO channel is empty-1 byte Figure 9. Sequence of Events to Invoke FIFO
DMA Freeze Mode and Timings
3. No Data Stream Commands in the FIFO.
10-352
intJ AP-281
Table 10. Slave Bus Interface Status During FIFO DMA Freezer Mode
Interface Pins; Operation In Status In
DACK CS . A2 A1 AO READ WRITE Normal Mode Freeze Mode
1 0 0 1 0 0 1 Read Host Status SFR Operational
1 0 0 1 1 0 1 Read Host Control SFR Operational
1 0 0 1 1 1 0 Write Host Control SFR Disabled
1 0 0 0 0 0 1 Data or DMA data from Disabled
Output Channel
1 0 0 0 0 1 0 Data or DMA data to Disabled
Input Channel
1 0 0 0 1 0 1 Data Stream Command from Disabled
Output Channel
1 0 0 0 1 1 0 Data Stream Command to Disabled
Input Channel
1 0 1 0 0 0 1 Read Immediate Command Disabled
Out from Output Channel
1 0 1 0 0 1 0 Write Immediate Command Disabled
In to Input Channel
0 X X X X 0 1 DMA Data from Output Disabled
Channel
0 X X X X 1 0 DMA Data to Input Channel Disabled
NOTE:
X = don't care
Table 11. FIFO SFR's Characteristics During FIFO DMA Freeze Mode
Normal Freeze Mode
Label Name Operation Operation
(SST5 = 1) (SST5 = 0)
HCON Host Control Not Accessible Read & Write
HSTAT Host Status Read Only Read & Write
SLCON Slave Control Read & Write Read & Write
SSTAT Slave Status Read Only Read & Write
IEP Interrupt Enable
& Priority Read & Write Read & Write
MODE Mode Register Read & Write Read & Write
IWPR Input FIFO Write Pointer Read Only Read & Write
IRPR Input FIFO Read Pointer Read Only Read & Write
OWPR Output FIFO Write Pointer Read Only Read & Write
ORPR Output FIFO Read Pointer Read Only Read & Write
CBP Channel Boundary Pointer Read Only Read & Write
IMIN Immediate Command In Read Only Read & Write
IMONT Immediate Command Out Read & Write Read & Write
FIN FIFO IN Read Only Read Only
CIN COMMAND IN Read Only Read Only
FOUT FIFO OUT Read & Write Read & Write
COUT COMMAND OUT Read & Write Read & Write
ITHR Input FIFO Threshold Read Only Read & Write
OTHR Other FIFO Threshold Read Only Read & Write
10-353
inter ARTICLE
REPRINT
AR-409
October 1985
10-354
inter AR·409
INCREASED FUNCTIONS
IN CHIP RESULt IN
LIGHTER,
LESS COSTLY PORTABLE
COMPUTER
Jafar Modares, Applications Engineer, Intel Corp., Chandler, AZ
Advances in technology have made it communicates with the host computer at displaying the same number of charac-
possible to reduce the size and increase very high BAUD rates, and displays ters as a typical CRT, and it is not as
the functionality and performance of information on the screen at slower rates bulky or heavy as the latter.
computers and computer peripherals. for human beings. The chip also moni- LCDs can be divided into two large
With the help of microtechnology it is tors the power supply for switching to categories: smart LCDs and dumb
possible to construct a computer termi- the battery in case of power failure to LCDs. Those displays that have the
nal that is smaller and lighter than a save valuable data and computer time. capability to receive a byte of ASCII and
briefcase, and that can be connected to The prototype is currently under futher translate it into a displayed character are
a mainframe from almost anywhere. development at Intel's Microcontroller considered smart. On the other hand.
As more portable computers are intro- Division. dumb displays are only a matrix of dots.
duced to the marketplace, the demand Introducing the 80C51BH The former type has some kind of con-
for lighter and even smaller systems at Very new in the market, the 80CSI 8H troller of its own plus a small memory
a lower cost are inevitable. To meet this is a member of Intel's MCS-SI family. to hold the look-up table of characters
demand changes in the architecture are The MCS-SI is a group of 8-bit micro- (character generator). When using a
necessary. controllers that are extremely powerful dumb display the microcontroller has to
With Intel's recently introduced because of their 110 structure and their address and tum on the correct dots to
80C51 BH microcontroller several obsta- bit manipulating capabilities. The make a character. this means more 1/0
cles in the design of the portable com- 80C51 BH has 4 Kbytes of on-chip pro- pins will be required. However, it gives
puter have been overcome. The gram memory with the capability to extra capabilities such as graphic dis-
80C51 BH is a single chip 8-bit micro- address another 60 Kbytes of external plays and special or custom character
controller that requires a single 5V program memory. In addition it has 128 generation.
power supply. It has 32 110 lines. Its bytes of on-chip RAM and can access Both types of displays normally
functionalities include excellent bit and 64 Kbytes of external data memory. accept data through an 8-bit bus.
byte manipulation capability at Since the 80CSIBH is CMOS. it has Although the LCD is relatively slow. it
extremely high speeds as well as inter- very low power consumption (IS mA at can still share the bus with a memory
facing flexibilities through the serial and 5V. 12 MHz). In addition, it has two device without any degradation of the
parallel channels to intelligent and unin- power saving features not available in system performance.
telligent devices. It can carry its own HMOS versions of the family. These are Keyboard
program memory up to 4 Kbytes and has the Idle and Power Down modes.,which Depending on their task arid purpose.
various tools and support systems. are controlled by software and further keyboards vary in shape. size. and the
This article discusses the implemen- reduce power comsumption. These number of keypads. The keyboard for a
tation of a prototype portable terminal power saving features make it ideal for computer terminal, as a minimum.
based on Intel's new 8OC51 BH micro- battery-operated backed-up systems. should have all the alphanumeric keys
controller, and introduces the tools and Display device (standard typewriter) plus a Control. an
techniques available to build such a com- The display device of this portable ter- Escape. and optionally. some Function
puter terminal. In the application dis- minal'is a 25-line x 80-character Liquid keys.
cussed. the chip monitors the keyboard. Crystal Display (LCD). It is capable of As the diagram in Figure I shows a
270126-2
10-355
inter AR-409
(DAT~BUS)
l
LINES.
I to hold the receive lines at a logic ~
CONTROL KEY ~
-~lr
a scan line to receive a line and pulls
that receive line Low .
. Besides being used for the scan lines, TO THE EXTERNAL
INTERRUPT PIN
Port 0 is also the bus for the data buffer >--~
RAM and the display unit. While the
controller is talking to the RAM or to
TO PORT 1
the display, the bus must not be used.by TO P3.4
ANO P3.S
other devices or bus contention can
occur. Since the microcontoller initiates
Figure 1
the access to the display and to the data
buffer RAM, no conflict can occur
between them. However, if more than mately 25 msec (to debounce the·.key), the terminal is to he connected directly
one key on the same receive line is held and to perform' the task of identifying to the mainframe, a simple circuit trans-
down simultaneously while the RAMor which key is down. lates the TTL levels to the RS232 level.
the display is being accessed, it is pos- There are a number of ways that the The circuit also eliminates the need for
sible to foul up the information being interrupt service routine can identify the the - 12V supply required for R02J2.
transferred. Thus, to avoid bus ~onten press key. One way is to utilize the bit- The circuit diagram is shown in Figure
tion, diodes 0 I through 08 are placed addressing capabilities of the 80C51 BH 2.
on the scan lines, as shown in Figure I. to test each bit of the receive lines for a However, the primary application of
All the receive lines are ANOed to zero, which generated the interrupt, and this terminal is to be the traveling per-
External Interrupt I, so that pulling any' records the bit position. Then write Os son's window to the central system from
of the receive lines Low will generate an to the receive lines, Is to the scan lines, any remote location. In this application
interrupt. The interrupt service routine, test the scan lines for a zero, and record a modem is needed. There are many
adapts the "two key lock.out." system its position. If the controller finds more types of modems available. Some are on
and identities the pressed key. This sys- than one zero on each port, it will dis- PC boards for OEM use and others arc
tem allows only one key to be pressed continue any further processing and ready to connect directly to the telephone
simultaneously, all of them will be return to the main program. by the user. They also vary in size, pet-
ignored. Once the bit positions that contain 0 formance, and the way they communi-
On some keyboards, certain keys are recorded, they are used as the address cate. A proper modem for the portable
(such as Shift, Control or Escape) are for the characters in the look-up table. terminal should be small enough to carry
not a part of the line matrix. These keys The subroutine tinds the character that in a briefcase and preferdbly be a low-
connect directly to a port pin on the corresponds to' the. pressed key. The power device. When an ASCII code is
microcontroller. They would not cause character is represented in ASCII code. received by the host computer, it records
lock-out if pressed simultaneously with The look-up table is a list of the ASCII that code and echoes it back to the micro-
a matrix key, nor generate an interrupt representation of each keypad character, controller which displays it on the LCD.
if pressed singly. However, if they are and is stored in 'the program memory .. The serial port of the 80C51 BH can
part of the miltrix, then the software has The order in which they sit corresponds generate interrupts every time il receives
to recognize those keys and take proper to the address generated by the scan sub- or transmils information. The serial port
action depending on the function of the routine when that character is pressed on interrupt must have service priority over
pressed key. the keyboard. the external interrupt generated by the
Normally, when a key is pressed, the Serial communication keyboard. The high priority enables the
microcontroller is in the Idle mode and Once the 80C51 BH has' the ASCII serial port' to receive data any time the
no other task is in progress. Pressing a code generated from a key closure, it can computer addresses the terminal and
key on the matrix generates an interrupt, send it through its Serial' Channel to the transmits data.
which terminates the Idle mode. The host computer. The serial port of the ,The serial port interrupt service rou:
interrupt service routine tirst calls a sub: microcontroller can be programmed for tine transfers the received data to the
routine to provide a delay of approxi- all of the standard rates up to 375K. If display or to a memory buffer, depend-
270126-3
10-356
inter AR-409
ficient for buffering large blocks of data its own internal clock and goes to sleep.
MICROCONTROLLER storage. The serial port interrupt service Since the CPU consumes about 90% of
routine takes the data from the SBUF the chip's power. this process saves a
register and writes it to the iRAM. Two significant amount of power. More
ing on the mode selected by a function index pointers in the serial port interrupt importantly the on chip peripherals and
key. One mode of this function key teUs service routine help keep track of the the RAM continue their normal func-
the controller to move the received data incoming and outgoing iRAM data. tions independently of the CPU. Since
directly to the display. The other mode There are times the controller has to the oscillator is still running. any ena-
stores pages of the information in the wait for reasons such as the debounce bled interrupt (internal or external) will
buffer RAM. so that the user can edit or delay in the scan subroutine or when wake the CPU up from its sleep. and it
display the data. one page a,t a time. on writing to the display. and must slow will start executing instructions from the
the LCD without using the main sys- down. While the 80CSI BH is waiting. interrupt service routine.
tem's CPU time. it goes into the Idle mode until one of A true portable terminal should be
Data buffer memory the timers. which programmed to run. capable of operating from a battery
The data buffer RAM is temporary' times out and generates an interrupt. The source. There are occasions when one
storage for the information which is interrupt service routine for this type of would like to use the terminal at a loca-
either generated at the terminal or interrupt is a short one. it sets or clears tion where an electric outlet is not readily
retrieved from the central system. The one or more flags and returns to continue available. But the main purpose of the
user can display portions of the stored the task that was in progress before going battery supply is to save the data. which
information or scroll through it. The user into the Idle mode. has been entered and stored in the buffer
can also alter the data on the terminal The controller is also in the Idle mode RAM. in the case of an unexpected
and transmit it back to the computer in when there is no activity in the terminal. power failure.
a block form. i.e .• no data is being received or trans- While performing all of the previously
A suitable device for this purpose is mitted. and the keyboard is not being mentioned tasks. the gOCSI B H can
the SIC86 iRAM. This device is a used. Therefore. is is appropriate to say monitor its power supply: detect a power
pseudo-static dynamic RAM that has a that when power is applied to the ter- loss in its earliest stages. and initiate a
built-in address latch. An internal high- minal. the controller spends more than power Down to save the data of the inter-
speed arbitration circuit resolves any 90% of its time in the Idle mode. nal and external RAM.
potential conflict arising between read/ What is the Idle mode? One method for the 80CSI BH to mon-
write arid internal refresh cycles. When Bit 0 in the Special Function itor its power supply is to have the pos-
This iRAM is 8K x 8-bit and is suf- Register PCON is set. the CPU gates off itive half-cycles of the power supply
transformer fed to the External Interrupt
o pin (Figure 3). In the level activated
mode. this pin generates an interrupt
+SV every time there is a high to low tran-
sition. The interrupt service routine
R1
reloads Timer 0 to a value.that will make
it overflow sometime between one and
two periods of the line frequency. As
long as the half cycles keep coming in.
the timer never overflows. because it is
reloaded every half a cycle. If there is a.
single half a cycle in which the line volt-
+SV
age does not reach a high enough level
to generate the interrupt. the timer rolls
over and generates a timer interrupt.
The interrupt service routine for
Timer 0 saves the critical data of some
of the internal registers and puts the con-
SERIAL
OUTPUT troller into a Power down mode. A reset
RS button restarts the microcontroller to
02 resume operation when power is
restored.
In this mode the CPU and all of the
Figure 2 on-chip peripherals go to sleep. The
device stops its oscillator. freezes all the
270126-4
10·357
inter AR·409
II
KEYBOARD
, vi 80C51BH
vJ :::)
I'r
RAM
INT. 1
COMMUNICATION
t
INT. 0 --)
.,.
DISPLAY
POWER FAILURE
DETECTOR
I
Figure 4
270126-5
10-358
li·I·I· IR,\NSt\t·/lo1\ .... ()~" 1:'>oIH SrRIAI. II.I·C!fW;\.IC\ Veil II \~ ..... o -I. NOVI MBE·R I'IH~
Abstract-Having to interface an analog Iransducer 10 a digilal conlrol transducer signal docs not restrict itself to the voltage range of
system Ihrough an analog-Io-digilal converter represents an expensive -0.5 to +5.5 V.
bOllleneck in Ihe development of many systems. Some transducer The 8051 is not sensitive to the rise and fall times of its input
companies are addressing this prohlem by developing proprietar) families
of resonant transducers.
signals. It detects transitions by sampling its pon pins at fixed
Resonant transducers are oscillators whose frequency depends in some intervals (once per machine cycle). and responds to a change
known wa)" on Ihe physical propl."rty being mrasured. The tledrical in the sequence of samples. If the slew rate of the transducer
output from these devices Is a train of rectangular pulses whose repelition signal is extremely slow. noise superimposed on the signal
nte encodes the value of the measurand. Changes in the measurand cause could cause the sequence of samples to show false transitions.
the frequ"ncy to shifl. The microcontroller detecls the frequency shift,
runs a uhdily check on iI. and cURve rio; it in software to the measurand
There could on that account be situations in which the
nlue. transducer signal should be buffered through a Schmitt Trigger
This paper discusses software interfacing techniques between resonant to square it up.
transducers and the 8051. Techniques for measuring frequency and
period are diS('ussed and compared for resolution and interrogation time. III. TIMER/COUNTER STRUCTURE IN THE 8051
The 80~1 is capable of performing these tasks in extremely short CPU
time. Requirements for obtaining n-bit resolution in the measurement are
The 8051 has two 16-bit timer/counters: Timer 0 and Timer
discussed. It Is determined Ihat it is always faster 10 evaluate the I. Both can be configured in software to operate either as
measurand 10 a jil;inn level of resolution by meMsurinjil; the period rather timers or as event counters.
than the frequency, even if the me-asurand is_ proportional to the In the "timer" function. the register is automatically
frequency rather than to th~ period. Numerical and softwar~ ~xamples are
incremented every machine cycle. Since a machine cycle in
prestnted to illustrate Ihe c·oncepls.
the 805 I consists of 12 clock periods. the timer is being
I. RESONANT TRANSDUCERS incremented at a constant rate of 1/12 the clock frequency.
M OST sensing transducers are not directly compatible
with digital controllers. because they generate analog
In the "counter" function. the register is incremented in
response to a I-to-O transition at its corresponding external
signals. A few transducer companies are developing proprie- input pin (7U or TI). The way this function works is the
tary families of sensors which generate signals that are more external input pin is sampled once each machine cycle (once
directly compatible with digital systems. These are not analog every 12 clock periods). and when the samples show a high in
sensors with built-in A-D conversion. but oscillators whose one cycle and a low in the next. the count is incremented.
frequency depends in some known way on the physical Note too that since it takes two machine cycles (24 clock
propeny being measured. periods) to recognize a I-to-O transition. the maximum count
The technology is applicable to vinually any type of rate is 1124 the clock frequency. If the clock frequency is 12
measurand: pressure. gas density. position. temperature. MHz. the maximum count rate is 500 kHz. There are no
force. etc. The sensor and microcontroller can operate from requirements on the duty cycle of the signal being counted.
the same supply voltage. so the sensor can in most cases The 8052. an enhanced version of the 8051 . has three 16-bit
connect directly to a pon pin on the microcontroller. timer/counters. two of which are identical to those in the 8051.
The nominal reference frequency of the output signal from· The third timer/counter can operate either as a 16-bit timer/
these devices is in the range of 20 Hz-500 kHz. depending on counter with automatic reload to a preset 16-bit value on
the design. A change in the measurand away from the rollover. or as a 16-bit timer/counter with a "capture" mode.
reference condition causes the frequency to shili by an amount In the capture mode a I-to-O transition at the T2EX pin causes
that is related to the change in the Illeasurand value. the current value in the counting register to the "captured"
Transducers are available that have a full-scale frequency shift into RAM. The third timer makes the 8052 panicularly easy to
of 2-1. The microcontroller detects the change in frequency or interface with resonant transducers.
period and ,'onvens it in soliware to the Illeasurand value.
IV. WHETHER TO MEASURE FREQUENCY OR PERIOO
II. CONNFl'IINl; IHE DI(;ITAL TRANSIlIIl'rR TO tHE 8051 Measuring the frequency requires counting transducer
Normally the transducer output can be connected directly to pulses for a lixed sample time. Measuring the period requires
one. of the 8051 pon pins. An exception would occur when the measuring elapsed 'time for a fixed number of transducer
pulses. For a given level of accuracy in the determination of
Manu~l.:rip( n!l'eivcd Cktohc:r ~5, 1984. the value of the measurand. it is usually faster to measure the
The authur is with Intel Corporalion. Chandler. AZ 85224. period. rather than the frequency. even if the measurand is
© 1985 IEEE
270434-1
10-359
intJ 8051 MICROCONTROLLER
proportional to frequency rather than period. However. both bytes wide. can be augmented in software in the timer
types of measurements will be discussed here. interrupt routine to three bytes. The 8051 has a DJNZ
Two timer/counters can be used. one to mark time and the instruction (decrement and jump if not zero) which makes it
other to count transducer pulses. If the frequency being easier to code the third timer byte to count down instead of up.
counted does not exceed 50 kHz or so. one may equally well If the third timer byte counts down. its reload value is the
connect the transducer signal to an external interrupt pin. and two's complement of what it would be for an up-counter. For
count transducer pulses in software. That frees one timer. with example. if the two's complement of the sample time is
very little cost in CPU time. FEOCOOH. then the reload value for the third timer byte would
be 02. instead of FE. The timer interrupt routine might then be
V. How TO MEASURE TRANSDUCER FREQUENCY
DJNZ THIRn.J'IMER..BYTE.OUT
Measuring the frequency means counting transducer pulses
MOV TLO.IIO
for some desired sample time. The count that is directly
MOV THO.IIOCH
obtained is T x F, where T is the sample time and F is the
MOV THIRn.J'IMER..BYTE.1I02
frequency. The full scale range is T x. (Fmax - Fmin). For
(Now read and clear the
n-bit resolution
transducer pulse counter.)
I LSB = Tx (Fmax - Fmin) . OUT: RETI
2" Interrupt latency will have no effect on the measurement if the
latency is the same for every sample time.
Therefore. the sample time required for n-bit resolution is The trouble with measuring the frequency is it is not only
2" slow. but a waste of the resolving power of the 805 I's timers.
T A timer with microsecond resolution is being used to mark off
Fmax-Fmin
100-ms time periods. The technique is nevertheless useful if
For example, 8-bit resolution in the measurement of a the timer is already serving other purposes (servicing a
frequency that varies between 5 and 10 kHz would require, display, perhaps), so that the sample time is coming relatively
according to this formula, a sample time of 51.2 ms. The free of charge. But in most cases it is faster and equally
maximum acceptable frequency count would be 51.2 ms x 10 accurate to measure the frequency by deriving it from a
kHz = 512 counts. The minimum would be 256 counts. measurement of the period.
Subtracting 256 from each frequency count would allow the
VI. How TO MEASURE THE PERIOD
frequency to be reported on a scale of 0 to FF in hex digits.
If Fmin and Fmax are closer together it takes more time to Measuring the period of the transducer signal means
resolve them. 8-bit resolution in the measurement of a measuring the total elapsed time over N-transducer pulses ..
frequency that varies between 7 and 9 kHz would require a The quantity that is directly measured is N x T, where T is
sample time of 128 ms. The maximum and minimum the period of the transducer sig~al in machine cycles. The
acceptable counts would be 1152 and 896. Subtracting 896 relationship between T in machine cycles and the transducer
from each frequency count would allow the frequency to be frequency F in arbitrary frequency units is
reported on a: scale of 0 to FF in hex digits.
To implement the measurement, one timer is used to Fxtal .
T=--pX(1/12)
establish the sample time. In this function it autoincrements
every machine cycle. A machine cycle consists of 12 periods
of the clock oscill~tor. The sample time can be converted to where Fxtal is the 805 I clock frequency. in.the same unit as F.
machine cycles by multiplying it by (Fxtal)/ I2, where Fxtal is The full scale range then is N x (Tmax - Tmin). For n-bit
the 805 I clock frequency. The timer needs to be preset so that resolution
it rolls over at the end of each sample time. Then it generates
all interrupt, and the interrupt routine reads and clears the Nx (Tmax - Tmin)
transducer pulse counter, and then reloads the timer with the I LSB=· .
2"
correct preset value.
The preset or reload value is the two's complement negative Therefore. the number of periods over which the elapsed time
of the sample time in machine cycles. For example, with a 12- should be measured is
MHz clock frequency, the reload value required to establish a
5 I. 2 ms sample time is 2"
N
Tmax-Tmin
(51.2 ms) x (12000 kHz)
-51200=3800 H.
12 However. N must also be an integer. It is logical to evaluate
the above formula (do not forget that Tmax and Tmin have to
In many cases the required sample time exceeds the capacity of be in machine cycles) and select for N the next higher integer.
a 16-bit timer. For example, establishing a 128 ms sample This selection gives a period measurement that has somewhat
time with a 12-MHz clock frequency requires a 3-byte timer more than n-bit resolution. which mayor may not be
with a reload of FEOCOOH. The 8051 timer, being only 2: acceptable. depending on the overall requirements of the
270434-2
10-360
intJ 8051 MICROCONTROLLER
IEEF. TRANSACTIONS 0'/ INDUSTRIAL ELECTRONICS. VOL. IE·l2. NO.4. NOVEMBER 19R5
system. It can be scaled back to n-bit resolution, if necessary, timer also generates an interrupt. The interrupt routine would
by the following computation: then read and reset the timer.
NT-NTmin The advantage of this method is thaI the transducer signal
reported value = NTmax ~ NTmin has direct access to the timer gate, with the result that
variations in the interrupt response time cease to be a fact"r
where NT is the elapsed time measured 'over N periods. The timer can be read and cleared any time before the next
The computation can be done in math if a suitable divide high in the transducer output.
routine is available in the software. For 8-bit resolution it is
entirely reasonable to find the reported value in a look-up VIII. DERIVING FREQUENCY FROM A PERIOD MEASUREMENT
table, which would take up somewhat more than one page in We now consider the problem of measuring the transducer
ROM. In fact, the look-up table would contain NTmax - frequency to n-bit resolution by deriving it from a direct
NTmin entries. measurement of the period. The advantage of this technique is
For example, suppose we want 8-bit resolution in the speed. It is always faster to measure period than frequency.
measurement of the period of a signal whose frequency varies But il is important 10 end up with a frequency value that has the
from 5 to 10 kHz. If the clock frequency is 12 MHz, then same resolution and accuracy as a directly measured fre-
Tmax is (12 000 kHz)I(12 x 5 kHz) = 200 machine cycles, quency. Two questions need to be addressed.
and Tmin is 100 machine cycles. The timer needs to be on then
I) To achieve n-bit resolution in the calculated frequency,
for N = 2.56 periods, according to the formula. Using N = 3
how much resolution is required in the period?
periods will give maximum and minimum NT values of 600
2) Having measured the period to the required resolution,
and 300 machine cycles. This is somewhat more than 8-bit
what is the most efficient way to calculate the frequency?
resolution. It can be scaled to 8 bits with a 300-byte look-up
table, if desired. These questions will be addressed one at a time.
To implement the measurement, one timer is used to
measure the elapsed time NT. Enabling its interrupt is IX. RESOLUTION REQUIREMENTS
optional. The timer interrupt could be used to indicate a short In general, n-bit resolution in the frequency derivation
or open in the transducer circuit. requires somewhat more than n-bit resolution in the period
Then the transducer is connected to one of the external measurement. How much more? It will be demonstrated
interrupt pins (INTO or INTI), and this interrupt is configured' presently that if the transducer frequency varies over a 2-to-1
to the transition-activated mode. In the transition-activated range, the frequency can be calculated with n-bit resolution
mode every I-to-O transition in the transducer output will from period measurements that have (n + I I-bit resolution.
generate an interrupt. The interrupt routine counts transducer The more practical form of the question is over how many
pulses, and when it gets to the predetermined N. it reads and periods (N) must the transducer signal be sampled to' obtain
clears the timer. For example the required resolution in F? And so, we commence a
calculation of N.
DJNZ PULSES ,OUT The basic calculation of frequency from N x T (which we
MOV PULSES,fi..PERlODS shall call NT) is straightforward:
(Read and clear timer.)
OUT: RETI F=N/(NT).
If other interrupts are also to be enabled, the one connected to The relationship between an increment dF in the calculated
the transducer should be set to Priority I, and the others to frequency due to an increment d(NT) in the measured period
Priority O. This is to control the interrupt response time. The is, therefore,
response time will not affect the measurement if it is the same
for every measurement. Variations in the response time will, N
dF= - - - d(NT)
however, affect the measurement. Selling the pulse-counter . (NT)2
interrupt to Pnority I and all others to Priority 0 will minimize
variations in the response time. The response time will then be F2
limited to range from 3 to 8 machine cycles. =-'N d(NT).
10-361
8051 MICROCONTROLLER
The required resolution in NT is. therefore. X. COMPUTING ·THE FREQUENCY FROM THE PERIOD
Nx (Fmax - Fmin) The periOd measurement leaves one with a 16-bit integer,
I LSD in NTs l . which is N x T (or NT) in machine cycles. The conversion to
2" x (Fmax) frequency is straightforward:
Now. to say that NTis measured with m-bit resolution means F=N/(NT) periods/machine cycle.
I LSD in NT= NX(lIFmin-I/Fmax) .
The quantity of interest is probably not F, but a normalized
2m measure of the amount by which F exceeds .its. minimum
Substituting. this value for I LSD into the .required resolution acceptable value. This quantity represents, through the trans-
and sol ving for 2m yields ducer's transfer function, the "reported value" of the
measurand, and this quantity is an n-bit integer whose value
Fmax ranges from 0 (all bits = 0) to full scale (all bits. = I). This
2m~-.-x2".
Fmm normalized frequency is
10-362
inter 8051 MICROCONTROLLER
c-IVI[)f. HDI)lINf:
·,,;mf"'dt.,.
'lo..ot I",nl
.,.'nUfTllnoit oJ"
-,
;,., • III.. mt'roltnr
270434-5
10-363
8051
SOFTWARE PACKAGES
• Choice of hosts: • LlB51 Librarian which lets
PCDOS 3.0 based IBM* PC XT/AT*, programmers create and maintain
iRMX®06, iPDSTM System, Series II, libraries of software object modules
Series III, and Series IV
0051 Software Development Package
• Supports all members of the Intel Contains the following:
MCS® -51 architecture
• 0051 Macro Assembler which gives
PL/M51 Software Package Contains the symbolic access to 0051 hardware
following: features
• PL/M51 Compiler which is designed to • RL51 Linker and Relocator program
support all phases of software which links modules generated by the
implementation assembler
.RL5.1 Linker and Relocator,which • LlB51 Librarian which lets
enables programmers to develop programmers create and maintain
software in a. modular fashion libraries of· software object modules
LEGEND
D INTEL DEVELOPMENT
TOOLS AHDOTMER
-----.
10'
I,, _____ 1I
PRODUCTS
MCS"aS1
SOFTWARE TOOLS •
o USEA-CODED
SOFTWARE
162771-1
Figure 1. MCS® -51 Program Development Process
October 1987
10-364 Order Number: 162771-005
8051 Software Packages
PL/M 51 is a structured, high-level programming language for the Intel MCS-51 family of microcomputers. The
PL/M 51 language and compiler have been desi!'jned to support the unique software development require-
ments of the single-chip microcomputer environment. The PL/M language has been enhanced to support
Boolean processing and· efficient access to the microcomputer functions. New compiler controls allow the
programmer complete control over what microcomputer resources are u~ed by PLIM programs.
PLIM 51 is largely compatible with PL/M 80 and PLIM 86. A significant proportion of existing PLIM software
can be ported to the MCS-51 with modifications to support the MCS-51 architecture. Existing PLIM program-
mers can start programming for the MCS-51 with a small relearning effort.
PL/M 51 is the high-level alternative to assembly language programmi~g for the MCS-51. When code size and
code execution speed are not critical factors, ·PL/M 51 is the cost-effective approach to developing reliable,
maintainable software.
The PL/M 51 compiler has been designed to support efficiently all phases of software implementation with
features like a syntax checker, multiple levels of optimization, cross-reference generation and debug record
generation. . .
ICETM 5100, ICE 51, and EMV51 are available for on-target debugging ..
Software available for PC DOS 3.0 based IBM· PC XT/AT* Systems.
LI!GEND
o USEA-CODED
SOFlWARE
10-365
intJ 8051 Software Packages
PL/M 51 COMPILER
FEATURES Interrupt Handling
Major features of the Intel PLIM 51 compiler and A procedure may be defined with the INTERRUPT
programming language include: attribute. The compiler will generate code to save
and restore the processor status, for execution of
the user-defined interrupt handler routines.
Structured Programming
PL/M source code is developed in a series of rriod- Compiler Controls
ules, 'procedures, and blocks. Encouraging program
modularity in this manner makes programs more The PLIM 51 compiler offers controls that facilitate
readable, and easier to, maintain and debug. The such features as:
language becomes more flexible, by clearly defining - Including additional PL/M 51 source files from
the scope of user variables (local to a private proce- disk
dure, for example).
- Cross-reference
- Corresponding assembly language code in the
Language Compatibility listing file
10-366
intJ 8051 Software Packages
The MCS-51 linker and relocator (RL51) is a utility which enables MCS-51 programmers to develop software in
a modular fashion. The utility resolves all references between modules and assigns absolute memory loca-
tions to all the relocatable segments, combining relocatable partial segments with the same name.
With this utility, software can be developed more quickly because small functional modules are easier to
understand, design and test than large programs.
The total number of allowed symbols in user-developed software is very large because the assembler number
of symbols' limit applies only per module, not to the entire program. Therefore programs can be more readable
and better documented. RL51 can be invoked either manually or through a batch file for improved productivity.
Modules can be saved and used on different programs. Therefore the software investment of the customer is
maintained. .
RL51 produces two files. The absolute object module file can be directly executed by the MCS-51 family. The
listing file shows the results of the Iink/\locate process.
10-367
inter 8051 Software Packages
LIB51 LIBRARIAN
The LlB51 utility enables MCS-51 programmers to call only object modules that are required to satisfy
create and maintain libraries of software object mod- external references.
ules. With this utility, the customer can develop stan-
dard software modules and place them in libraries, .Consequently, the librarian enables the customer to
which programs can access through a standard in- port and reuse software on different projects-there-
terface. When using object libraries, the linker will by maintaining the customer's software investment.
ORDERING INFORMATION
10-368
inter .8051 Software Packages
162771-3
10-369
8051 Software Packages
8051·MACRO ASSEMBLER
• Supports 8051 family program • Object files are linkable and locatable
development on Intellec® ,
• Provides software support for many
Microcomputer Development Systems addressing and data allocation
• Gives symbolic access to powerful capabilities
8051 hardware features
• Symbolic Assembler supports' symbol
• Produces object file, listing file and table, cross-reference, macro
error diagnostics capabilities, and conditional assembly
The 805.1 Macro Assembler (ASM51) translates symbolic 8051 macro assembly language modules into link-
able and locatable object code modules. Assembly language mnemonics are easier to program and are more
readable than binary or hexadecimal machine instructions. By allowing the programmer to give symbolic
names to memory locations rather than absolute addresses, software design and debug are performed more
quickly and reliably. Furthermore, since modules are linkable and relocatable, the programmer can do his
software in modular fashion. This makes programs easy to understand, maintainable and reliable.
The assembler supports macro definitions and calls. This is a convenient way to program a frequently used
code sequence only once. The assembler also provides conditional assembly capabilities. .
Cross referencing is provided in the symbol table listing, showing the user the lines in which each symbol was
defined and referenced.
ASM51 provides symbolic access to the many useful addressing features of the 8051 architecture. These
features include referencing for bit and byte locations, and for providing 4-bit operations for BCD arithmetic.
The assembler also provides symbolic access to hardware registers, 1/0 ports, control bits, and RAM address-
es. ASM51 can support all memberS of the 8051 family.
If an 8051 program contains errors, the assembler provides a comprehensive set of error diagnostics, which
are included in the assembly listing or on another file. Program testing may be performed by using the iUP
Universal Programmer and iUP F87/51 personality module to program the 8751 EPROM version of the chip.
ICE 5100, ICE51 a~d EMV51 are available for program debugging.
The 8051 linker and relocator (RL51) is a utility which enables 8051 programmers to develop software in a
modular fashion. The linker resolves all references between modules and the relocator assigns absolute
memory locations to all the relocatable segments, combining relocatable partial segments with the same
name.
With this utility, software can be developed more quickly because small functional modules are easier to
understand, design and test than large programs.
The number of symbols in the software is very large because the assembler symbol limit applies only per
module not the entire program. Therefore programs can be more readable and better documented;
Modules can be saved and used on different programs. Therefore the software investment of ·the customer is
maintained.
10-370
intJ 8051 Software Packages
RL51 produces two files. The absolute object module file can be directly executed by the 8051 family. The
listing file shows the results of the link/locate process.
LIB51 LIBRARIAN
The LlB51 utility enables MCS-51 programmers to create and maintain libraries of software object modules.
With this utility, the customer can develop standard software modules and place them in libraries, which
programs can access through a standard interface. When using object libraries, the linker will call only object
modules that are required to satisfy external references.
Consequently, the librarian enables the customer to port and reuse software on different projects-thereby
maintaining the customer's software investment.
ORDERING INFORMATION
10-371
inter iDCX 51
DISTRIBUTED CONTROL EXECUTIVE
• Supports MCS®-S1 and RUPITM-44 ,
• Small-2.2K Bytes.
•
Familes of 8-Bit Microcontrollers
• Reliable
.Real-Time, Multitasking Executive
- Supports up to 8 Tasks at Four • Simple User Interface
Priority Levels • Dynamic Reconflguration Capability
The iDCX 51 Executive is compact, easy to use software for development and implementation of applications
using the high performance 8-bit family of 8051 microcontrollers, including the 8051,8044, and 8052. Like the
8051 family, the iDCX 51 Executive is tuned for real-time control applications requiring manipulation and
scheduling of more than one task, and fast response to external stimuli.
The MCS-51 microcontroller family coupled with iDCX 51 is a natural combinati(;m for applications such as data
acquisition and monitoring, process control, robotics, and machine control. The iDCX 51 Executive can signifi-
cantly reduce applications development time; particuladyBITBUS distributed control environments. .
The iDCX 51 Executive is available in two forms, either as configurable software on diskette or as preconfig-
ured firmware within the 8044 BEM BITBUS microcontroller.
280176-1
Figure 1. iDCX 51 Distributed Control Executive
October 1987
10-372 Order Number: 280176-003
inter iDCX51
I ASLEEP 1
Higher Priority Than Running Task
10-373
iDCX 51
10-374
intJ iDCX 51
Another feature that eases application -development gether, then when the system is initialized, all four -
is automatic register bank allocation. The Executive tasks will be put into a READY state. Then, the high-
will assig'n tasks to register banks automatically un- est priority task will run.
less a specific request is made. The iDCX 51 Execu-
tive keeps track of the register assignments allowing The DCX 51 user cian control several system con-
the user to concentrate on other activities. stants during the configuration process (Table 3).
Most of these constants are fixed, but by including
an Initial Data Descriptor (100) in an ITO chain, the
SYSTEM CONFIGURATION system clock priority, clock time unit, and buffer size
can be modified at run-time.
The user configures an iDCX 51 system simply by
specifying the initial set of task descriptors and con- This feature is useful for products that use the same
figuration values, and linking the system via the software core, but need minor modification of the
RL 51 Linker and Locator Program with user pro- executive to better match the end application. The
grams. initial data descriptor also allows the designer, who
is using an 8044 BEM BITBUS Microcontroller, to
Each task that will be running under control of the modify the preconfigured (on-chip) iDCX 51 Execu-
executive has an Initial Task Description (ITO) that tive.
describes it. The ITO specifies to the executive the
amount of stack space to reserve, the priority level Programs may be written in ASM 51 or PL/M 51.
of the task (1-4), the internal memory register bank Intel's 8051 Software Development Package con-
to be associated with the task, the internal or exter- tains both ASM 51 and RL 51. Figure 3 shows the
nal interrupt associated with the task, and a function software generation process.
10 (assigned by the user) that uniquely labels the
task. The ITO can also include a pointer to the ITO
for the next task. In this wayan ITO "chain" can be
formed. For example, if four ITO's are chained to-
10-375
inter IDCX51
AEDIT
INSTALL EMULATOR
r-~---...., PROBE IN
ICETt.l5100 SERIES, MICROCONTROLLER
ICETt.t 44 ,ICE51, SITE
EMV44,OR EMV51.1--.....,
EMULATORS
TARGET
BOARD
IUP-200A/201A WITH
UNIVERSAL PROM \-----1I-H MCS® 51/
PROGRAMMER INSTALL RUPITII44
EPROM . MICRO-
IN CODE CONTROLLER
SITE
INSTALL SRAM
IN CODE SITE
0""'"
D
FILE
SOFTWARE TOOL
280176-3
NOTE:
*RL 51 is included with ASM51 and PLIM 51; OBJHEX and the BITBUS Monitor are part of the DCS100 BITBUS
Toolbox.
10-376
inter iDCX 51
SOPHISTICATED INTERNAL MEMORY cated from any remaining memory. These buffers
MANAGEMENT . form the System Buffer Pool (SBP) that can be used
to create additional stack space or to . locate mes-
The amount of internal memory available ranges sages sent between tasks.
from 128 to 256 bytes depending on the type of mi-
crocontroller used. During run-time, the iOCX 51 Executive dynamically
manages this space. If a task is deleted, its stack
Internal memory is used for the executive, stack space is returned to the System Buffer Pool for use
spare for "running" tasks, space for message buff- by other tasks or as a message buffer.
ers, and reserved memory for variables storage.
Other memory is used for register space. Except for As new tasks are dynamicallly created, the execu-
register space, the allocation of internal memory is tive reserves the needed stack space. If no space is
controlled by. the executive, user-specified task/data available, the executive deallocates a buffer from
descriptors and system configuration constants. the System Buffer Pool and then allocates the need-
ed stack space.
To optimize use of this limited resource, iOCX 51
provides dynamic (run-time) memory management. To send or receive a message, the executive allo-
cates one or more buffers from the SBP for space to
locate the message, With iOCX 51, messages can
INITIALIZATION AND DYNAMIC be optionally located in external (off-chip) memory.
The pre-configured executive in the 8044 BEM
MEMORY MANAGEMENT
BITBUS microcontroller, however, always locates
At initialization (see Figure 4), the iOCX 51 Executive messages in internal memory.
creates the System Memory Pool (SMP) out of the
remaining initial free space (i.e. memory not used by
the iOCX 51 Executive or for register space). Next, RELIABLE
stack space is created for each of the initial tasks
that will be running on the system. If reserved mem- Real-time control applications require reliability. The
ory is requested (using an 100), that memory is also nucleus requires about 2.2K bytes of code space, 40
set aside. Finally, multiple buffers (size specified dur- bytes on-chip RAM, and 218 bytes external RAM.
ingiOCX 51 configuration or using an 100) are allo-
DCX 51 Initialization
Task 0
Task 1
Task 2
Task 3
},
Unallocated
STEPS:
1. Create system memory pool from the initial free memo
Initial ory space.
Free 2. Allocate stack space (space for 4 tasks shown).
Memory I 3. Allocate user-reserved memory (per the 100).
Space SBP 4 4. Allocate equal-size buffers to form the system buffer
pool.
I
I
User
Memory
10-377
intJ iDCX 51
MASTER
REMOTE NODES
(SLAVES)
280176-4
8031 80C31
8051 80C51 ORDERING INFORMATION
8032 8751
8744 8044 Part Number Description
8344 8052 DCX51SU Executive for 8051 Family of Micro-
controllers. Single User License, De-
velopment Only. Media Supplied for
Compatible DCM BITBUSTM Software All Host Systems (Table 3).
DCS 100 BITBUS Toolbox Host Software Utilities DCX51RF Royalty (Incorporation) Fee for iDCX
Executive. Set of 50 incorporations.
DCS 110 BITWARE DCM44 Code for BITBUS em- IDCX 51 RF does not ship with soft-
ulation
ware (Order DCX 51SU).
HARDWARE
ICE-51 00/044/252 ",. ",.
NOTES:
1. Utilities include RL 51, LIB 51, and AEDIT. Software for Series II systems is down-revision version.
2. These products are no longer available.
10-379
inter ICETM-5100/252
In,;,Ch"cuit Emulator for the
MCS®-51 Family of Microc()ntrollers
• Precise, Full-Speed, Real-Time • Symbolic Debugging Enables Access to
Emulation of Selected MCS-51 Memory Locations and Program
Microcontroller Components at Speeds Variables
Up to and Including 16 MHz • Four Address Breakpoints with In-
• 64 KB of Mappable High-Speed Range, Out-Of-Range, and Page Breaks
Emulation Memory
I". ' • Equipped with the Integrated Command
• 254 24-Bit Frames of Trace Memory (16 Directory (ICDTM) that Includes:
Bits Trace Program E,xecution - On~Line Help, .
Addresses and 8 Bits Trace External ..:... Syr1tax Guidance arid Checking
Events) .. - Dynamic Command-Entry
• Serial Li'nk to the IBM* PC AT, PC XT - Error Checking
(and DOS Compatibles), and the ' - Command Recall
Intellec® Series III/IV ' " • On-Line Disassembler and Single-Line
• ASM-51 and PL/M-51 'Language Assembler to Help with Code Patching
Support • Built-In CRT-Oriented Text Editor
The ICETM-5100i252 in-circuit emulator is a high-level, interactive debugging system that is used to develop
and test the hardware and software of a target system based on the MCS®-51 family of microcontrollers,The
ICE-51 00/252 emulator can be serially linked to an IBM PC AT or PC XT, or an Intellec Series III/IV. The
emulator can communicate with the host system at standard baud rates up to 19.2K. The design of 'the
emulator supports selected MCS-51 microcontroller components at speeds up to and including 16 MHz:
280200-1
·IBM is a registered trademark of International Business Machines Corporation.
November 1987
10-380 Order Number: 280200-002
inter ICETM·5100/252 EMULATOR
10-381
ICETM·5100/252 EMULATOR
• 40-pin DIP target adaptor stand-alone mode. The target adaptor plugs into the
• Clips assembly socket on the CPA; the CPA then supplies clock and
power to the user probe.
• Software (includes the ICE-5100/252 emulator
software, diagnostic software, and tutorial) The clips assembly enables the user to trace exter-
nal events. Eight bits of data are gathered on the
The controller pod contains 64 K8 of emulation rising edge of. PSEN during opcode fetches. The
memory, 254- by 24-bit frames of trace memory, and clips information can be displayed using the CLIPS
the control processor. In addition, the controller pod option with the PRINT command. Trace qualification
houses a 8NC connector that can be used to con- input and output lines are also provided on the clips
nect up to 10 multi-ICE compatible emulators to- pod for connection to test equipment.
gether for synchronous starting and stopping of em-
ulation. The ICE-51 00/252 emulator software supports mne-
monics, object file formats, and symbolic references
The serial cable connects the host system to the generated by Intel's ASM-51 and PL/M-51 program-
controller pod. The serial cable supports a subset of ming languages. Along with the ICE-5100/252 emu-
the RS-232C signals. lator software is a customer confidence test disk
with diagnostic routines that check the operation of
The user probe assembly consists of a user cable the hardware.
and a processor module. The processor module
houses the emulation processor and the interface The on~line tutorial is written in the ICE-5100 com-
logic. The target adaptor connects to the processor mand language. Thus, the user is ,able to interact
module and provides an electrical and mechanical with and use the ICE-51 00/252 emulator while exe-
interface to the target microcontroller socket. cuting the tutorial.
The crystal power accessory (CPA) is a small de- A comprehensive set of documentation is included
tachable board that connects to the controller pod with the ICE-51 00/252 emulator.
and enables the ICE-5100/252 emulator to run in
';,.,,-
"f
280200-2
10-382
inter ICETM·5100/252 EMULATOR
10-383
inter ICETM~5100/252 EMULATOR
280200-3
10-384
intJ ICETM·5100/252 EMULATOR
Design Considerations Allow at least 1-% inches (3.8 cm) of space to fit the
processor module and target adaptor. Figure 5
The height of the processor module and the target shows the dimensions of the processor module.
adaptor need to be considered for target systems.
hI t> GO
FROM ARM FOREVER TIL USING TRACE <execute>
l hIt> GOFROM
<expr>
---------~
)
---------~
)
--------~~
~ < execute>
)
---------~
)
280200-4
hlt>HELP
HELP is available for:
ADDRESS APPEND ASM BASE BIT BOOLEAN
BRKREG BYTE CHAR CI CNTL_C COMMENTS
CONSTRUCTS COUNT CPU CURHOME CURX CURY
DCI DEBUG DEFINE DIR DISPLAY. DO
DYNASCOPE EDIT ERROR EVAL EXIT EXPRESSION
GO HELP IF INCLUDE INVOCATION ISTEP
KEYS LABEL LINES LIST LITERALLY LOAD
LSTEP MAP MENU MODIFY MODULE MSPACE
MTYPE NAMESCOPE OPERATOR PAGING PARTITION PRINT
PROC PSEUDO_VAR PUT REFERENCE REGS REMOVE
REPEAT RESET RETURN SAVE STRING SYMBOLIC
SYNCSTART TEMPCHECK TRCREG TYPES VARIABLE VERIFY
VERSION WAIT· WORD WRITE
hlt>
280200-5
10-385
inter ICETM·5100/252 EMULATOR
~~ZT
n H
0"
~~:iI ~ ~f ~
m~~ I"~i
gx;
.~.-
&:il!; 0
~.G'I. Z
.r~. .
~.
~;.'
--1 3 13ft."
(9.7 em)
I
CABLE BODY
39"
(99 em) I 4"
(10.2 em)
----I
..,.,
SIDE VIEW
PROCESSOR MODULE
".
~u51X.
TARGET ~
ADAPTOR
280200-6
ELECTRICAL CONSIDERATIONS
The emulation processor's user-pin timings and loadings are identical to the 80C252 component except as
follows.
Maximum Operating ICC and Idle ICC (ma)'
Maximum Operating ICC (ma)' Maximum Idle ICC (ma)'
Vee 4V 5V 6V 4V 5V 6V
Frequency
0.5 MHz 0.87 1.62 3.0 0.58 1.21 2.5
3.5 MHz 4.8 6.82 9.76 2.2 4.97 6.33
8.0 MHz 10.5 15.0 20.5 6.0 8.98- 11.76
12.0 MHz 15.2 22.2 30.2 9.2 13.34 17.46
16.0 MHz 19.4 28.6 38.7 11.8 17.4 23.4
• Up to 25 pf of additional pin capacitance is con- • Pins 18 and 19, XTAL1 and XTAL2, respectively,
tributed by the processor module and target have approximately 15 to 16 pf of additional ca-
adaptor assemblies. pacitance when configured for crystal operation.
• Pin 31, EA, has approximately 32 pf of additional
capacitance loading due to sensing circuitry.
10-386
infef ICETM·5100/252 EMULATOR
PHYSICAL CHARACTERISTICS
ICETM·5100/252 SYSTEM SOFTWARE
PACKAGE
Controller Pod
• ICE-51 00/252 emulator software
Width 8%" (21 cm)
• ICE-51 00/252 confidence tests
Height 1%" (3.8cm)
• ICE-5100/252 tutorial softy,lare Depth 13%" (34.3 cm)
Weight 4 Ibs (1.85 kg)
User Cable
The user cable is 3 feet (approximately 1 m).
Processor Module
(with the target adaptor attached)
10-387
inter ICETM·5100/252 EMULATOR
to-388
inter ICETM·5100/252 EMULATOR
pD86PLM51 PL/M-51 Software Package (DOS pl86ASM51 8051 Software Development Pack-
version) - Consists of the PL/M-51 age (ISIS version) - Same as the
compiler which provides high-level pD86ASM51 package except this one
programming language support; the is for use with the Series III.
LlB51 utility that creates and main- pl86PLM51 PL/M-51 Software Package - Same
tains libraries of software object mod- as the pD86PLM51 package except
ules, and the RL51 linker and reloca- this one is for use with the Series III
tor program that links modules gener- and Series IV.
ated by ASM-51 and PL/M-51 and lo-
cates the linked object modules to pD86EDIEU AEDIT text editor for use with the
absolute memory locations. Use the DOS operating system.
DOS operating system (version 3.0 or
later).
10-389
MCS®-S1 INDEX
8
8031AH,5-2 CPL, 5~12, 6-6, 9-34
8032AH,5-2 CPU Timing, 5-14
8051, 5-2 Crystal, 5-14, 6-27, 6-28
8051AH,5-2
8052AH,5-2
8052AH-BASIC, 5-2 D
DA A, 5-8, 9-35
80C31BH, 5-2
Data Memory, 5-4, 5-5, 5-11, 6-6, 6-30, 9-3
80C5IBH, 5-2, 6-28
Read Cycle, 6-31
80C51FA, 5-2, 7-1
Write Cycle, 6-31
83C51FA, 5-2, 7-1
Data Pointer, 6-2
80C152, 5-3
Data Transfers, 5-9
83C152, 5-3
DEC, 6-6, 9-37
8751H, 5-2, 6-25, 6-26
Direct Addressing, 5-7, 9-3, 9-5
8752BH, 5-2, 6-26
DIV AB, 5-8, 6-22, 9-38
87C51, 5-2, 6~26, 6-27
DINZ, 5-14, 6-6, 9-39
87C51FA, 5-2, 7-1
E .
A EA (External Access), 5-4, 6-6, 6-21, 6-26, 6-30
AC (Auxiliary Carry) Flag, 6-3, 9-10
Encryption Array, 6-26
ACALL, 5-13, 9-24
EPROM Programming, 6-26, 6-30
Accumulator, 6-2
EPROM Verifying, 6-26
ADD, 9-25, 9-35
Execution Times, 5-7
ADDC, 9-26, 9-35
External Clock, 6-28, 6-29
. ADDRESS/DATA Bus, 6-4, 6-5
External Program Execution, 54
Addressing
Broadcast, 7-8
Given, 7-8 F .
AJMP, 5-13, 9-28 Fetch/ExecutlOn Sequence, 5-15
ALE, 5-16, 6-6, 6-30 Framing Error Detection, 7-8
ANL, 5-12, 6-6, 9-28
Arithmetic Instructions, 5-7
ASM51,5-6 H
High Speed Output, 7-4, 7-7
Automatic Address Recognition, 7-8
I
B I/O ButTers, 6-3, 6-4
B Register, 6-2 Idle Mode, 5-2, 6-24, 6-25, 7-9, 9-10
Baud Rate, 6-12, 6-13, 6-14, 6-17 IE (Interrupt Enable), 5-17, 6-2, 6-20, 7-13, 9-11
BCD, 5-8, 5-10 Immediate Constants, 5-7
Bit Addressable, 9-5 INC, 6-6, 9-40
Boolean Instructions, 5-11, 5-12 Indexed Addressing, 5-7
Bus Cycle Indirect Addressing, 5-7, 9-3, 9-5
Data Memory, 5-16 Instruction Set, 5-6, 9-20
Program Memory, 5-16 Interrupt Response Time, 6-21, 6-22
Byte Addressable, 9-7 Interrupts, 5-4, 5-17, 6-20,7-11,9-11
External, 6-22, 9-11
c IP (Interrupt Priority), 5-17, 6-2, 6-21, 7-13, 9-12
C (Carry) Flag, 5-6, 5-12,6-3, 9-10
Capture Mode, 7-4
Capture Registers, 6-2
J .
m, 5-12, 9-42
Case Jump, 5-7, 5-13 JBC, 5-12, 6-6, 9-42
Ceramic Resonator, 5-14, 6-28 JC, 5-12, 9-43
CINE, 5-14, 9-31 JMP, 5-13, 944
CLR, 5-12, 6-6, 9-33
Compare Mode, 7-6
Control Registers, 6-2
10-390
J (Continued) R
JND, 5-12, 9-45 RD Signal, 5-4, 6-6
JNC, 5-12, 9-45 Register Banks, 5-7, 6-3, 9-5, 9-10
JNZ, 9-46 Register Instructions, 5-7
Jump Instructions, 5-13 Register-Specific Instructions, 5-7
JZ,9-46 Relative Offset, 5-12
Reset, 6-23, 6-30, 9-8
Power-On, 6-24
L RET, 5-13, 6-22, 9-61
LCALL, 5-13, 9-47
RET!, 5-13, 6-21, 6-22, 9-61
UMP, 5-13, 9-47
Lock Bits, 6-26 RI (Receive Interrupt) Flag, 6-12, 6-14, 6-17, 6-20, 9-18
RL,9-62
Logical Instructions, 5-9
Lookup Tables, 5-7, 5-11 RLC, 9-62
RR,9-63
RRC, 9-63
M
Machine Cycle, 5-15
MOV, 5-12, 6-6, 9-48 S
16-Bit, 5-10 SBUF, 6-2, 6-10, 6-14
MOVC, 5-11, 9-53 SCON, 6-2, 6-11, 6-14, 6-17, 9-18
MOVX, 5-11, 5-16, 9-54 Serial Port, 6-10, 6-15, 7-8, 9-10, 9-12, 9-16, 9-18, 9-19
MUL AB, 5-7, 6-22, 9-56 SET,6-6
SETB, 5-12, 9-64
Multiprocessor Communication, 6-11
SFRs, 5-6, 6-1, 6-2, 6-4, 7-15, 9-4, 9-5, 9-7
SJMP, 5-13, 9-65
N Software Timer, 7-4, 7-6
Ninth Data Bit, 6-11, 6-17 Stack Pointer, 6-2, 9-5
NOP, 9-56 Start Bit, 6-11, 6-14, 6-17
State Time, 5-15
Status Flags, 5-7
o Stop Bit, 6-11, 6-14, 6-17
ONCE (On-Circuit Emulation) Mode, 6-27
ORL, 5-12, 6-6, 9-57 SUBB,9-66
Oscillator, 5-14, 6-23, 6-27 SWAP A, 5-9, 9-67
External, 5-15
Oscillator Frequency, 6-12 T
OV (Overflow) Flag, 6-3, 9-10 T2CON, 6-2, 6-9, 6-10, 6-13, 9-16, 9-17
TCON, 6-2, 6-7, 6-8, 6-22, 9-11, 9-13
p Third Priority Level, 5-18
P (parity) Flag, 5-7, 6-3, 9-10 T! (Transmit Interrupt) Flag, 6-12, 6-14, 6-17, 6-20,
PCA Timer/Counter, 7-1, 7-5 9-18
PCON, 6-2, 6-12, 6-24, 9-10, 9-19 Timer/Counters, 6-2, 6-6, 9-13
Polling Sequence, 5-17 Up/Down, 7-9
POP, 5-9, 9-60 TMOD, 6-2, 6-7, 9-13, 9-14, 9-17
Port Bit Latch, 6-3, 6-4
Ports, 6-2, 6-3, 6-29 v
Power Down Mode, 5-2,6-24, 6-25, 7-9, 9-10 Vpp, 6-26, 6-30
Power Off Flag, 7-9
PROG,6-30
Program Memory, 5-3, 5-4, 6-6, 6-26, 9-2 W
Program Memory Locks, 6-26 Watch Dog Timer, 7-3, 7-8
Programmable Counter Array (PCA), 7-1 WR Signal, 5-4, 6-6
PSEN, 5-4, 5-16, 6-6, 6~30
PSW (program Status Word), 5-6, 6-2, 9-10 X
Pulse Width Modulator (PWM), 7-4, 7-7 XCH, 5-10, 9-68
PUSH, 5-9, 9-60 XCHD, 5-10, 9-69
XRL, 5-L2, 6-6, 9-69
XTALl, 5-14, 5-15, 6-28, 6-29, 6-30
Q
Quick-Pulse Programming Algorithm, 6-26 XTAL2, 5-14, 5-15, 6-28, 6-29, 6-30
10-391
80C152 INDEX
A
A, 8-4, 8-6 Bit Addressable Memory, 8-6
Abort, 8-29, 8-30 Bit Addresses, 8-7
Acknowledgement, 8-15, 8-16, 8-24, 8-25, 8-30 Bit Addresses (Symbolic), 8-8
Acquisition Time, 8-21 Bit Rate, 8-17
Address, 8-18, 8-25, 8-30, 8-35 Bit Stripping, 8-25, 8-29, 8-37
Address Assignment, 8-34, 8-35 Bit Stuffing, 8-25, 8-29, 8-35, 8-37
Address Length Bit Time, 8-21
see AL BKOFF, 8-3, 8-4, 8-(;, 8-41
Address Mask Registers Block Diagram, 8-2
seeAMSKn BOF, 8-17, 8-18, 8-20, 8-25, 8-37, 8-39
Address Match Registers Broadcast Address, 8-18, 8-25
see ADRn Burst Mode, 8-46, 8-51, 8-52
Address Negotiation, 8-34 Byte Count, 8-33
Address Recognition, 8-15, 8-16, 8-18
ADRO, 8-3, 8-4, 8-6, 8-41
ADR1, 8-3, 8-4, 8-6, 8-41 C
Clock Recovery, 8-17, 8-37, 8-38
ADR2, 8-3, 8-4, 8-6, 8-41
Collision, 8-17, 8-20, 8-39
ADR3, 8-3, 8-4, 8-6, 8-41
Collision Fragment, 8-21
AE,8-3, 8-9, 8-43 Collision Resolution, 8-15, 8-16, 8-19, 8-21
AL, 8-3, 8-18, 8-41
Command,8-26
ALE, 8-13, 8-49
Control Field, 8-25, 8-26, 8-28, 8-30
ALE Switch, 8-49 CRC, 8-3, 8-15, 8-16, 8-18, 8-21, 8-24, 8-25, 8-28, 8-32,
Alignment Error
8-35, 8-37, 8-44
see AE
CRC Error
Alternate Backoff, 8-15, 8-16, 8-19, 8-21, 8-22, 8-23,
8-40 . see CRCE
CRC Generating Polynomial, 8-18, 8-28
Alternate Cycle Mode, 8-46, 8-52
CRC Jam, 8-15, 8-16
AMSKO, 8-3, 8-4, 8-6, 8-41
CRC Remainder, 8-18, 8-28
AMSKl, 8-3, 8-4, 8-6, 8-41
CRC Type
ARB, 8-49, 8-52
see CT
Arbiter CRCE, 8-3, 8-9, 8-43
see ARB Crystal Selection, 8-17
Arbiter Mode, 8-47, 8-48, 8-49 CSMA/CD, 8-14, 8-15, 8-16, 8-17, 8-34, 8-35, 8-37,
8-40
B CSMA/CD Frame
B, 8-4, 8-6 see Frame Format
Backoff Algorithm, 8-19, 8-20, 8-39, 8-40 CT, 8-3, 8-41
Backoff Mode . Cyclic Redundancy Check
see MO, Ml see CRC
Backoff Timer
see BKOFF
Back-to-Back Frames, 8-42 o
DARHO, 8-3, 8-4, 8-6, 8-45
Balanced, 8-30
DARH1, 8-3, 8-4, 8-6, 8-45
Baud, 8-3, 8-4, 8-6, 8-20, 8-41 DARLO, 8-3, 8-4, 8-6, 8-45
Baud Rate, 8-17, 8-34 DARLl, 8-3, 8-4, 8-6, 8-45
Baud Rate Generator DAS, 8-3, 8-45, 8-52
see Baud Data Encoding, 8-15, 8-16, 8-29, 8-34
BCRHO, 8-3, 8-4, 8-6, 8-45, 8-46
Data Memory, 8-5
BCRH1, 8-3, 8-4, 8-6, 8-45, 8-46
DC Jam, 8-15, 8-16, 8-21
BCRLO, 8-3, 8-4, 8-6, 8-45, 8-46 DC Jam (Bit)
BCRL1, 8-3, 8-4, 8-6, 8-45, 8-46
see DCJ
Beginning of Frame Flag DCJ, 8-3, 8-21, 8-42
see BOF DCONO, 8-3, 8-4, 8-6, 8-33, 8-45, 8-46, 8-52
DCONl, 8-3, 8-4, 8-6, 8-33, 8-45, 8-46, 8-52
DCR, 8-3, 8-42
10-392
D (Continued) ETO,8-1O
Deference, 8-17 ETl, 8-10
Demand Mode, 8-46, 8-51, 8-52 EXO,8-1O
Demand Mode (Bit) EXI,8-IO
seeDM Extended Address, 8-18
DEN, 8-11, 8-13, 8-29, 8-35, 8-44 External Clocking of GSC, 8-15, 8-16, 8-17, 8-37
Destination Address Space External Demand Mode, 8-46
see DAS External Driver, 8-35
Deterministic Backoff, 8-15, 8-16, 8-17, 8-19, 8-21, External Transmit Clock
8-22, 8-23, 8-40, 8-43 seeXTCLK
Deterministic Collision Resolution (Bit)
see DCR
Direct Memory Access F
FIFO Pointer, 8-43
see DMA Flags, 8-15, 8-16, 8-35
DM, 8-3, 8-46, 8-52 Frame Format, 8-17, 8-25
DMA,8-24
Full Duplex, 8-15, 8-16, 8-24, 8-30,8-32, 8-34, 8-37
DMA Arbitration, 8-51
DMA Control Bits, 8-52
DMA Control Register G
see DCONn Garen, 8-42
DMA Cycle, 8-45, 8-46, 8-47, 8-51 GFO, 8-1, 8-5
DMA Precedence, 8-51 GFl, 8-1, 8-5
DMA Register, 8-45 GFIEN, 8-1, 8-5, 8-42
DMA Register Access, 8-51 Global Serial Channel
DMA Select see GSC
see DMA (Bit) Glossary, 8-52
DMA Serial Demand Mode GMOD, 8-3, 8-4, 8-6, 8-41
see GSC, Servicing of GO, 8-3, 8-46, 8-52
DMA Timing, 8-47 GREN, 8-3, 8-24, 8-39, 8-40, 8-43
DMA Transfer, 8-44, 8-45, 8-47, 8-48 Group Address
DMA (Bit), 8-9, 8-33, 8-43 see Multicast Address
DMAO,8-44 GRXD,8-13
DMAI,8-44 GSC, 8-14, 8-46
DONE, 8-3, 8-9, 8-33,8-46, 8-52 GSC
DPH, 8-4, 8-6 Servicing of (CPU), 8-32, 8-39
DPL, 8-4, 8-6 Servicing of (DMA), 8-15, 8-16, 8-32, 8-33, 8-39
DPTR,8-6 Servicing of (GSC), 8-15, 8-16
Duplex GSC Auxiliary Receiver Enable
see Full Duplex seeGAREN
GSC External Receive Clock Enable
seeXRCLK
L GSC Idle Flag Enable
EA,8-13 see GFIEN
EDMAO, 8-9, 8-10 GSC Mode
EDMAI, 8-9, 8-10 see GMOD
EGSRE, 8-9, 8-10, 8-20, 8-33 GSC Operation, 8-37
EGSRV, 8-9, 8-10, 8-33 GSC Receive Enable
EGSTE, 8-9, 8-10, 8-20, 8-33 see GREN
EGSTV, 8-9, 8-10, 8-33 GSC Register Descriptions, 8-41
End of Frame Flag GSC Sampling Rate, 8-20, 8-37
- see EOF GSC Transmit FIFO
Ending Reception, 8-40 see TFIFO
Ending Transmission, '8-40 GTXD,8-13
EOF, 8-17, 8-18, 8-25, 8-29, 8-40
Error Reporting, 8-25
ES,8-1O
10-393
H M .
HABEN, 8-3, 8-24, 8-39, 8-43 MO, 8-3, 8-35, 8-40, 8-41
Half Duplex, 8-15, 8-16, 8-24, 8-30, 8-32, 8-34, 8-37 Ml, 8-3, 8-35, 8-40, 8-41
Hardware Based Acknowledge Enable Manchester, 8-15, 8-16, 8-17, 8-20,8-24, 8-35, 8-37
see HABEN Master Station
Hardware Based Acknowledgement see Primary Station
see HBA Memory Space, 8-1
HBA, 8-15, 8-16, 8-24, 8-30 Misalignment, 8-24
HDLC, 8-30, 8-37 Mode, 8-26
HLDA, 8-13, 8-44, 8-47,8-48, 8-49, 8-52 Modulo, 8, 8-30
HOLD, 8-13, 8-44, 8-47, 8-48, 8-49, 8-52 Modulo, 128, 8-30
Hold Acknowledge Monitoring Link, 8-40
see HLDA MOVX, 8-49
Hold Request Multi-Drop Configuration, 8-30, 8-31
see HOLD Myslot, 8-3, 8-4, 8-6, 8-22, 8-42
I N
IDA, 8-3, 8-45, 8-52 Network Changes, 8-32
Idle, 8-14, 8-40 Network Expansion, 8-32
Idle Fill Flags, 8-42 No Acknowledgement
Idle (GSC), 8-30 see NOACK
IE, 8-4, 8-6, 8-10 NOACK, 8-5, 8-9, 8-24, 8-44
IENl, 8-3, 8-4, 8-6, 8-9, 8-10 Nonsequenced Frame
IFS, 8-3, 8-4, 8-6, 8-19, 8-29, 8-41, 8-42 see Unnumbered Frame
Increment Destination Address Normal Backoff, 8-15, 8-16, 8-19, 8-21, 8-22, 8-23, 8-40
see IDA NRZ, 8-15, 8-16, 8-17, 8-24, 8-35, 8-37
Increment Source Address NRZI, 8-15, 8-16, 8-29, 8-35, 8-37
see ISA Number of Stations, 8-40
Information Field, 8-18, 8-25, 8-28
Information Frame, 8-25, 8-26
Initialization (GSC), 8-34, 8-35 o
Overflow, 8-24
INTO, 8-13, 8-46
Overrun
INTI, 8-13, 8-46
see OVR
Interframe Space, 8-17, 8-19, 8-22, 8-24, 8-32, 8-40
OVR, 8-3, 8-9, 8-43
Interrrame Space (Register),
see IPS
Internal Clocking of GSC, 8-15, 8-16 P
Interrupt Structure, 8-9 . PO
IP, 8-4, 8-6, 8-10 see PORTO
IPNl, 8-3, 8-4, 8~6, 8-9, 8-10 PI
ISA, 8-45, 8-52 see PORTI
P2
see PORT2
J P3
Jam, 8-15, 8-16, 8-17, 8-21, 8-22, 8-40
see PORT3
Jam Time, 8-21 P4 '
Jitter, 8-35, 8-36
see PORT4
Package, 8-11
L PCON, 8-4, 8-6, 8-42, 8-48, 8-49, 8-52
Line Discipline, 8-30, 8-34, 8-37 PDMAO, 8-9, 8-10
Line Idle PDMAl, 8-9, 8-10
see LNI PGSRE, 8-9, 8-10
LNI, 8-5, 8-30, 8-44 PGSRV, 8-9, 8-10
Local Serial Channel PGSTE, 8-9, 8-10
see LSC PGSTV, 8-9, 8-10
Loop Configuration, 8-30 Pin Description, 8-12
Loopback, 8-35 Pin Out (DIP), 8-11
LSC, 8-14, 8-46 Pin Out (PLCC), 8-12
PLO, 8-3, 8-41
PLl, 8-3, 8-41
10-394
P (Continued) RFIFO Time Delay, 8-20
Pomt-to-Point Configuration, 8-30, 8-31 RFNE, 8-3, 8-9, 8-33, 8-39, 8-43, 8-46
PoJl/Final Bit RI,8-46
see P/F Bit Ring Configuration, 8-30, 8-31
PORTO, 8-4, 8-6, 8-12, 8-44 Round-Trip Propagation, 8-21
PORTI, 8-4, 8-6, 8-12 RSTAT, 8-3, 8-4, 8-6, 8-43
PORT2, 8-4, 8-6, 8-13, 8-44 RXC,8-37
PORT3, 8-4, 8-6, 8-13 RXD,8-13
PORT4, 8-3, 8-4, 8-6, 8-11, 8-13
Power Down, 8-14
PR, 8-3, 8-41 S
SARHO, 8-3, 8-4, 8-6, 8-33, 8-45
PRBS, 8-3, 8-4, 8-6, 8-22, 8-42
SARHl, 8-~, 8-4, 8-6, 8-45
Preamble, 8-15, 8-16, 8-17, 8-18, 8-24, 8-35, 8-37
SARLO, 8-3, 8-4, 8-6, 8-33, 8-45
Preamble Length
SARLI, 8-3, 8-4, 8-6, 8-45
see PL
SAS, 8-3, 8-45, 8-52
Primary Station, 8-24, 8-25, .8-30
SBUF, 8-4, 8-6, 8-46
Program Memory, 8-8
SCON, 8-4, 8-6
Program Verification, 8-12, 8-13 SDLC, 8-14, 8-15, 8-16, 8-24, 8-30, 8-34, 8-35, 8-37,
Promiscuous Address, 8-25
8-40
Protocol (Bit)
SDLC Commands, 8-27
see PR
SDLCFrame
PS,8-1O
see Frame Format
PSEN,8-13
Secondary Station, 8-24, 8-25, 8-30
Pseudo Random Binary Sequence
Sending Sequence, 8-26
see PRBS
Separation of Busses, 8-50
PSW, 8-4, 8-6
Sequence Count, 8-25, 8-30
PTO,8-1O
Serial Backplane, 8-44
PT!,8-1O
Serial Port Demand Mode, 8-46
PXO,8-1O
SFRS
PXI,8-10
see Special Function Registers
P IF Bit, 8-25, 8-26
Slave Station
see Secondary Station
R Slot Address, 8-42
Raw Receive, 8-15, 8-16, 8-17, 8-35 Slot Address Register
Raw Transmit, 8-15, 8-16, 8-17, 8-29, 8-35 see Myslot
RCABT, 8-3, 8-9, 8-20, 8-29, 8-39, 8-40, 8-43 Slot Assignment, 8-17
RD, 8-13, 8-44, 8-47, 8-51 Slot Time, 8-21, 8-22, 8-32, 8-40
RDN, 8-3, 8-9, 8-33, 8-39, 8-40, 8-43 Slot Time (Register)
Receive Count, 8-30 see SLOTTM
Receive FIFO SLOTTM, 8-3, 8-4, 8-6, 8-21, 8-43
see RFIFO Source Address Space
Receive FIFO Not Ready see SAS
seeRFNE SP, 8-4, 8-6
Receive Status Register Special Function Registers, 8-3, 8-6
see RSTAT Supervisory Frame, 8-25, 8-26
Receiver Collision!Abort Detect
see RCABT
Receiver Done T
seeRDN TO,8-13
Reception Sequence, 8-26 T!, 8-13
REN, 8-20, 8-40 TCDCNT, 8-3, 8-4, 8-6, 8-22, 8-39, 8-40, 8-43
REQ, 8-49, 8-52 TCDT, 8-5, 8-9, 8-20, 8-39, 8-40, 8-44
Requester Mode, 8-47, 8-48, 8-49 TCON, 8-4, 8-6
Requester (Bit) TDN, 8-5, 8-9, 8-24, 8-33, 8-39, 8-40, 8-43, 8-44
see REQ TEN, 8-5, 8-29, 8-39, 8-40, 8-43, 8-44
Reset, 8-1, 8-10, 8-11, 8-13, 8-14, 8-19, 8-42 Test Modes, 8-35
Resolution Phase, 8-17, 8-21, 8-23 TFIFO, 8-4, 8-5, 8-6, 8-29, 8-32, 8-33, 8-39, 8-40, 8-43,
Response, 8-26 8-44,8-46
Retransmission, 8-39 TFNF, 8-5, 8-9, 8-39, 8-44, 8-46
RFIFO, 8-3, 8-4, 8-6, 8-20, 8-32, 8-33, 8-39, 8-40, 8-43, THO, 8-4, 8-6
8-46 THl, 8-4, 8-6
10-395
T (Continued) U
TI,8-46 UART
Timer/Counters, 8-11 see LSC
TLO, 8-4, 8-6 Unbalanced, 8-30
TL1~ 8-4, 8-6 Underrun
TM, 8-3,8-46, 8-52 seeUR
TMOD, 8-4, 8-6 Unnumbered Frame, 8-25, 8~26, 8-27, 8-28
Transfer Mode Unused SFR Addresses, 8-5
seeTM UR, 8-5, 8-9, 8-43, 8-44
Transmission During Resolution, 8-40 User Defined Protocols, 8-30
Transmit Collision Detect Using GSC, 8-30
see TCDT .... Using HLDA, 8-49
Transmit Collision Detect Count Using HOLD, 8-, 8-49
see TCDCNT .
Transmit Done
see TDN v
Transmit Enable
Vee, 8-12
see TEN
Vss, 8-12
Transmit FIFO Not Full
see TFNF W
Transmit Status Register WR, 8-13, 8-44, 8-47, 8-51
see TSTAT
Transmit Waveforms, 8-37
TSTAT, 8-4, 8-5, 8-6, 8-43 X
XRCLK, 8-1, 8-5, 8-37, 8-42
Turn-Around Time, 8-19 XTAL1,8-12
TXC, 8-3, 8-37 XTAL2,8-12
TXD,8-13 XTCLK, 8-37, 8-41
10-396
RUPITM..44 Family
.11
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
THE RUPITM·44 FAMILY:
MICROCONTROLLER WITH ON·CHIP
COMMUNICATION CONTROLLER
INTRODUCTION real-time control applications such as instrumentation,
industrial control, and intelligent computer peripherals.
The RUPI-44 family is designed for applications re- The microcontroller features on-chip peripherals such
quiring local intelligence at remote nodes, and commu- as two 16-bit timer/counters and 5 source interrupt ca-
nication capability among these distributed nodes. The pability with programmable priority levels. The micro-
RUPI-44 integrates onto a single chip Intel's highest controller's high performance CPU executes most in-
performance microcontroller, the 8051-core, with an structions in 1 microsecond, and can perform an 8 X 8
intelligent and high performance Serial communication multiply in 4 microseconds. The CPU features a Boole-
controller, called the Serial Interface Unit, or SIU. See an processor that can perform operations on 256 direct-
Figure 1. This dual controller architecture allows com- ly addressable bits. 192 bytes of on-chip data RAM can
plex control and high speed data communication func- . be extended to 64K bytes externally. 4K bytes of on-
tions to be realized cost effectively~ chip program ROM can be extended to 64K bytes ex-
. ternally. The CPU and SIU run concurrently. See Fig-
The R~PI-44 family consists of three pin compatible ure 2.
parts:
• 8344-8051 Microcontroller with SIU The SIU is designed to perform serial communications
with little or no CPU involvement. The SIU supports
• 8044-An 8344 with 4K bytes of on-chip ROM pro- data rates up to 2.4 Mbps, externally clocked, and
gram memory 375 Kbps self clocked (i.e., the data clock is recovered
• 8744-An 8344 with 4K bytes of on-chip EPROM by an on-chip digital phase locked loop). SIU hardware
program memory supports the HDLC/SDLC protowl: zero bit inser-
tion/deletion, address recognition, cycli.: rcdundan.:y
. check, aI\d frame number sequence check arc automati-
1.0 ARCHITECTURE OVERVIEW cally performed.
The 8044's dual controller architecture enables the The SIU's Auto mode greatly reduces communication
RUpj to perform complex control tasks and high speed software overhead. The AUTO mode supports the
communication in a distributed network environment. SDLC Normal Response Mode, by performing second-
ary station responses in hardware without any CPU
The 8044 microcontroller is the 805I-core, and main- involvement .. The Auto mode's interrupt control and
tains complete software compatibility with it. The mi- frame sequence numbering capability eliminates soft-
crocontroller contains a powerful CPU with on-chip ware overhead normally required in conventional sys-
peripherals, making it capable of serving sophisticated tems. By using the Auto mode, the CPU is free to con-
centrate on real time control of the application_
,--------------------,
I
H '= H
I
~~ ~ L ____________ ~ _______
~I",1---+1--·· COM,,!:~o;cTlON
~
296163-1
I I
I I
.I I
I I
I
I
j
I I i
i
I
I
I
1
1
I
, t--'\
'----.I I
I
I ii
.. c. I
I
I
)
}
:r-.
,~
Ig )
IE I
!ii ~
- I
I
>
11 I
I
I
I
I I
I
,1
1
!II r---"I
'v---J 0 II 1
1
)
1 I
1 I
1 - r
I I-- 1
J ~ f---' I
I ~ -I
1
il r----
u 1
, I I
I
II. -
_ _ _ _ _ _ _ _ _ _ _ _ _ _ .J I
I
.:
II
!Ii
Figure 2. Simplified 8044 Block Diagram
11-2
intJ THE RUPITM-44 FAMILY
I PRIMARY
I- i
"' Point to Point. Half Duplox
8044 CONTROLLED
SECONDARY
I :IOt,lli:J-3
Ii PRIMARY
J
I
t
8044 CONTROLLED·
,
8044 CONTROLLED
I
1044 CONTROLLO
SECONDARY SECONDARY SECONDARY
J
25163··'\
b) Multipoint, Half Duplex
~ ~
PRIMARY
t ~
1044 CONTROLLED
SECONDARY r- 1044 CONTROLLED
SECONDARY
296163-5
11-3
inter THE RUPITM-44 FAMILY
296163-6
11-4
THE RUPITM·44 FAMILY
11-5
inter THE RUPITM~44 FAMILY
3) System Integration
Integration of software and hardware can begin
when any functionale1ement of the user, system
hardware is connected to the 8044 socket. As each
section of the user~s hardware is completed, it is add-
ed to the prototype. Thus, each section of the hard-
ware and software' is system tested in real-time oper-
ation as it becomes available.
4) System, Test
When the user's prototype is complete, it is tested
with the final version' of the user system software.
The ICE-44 module is then used for real-time emula-
tion of the 8044 to debug the system as a completed
unit.
'The final product verification test may be performed 296163-8
using the 8744 EPROM version of the 8044 micro-
computer. Thus, the ICE-44 module provides the Figure 6. RUPI-44 iPDS Personal Development
user'with the ability to debug a prototype or produc- System, EMV-44 Buffer Box, and EMV-44 Module
tion system at any stage in its development. Plugged into a User Prototype Board
A conversion kit, ICE-44 CON, is available to upgrade Integration, and System Test. The iPDS's rugged porta-
an ICE-51 module to ICE-44. bility and ease of use also make it an ideal system for
production tests and field service of your finished de-
Intel's ASM-Sl Assembler supports the 8044 special sign. In addition, the iPDS offers EPROM program-
function registers and assembly program development. ming module for the 8744, and direct communications
PL/M-SI provides designers with a high levellanguagc; with the 8044-based BITBUS via an optional iSBX-344
for the 8044. Programming in PL/M can greatly re- distributed control module.
duce development time, and ensure quick time to mar-
ket.
These tool~ have recently been expanded with the addi- 3.28051 Workshop
tion of the EMV-44CON. This conversion kit allows Intel provides 8051 training to its customers through
you to convert an EMV-Sl into an EMV-44 emulation the S-day 80S 1 workshop. Familiarity with the 8051
vehicle. The resultant low cost emulator is designed for and 8044 is achieved through a combination of lecture
use with an iPDS Personal Development System, which and laboratory exercises.
also supports the ASM-51 assembler and PL/M-Sl. See
Figure 6. For designers not familiar with the 8051, the workshop
is an effective way to become proficient with the 8051
Emulation support is similar to the ICE~44 with sup- architecture and capabilities.
port for Software and Hardware Development, System
11-6
8044 Architecture 12
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
8044 ARCHITECTURE
GENERAL same byte as the opcode of an instruction. Thus, a large
number of instructions are one-byte instructions.
The 8044 is based on the 8051 core. The 8044 replaces
the 8051's serial port with an intelligent HDLC/SDLC The qext higher 16 bytes of the internal RAM (loca-
controller called the Serial Interface or SIU. Thus the tions 20H through 2FH) have individualiy addressable
differences between the two result from the 8044's in- bits. These are provided for use as software flags or for
creased on-chip RAM (192 bytes) and additional spe- one-bit (Boolean) processing. This bit-addressing capa-
cial function registers necessary to control the SIU. bility is an important feature of the 8044. In addition to
Aside from the increased memory, the SIU itself, and the 128 individually addressable bits in RAM, twelve of
differences in 5 pins (for the serial port), the 8044 and the Special Function Registers also have individually
8051 are compatible. addressable bits.
This chapter describes the differences between the 8044 A memory map is shown in Figure 2.
and 8051. Information pertaining to the 8051 core, ego
instruction set, port operation, EPROM programming,
etc. is located in the 8051 sections of this manual. 1.1 SpeCial Function Registers
A block diagram ofthe 8044 is shown in Figure 1. The The Special Function Registers are as follows:
pinpoint is shown on the inside front cover. • ACC Accumulator (A Register)
• B B Register
• PSW Program Status Word
1.0 MEMORY ORGANIZATION SP Stack Pointer
DPTR Data Pointer (consisting of DPH
OVERVIEW AND DPL)
o PO Port 0
The 8044 maintains separate address spaces for Pro-
gram Memory and Data Memory. The Program Mem- • PI Port 1
ory can be up to 64K bytes long, of which the lowest o P2 Port 2
4K bytes are in the on-chip ROM. o P3 Port 3
o IP Interrupt Priority
If the EA pin is held high, the· 8044 executes out of olE Interrupt Enable
internal ROM unlwess the Program Counter exceeds TMOD Timer/Counter Mode
OFFFH. Fetches from locations l000H through • TCON Timer/Counter Control
FFFFH are directed to external Program Memory. THO Timer/Counter 0 (high byte)
TLO Timer/Counter 0 (low byte)
If the EA pin is held low, the 8044 fetches all instruc- THI Timer/Counter 1 (high byte)
tions from external.Program Memory. TLl Timer/Counter 1 (low byte)
SMD Serial Mode
The Data Memory consists of 192 bytes of on-chip • STS Status/Command
RAM, plus 35 Special Function Registers, in addition • NSNR Send/Receive Count
to which the device is capable of accessing up to 64K STAD Station Address
bytes of external data memory .. TBS Transmit Buffer Start Address
TBL Transmit Buffer Length
The Program Memory uses 16-bit addresses. The exter- TCB Transmit Control Byte
nal Data Memory can use erither 8-bit or 16-bit ad- RBS .Receive Buffer Start Address
dresses. The internal Data Memory uses 8-bit address- RBL Receive Buffer Length
es, which provide a 256-location address space. The RFL Received Field Length
lower 192 addresses access the on-chip RAM .. The Spe- RCB Received Control Byte
cial Function Registers occupy various locations in the DMACNT DMA Count
upper 128 bytes of the same address space. FIFO FIFO (three bytes)
SIUST SIU State Counter
The lowest 32 bytes in the internal RAM (locations 00 PCON Power Control
through IFH) are divided into 4 banks of registers,
each bank consisting of 8 bytes. Anyone of these banks The registers marked with • are both byte- and bit-ad-
can be selected to be the "working registers" of the dressable.
CPU, and can be accessed by a 3-bit address in the
"T1
C·
...
c
I RD.WR t TO, n INTO
INn
ID
:-'" ( )
-'-
:rJ
c:
"
"::j 11 ] IJ I 11 :II
c::
"U
I\)
'"
I:
all A )RII/O V- ~ .
':::j
iii!:
0"
()
;0;-
c
( PORT
0
I~
---'\
PORT
2
SIU
HARDWARE
REGISTERS
~
PORT
3
r-
"""
PORT
1 t=J1 ~
~
iii' rI
...
ce INTERNAL
I»
3
(
TWO PORT
DATA
RAM
51
fl P3
ADDRIDATA/IIO
SCLR
DATA
I/O
51U
1 RTS
CTS
296164-1
inter RUPITM_44
FFFF
FFFF
EXTERNAL
1000
( 1- - - ,
iiFFF r - -......
OFFF
/ \ OVERLAPPED
I " SPACE
I
- II
INTERNAL EXTERNAL
(EA 1) (EA 0)
-CO
FF . - - - - - - - - - , SPECIAL
FUNCTION
,-..:::RE~GI:::.ST~ER:;:S:.-...
SF INTERNAL
0000'-_ _ _ _-' 00 DATA RAM 0000
~'-----~ ,
'-----------~T~------------JI T
I ..
EXTERNAL
PROGRAM MEMORY INTERNAL DATA
DATA MEMORY MEMORY
296164-2
Stack Pointer External Interrupt control· bits ITO and ITl are in
TCON.O and TCON.2, respectively. Reset leaves all
The Stack Pointer is S bits wide. The stack can reside flags inactive, with ITO and ITl cleared.
anywhere in the 192 bytes of on-chip RAM. When the
S044 is reset, the. stack pointer is initialized to 07H. All the interrupt flags can be set or cleared by software,
When executing a PUSH or a CALL, the stack pointer with the same effect as by hardware.
is incremented before data is stored, so the stack would
begin at location OSH. The Enable and Priority Control Registers are shown
below. All of these control bits are set or cleared by
software. All are cleared by reset.
1.2 Interrupt Control Registers
The Interrupt Request Flags are as listed below: IE: Interrupt Enable Register (bit-addressable)
Bit:765432 0
Source Request Flag Location
I I
EA X X ES ET1 EX1 ETO EXO
External Interrupt 0 INTO, if ITO = 0 P3.2
lEO, if ITO = 1 TCON.I where:
eEA disables all interrupts. If EA = 0, no interrupt
Timer 0 Overflow TFO TCON.5 will be acknowledged. If EA = 1, each inter-
rupt source is individually enabled or disabled
External Interrupt 1 INTl, if ITl = 0 P3.3 by setting or clearing its enable bit.
lEI, if ITl = 1 TCON.3
eES enables or disables the SeriaI'Interface Unit in-
Timer 1 Overflow TFI TCON.7 terrupt. If ES = 0, the Serial Interface Unit
interrupt is disabled.
Serial Interface Unit SI STS.4 enables or disables the Timer 1 Overflow inter-
rupt. If ETl = 0, the Timer·I interrupt is
disabled.
12-3
intJ RUPITM·44
• EXI enables or disables External Interrupt 1. If all Program Memory fetches are from external memo-
EXI = 0, External Interrupt I is disabled. ry. The execution speed of the 8044 is the same regard-
• ETO enables or disables the Timer 0 Overflow inter- less of whether fetches are from internal or external
rupt. If ETO = 0, the Timer 0 interrupt is Program Memory. If all program storage is on-chip,
disabled. byte location 4095 should be left vacant to prevent an
undesired prefetch from external Program Memory ad-
dress 4096.
IP: Interrupt Priority Register (bit-addressable)
Bit: 765 4 2 o Certain locations in Program Memory are reserved for
specific programs. Locations 0000 through 0002 are re-
x, x x PS PT1 PX1 PTO PXO , served for the initialization program. Following reset,
, the CPU always begins execution at location 0000. Lo-
where: cations 0003 through 0042 are reserved for the five in-
• PS defines the Serial Interface Unit interrupt pri- terrupt-request service programs. Each resource that
ority level. PS = I programs it' to the higher can request an interrupt requires that its service pro-
priority level. gram be stored 'at its reserve<t location.
defines the Timer I interrupt priority level. The 64K-byte External Data Memory address space is
PTI = I programs it to the higher priority automatically accessed when the MOVX instruction is
level. executed.
• PXI defines the External Interrupt priority level.
PXI = I programs it to the higher priority Functionally the Internal Data, Memory is the most
level. flexible of the address spaces. The Internal Data Mem-
• PTO defines the Timer 0' interrupt priority level. ory space is subdivided' into a 256-byte Internal Data
PTO = I programs it to the higher priority RAM address space and a 128-byte Special Function
level. Register address space as shown in Figure 3.
• PXO defmes the External Interrupt o,priority level. SPECIAL
PXO = I programs it to the higher priority FUNCTION
REGISTERS
level. ~
25s 255 248 FBH
FOH
E8H
2.0 MEMORY ORGANIZATION EOH
D8H
DETAILS RAM DOH
ADDRESS-
D
In the 8044 family the memory is organized over three ~m ~~ ABLE
BITS IN
SFR_
address spaces and the program counter. The memory BOH (128 BITS)
spaces shown in Figure 2 are the: A8H
AOH
• 64K-byte Program Memory address space 98H
90H
• 64K-byte External Data Memory address space 88H
-=~12=8~1~3,,-5_1~28::.1 aOH
• 320-byte Internal Data Memory address space 127 r
The 16-bit Program Counter register provides the 8044 ADDRESS- !! b=-=
with its 64K addressing capabilities. The Program ABLE 127 120
BITS IN
Counter allows the user to execute calls and branches SFRo 32 7 0
(128 BITS) - R7
to any location within the Program Memory space. 24 RO BANK3
There are no instructions that permit program execu- - R7 BANK2
tion to move from the Program Memory space to any REGISTERS :!!I!lR!-_-I
of the data memory spaces. 8 :~BANKl
- R7 BANKO
~ 0
In the 8044 and 8744 the lower 4K of the 64K Program
Memory address space is filled by internal ROM and INTERNAL SPECIAL FUNCnON
EPROM, respectively. By tying the EA pin high, the DATA RAM REGISTERS
processor can be forced to fetch from the internal 296164-3
ROM/EPROM for Program Memory addresses 0
through 4K. Bus expansion for accessing Program Figure 3. Internal Data Memory Address Space
Memory beyond 4K is automatic since externalinstruc-
tion fetches occur automatically when the 'Program
Counter increases above 4095. If the EA pin is tied low
12-4
RUPITM-44
The Internal Data RAM address space is 0 to 255. access the SFR's. The SFR's at addresses 192-255 are
Four 8-Register Banks occupy locations 0 through 3l. also accessed using direct addressing. The Special
The stack can be located anywhere in the Internal Data Function Registers are listed in Figure 4. Their map-
RAM address space. In addition, 128 bit locations of ping in the Special Function Register address space is
the on-chip RAM are accessible through Direct Ad- shown in Figures 5 and 6.
dressing. These bits reside in Internal Data RAM at
byte locations 32 through 47. Currently locations 0 Performing a read from a location of the Internal Data
through 191 of the Internal Data RAM address space memory where neither a byte of Internal Data RAM
are filled with on-chip RAM. (i.e., RAM addresses 192-255) nor a Special Function
Register exists will access data of indeterminable value.
The stack depth is limited only by the available Internal
Data RAM, thanks to an 8-bit reloadable Stack Point- Architecturally, each memory space is a linear se-.
er. The stack is used for storing the Program Counter quence of 8-bit wide bytes. By Intel convention the
during subroutine calls and may be used for passing storage of multi-byte address and data operands in pro-
parameters. Any byte of Internal Data RAM or Special gram and data memories is the least significant byte at
Function Register accessible though Direct Addressing the low-order address and the most significant byte at
can be· pushed/popped. the high-order address. Within byte X, the most signifi-
cant bit is represented by X.7 while the least significant
The Special Function Register address space is 128 to bit is X.D. Any deviation from these conventions will be
255. All registers except the Program Counter and the explicitly stated in the text.
four 8-Register· Banks reside here. Memory mapping
the Special Function Registers allows them to be ac-
cessed as easily as internal RAM. As such, they can be 2.1 Operand Addressing
operated on by most instructions. In the overlapping
memory space (address 128-191), indirect addressing is There are five methods of addressing source operands.
used to access RAM, and direct addressing is used to They are Register Addressing, Direct Addressing,
Register-Indirect Addressing, Immediate Addressing
12-5
RUPITM·44
SYMBOLIC BYTE
REGISTER NAMES ADDRESS BIT ADDRESS ADDRESS
~
B REGISTER B 240 (FOH)
ACCUMULATOR ACC 224 (EOH)
·THREE BYTE FIFO FIFO 223 (DFH)
FIFO 222 (DEH)
FIFO 221 (DDH)
TRANSMIT BUFFER START TBS 220 (DCH)
TRANSMIT BUFFER LENGTH TBL 219 (DBHI
TRANSMIT CONTROL BYTE .TCB 218 (DAH)
·SIU STATE COUNTER SIUST 217 (DBHI
SEND COUNT RECEIVE COUNT NSNR 216 (D6H)
PROGRAM STATUS WORD PSW 208 (DOH)
·DMACOUNT DMACNT 207· (CFH)
STATION ADDRESS STAD 206 (CEH)
RECEIVE FIELD LENGTH RFL 205 (CDH)
RECEIVE BUFFER START RBS 204 (CCH)
RECEIVE BUFFER LENGTH RBL 203 (CBH) SFR'. CONTAINING
RECEIVE CONTROL BYTE. RCB 202 (CAH) DIRECT ADDRESSABLE BITS
SERIAL MODE SMD 201 (CBH)
STATUS REGISTER STS 200 (CBH)
INTERRUPT PRIORITY CONTROL IP 184 (B6H)
PORT 3 P3 176 (BDH)
INTERRUPT ENABLE CONTROL IE' 166 (ASH)
PORT 2 P2 160 (AOH)
PORT 1 PI. 144 (SOH)
TIMER HIGH 1 THI 141 (BDH)
TIMER HIGH 0 THO 140 (&CH)
TIMER LOW 1 TLI 139 (BBH)
TIMER LOW 0 TLO 138 (BAH)
TIMER MODE TMOD 137 (89HI
TIMER CONTROL TCON 136. (89H)
DATA POINTER HIGH DPH 131 (83H)
DATA POINTER LOW DPL 130 (82H)
STACK POINTER SP 129 (81 H)
PORTO PO 12B (60H)
·296164-'4
12-6
intJ RUPITM~44
240 F7 I F6 I FS I F4 I F3 I F2 I Fl I FO 8 byte)
• Direct Addressing
224 E7 I E6 I ES I E4 I E3 I E2 I El I EO ACC
Lower 128 bytes of Internal Data RAM
NS2 NSI NSO SES NR2 NRI NRO SER
216 OF I DE I DO I DC I DB I OA I 09 I 08 NSNR Special Function Registers
CY AC FO RSI RSO OV P 128 bits in subset of Special Function Register
204 D7 I D6 I OS I 04 I 03 I 02 I 01 I DO PSW address space
TBF RE RTS 51 BV CPB AM RBP
200 CF I CE I CD I CC I CB I CA I C9 I C8 STS
• Register-Indirect Addressing
PS PTI PXl PTO PXO Internal Data RAM [@Rl, @RO, @SP (PUSH
184 - I - I - I BC I BB I BA I B9 I B8 lP and POP only)]
Least Significant Nibbles in Internal Data
176 B7 I 86 I B5 I 84 I 83 I B2 I Bl I 80 P3 RAM (@Rl, @RO)
EA ES ETI EXI ETO EXO
168 AF I - I - I AC I AB I AA I A9 I AS IE
External Data Memory (@Rl, @RO, @DPTR)
• Immediate Addressing
160 A7 ~A6L ASJ A41 A3 L A2J All AO P2
- Program Memory (in-code constant)
144 97 I 96 I 9S I 94 I 93 I 92 I 91 I 90 PI • Base-Register·plus Index-Register-Indirect Ad-
TFI TRI TFO TRO lEI ITI lEO ITO dressing .
136 8F I 8E L80 I 8G I 8B I SA I 89 I 88 TCON Program Memory (@ DPTR + A, @ PC + A)
128 87 I 86 I 8S I 84 I 83 I 82 I 81 I 80 PO Figure 8. Operand Addressing Methods
I 1 191
r-"----.
255 255
'41
. 240
.. F8H
FOH
...
23, .'H
.OH
.." .. .. ,..
70 7C 7B
2fH
" " ". D8H
... .. ..
[iiiO
n
>EH
" " " " 70 DOH
CIH
,..
'OH Of .0 'C' 'B 'A IS '00 DIRECT
'CH
" " " "so 50 44 ", COH
ADDRESS-
,..
BlH 'NG
. .. -
so .OH (IITS)
" Sf SC S. SA 43
-
'BH 51 178
AlH
.. .... so
"
55
"H 57 54
" "
"H 'f '0 'C 'B 'A 41
INDIREC
ADDO·T~" ,.
'80
'52
IOH
..
.
,. ,. " '38
27H 3f 3E lO lC 19 30 19
, 121 135 , IIH
80H
.
~
2&H 31 18
lS l4 II l2
" 30 117
2SH
24H
2lH
"
" ..
'f
'0
"
'C
24
'B
2l
.
22
"
"
31
30
lS DIRECT
.!!
'27 ,..
." "
'B
" ADDRESSING
22H
"H
'OH
Of
07 .. DO
..
OC 0.
Ol
OA
0'
09
0'
..
"
00
l4
II
l2
CIITS)
.!!
l!
7
07
O.
BANK 3
0
"H
81"113
&.nk 2
24
2l
REGISTER
ADDRESSING
.!!
...!. .
O•
07
lANK 1
:: BANK 0
'OH ...!.
a.nll I
"" '-----;--y---J
OIH ~ DIRECT ADDRESSING
07H STACK-POINTER REGISTER·INDIRECT AND
alnkO REGISTER·INDIRECT ADDRESSING
296164-6
296164-S
Figure 10. Addressing Operands
Figure 9. RAM Bit Address in Internal Data Memory
12-7
inter RUPITM_44
12-8
8044 Serial Interface 13
THE RUPITM-44 SERIAL INTERFACE UNIT
"1'1
c·
...
c
CD TXD SRlST XI
;'" c:
en "U
..... 2:
c.:>
r\3 0"
(')
m .
"::j
;;:
........
;0;-
en
S!
DI
2
...DI
CD
3 I
I
I
I SIU
I INTERNAL
HARDWARE
REGISTER
-TWO
I PORT
(2 PORT)
RAM
I
I
I
I
I
)
18 \. 296165-1
RUPITM-44 SIU
8044
MASTERI CONTROLLED
PRIMARY
SECONDARY
296165-2
1) HALF·DUPLEX, POINT·TO·POINT
MASTERI
PRIMARY -
~ ~
8044 8044
CONTROLLED CONTROLLED
SECONDARY SECONDARY
296165-3
2) HALF·DUPLEX, MULTIPOINT
MASTERI
PRIMARY
8044 8044
CONTROLLED CONTROLLED
SECONDARY SECONDARY
8044
CONTROLLED
SECONDARY
296165-4
3) LOOP
13-3
· RUPITM·44SIU
In the self clocked mode with an external reference 4.1 AUTO Mode
dock, the maximum data rate is 375K bps.
To enable the SIU to receive a frame in AUTO mode,
In the self clocked mode with an internally generated the 8044 CPU sets up a receive buffer. This is done by
reference clock, and the 8044 operating With a 12 MHz writing two registers-Receive Buffer Start (RBS) Ad-
crystal, the available data rates are 244 bps ·to 62.5K dress and Receive Buffer Length (RBL).
bps, 187.5K bps and 375K bps.
The SIU receives the frame, examines the control byte,
For more details see the table in the SMD register de- and takes the appropriate action. If the frame is an
scription, below. information frame, the.SIU will load the receive buffer,
interrupt the CPU (to have the receive buffer read), and
make the required acknowledgement to the primary
4.0 OPERATIONAL MODES station. Details on these processes are given in the Op-
eration section, below.
The Serial Interface Unit (SIU) can operate in either of
two response modes: In addition to receiving the information frames, the
SIU in AUTO mode is capable of responding to the
1) AUTO mode following commands (found in the control field of su-
2) FLEXIBLE (NON-AUTO) mode pervisory frames) from the primary station:
In the AUTO mode, the stu performs iIi hardware a RR (Receive Ready): Acknowledges that the Primary
subset of the SDLC protocol called the. normal re- station has correctly received numbered frames up
sponse mode. The AUTO mode enables the SIU to rec- through NR - 1; and that it is ready to receive frame
ognize and respond to certain kinds of SDLC frames NR·
without intervention from the 8044's CPU. AUTO
mode provides a faster turnaround time and a simpli- RNR (Receive Not Ready): Indicates a temporary busy
fied software interface, whereas NON-AUTO mode condition (at the primary station) due to buffering or
provides a greater flexibility with regard to the kinds of other internal constraints. The quantity NR in the con-
operation permitted. trol. field indicates the number of the frame expected
after the busy condition ends, and may be used to ac-
In AUTO mode, the 8044 can act only as a normal knowledge the correct reception of the frames up
response mode secondary station-that is, it can trans- through NR - 1.
mit only when instructed to do so by the primary sta-
tion. All such AUTO mode responses adhere strictly to REI (Reject): Acknowledges the correct reception of
IBM's SDLC definitions. frames up through NR - I, and requests transmission
or retransmission starting at frame. NR. The 8044 is
In the FLEXIBLE mode,reception or transmission of capable of retransmitting at most the previous frame,
each frame by the SIU is performed under the control and then only if it is still available in the trarismit buff-
of the CPU. In this mode the 8044 can be either a er.
primary station or a secondary station.
UP (Unnumbered Poll): Also called NSP (Non-Se-
In both AUTO and FLEXIBLE modes, short frames, . quenced Poll) or ORP (Optional Response Poll). This
aborted frames, or frames which have had CRC's are· command is used in the loop configuration.
ignored by the SIU.
To enable the SIU to transmit an information frame in
The basic format of an SDLC frame is as follows: AUTO mode, the CPU sets up a transmit buffer. This
is done by writing two registers-Transmit Buffer Start
! Flag! Address! Control! Information! FCS ! Flag I (TBS) Address and Transmit Buffer Length (TBL), and
filling the transmit buffer with the information to be
transmitted.
Format variatio~s consist of omitting one or more of
the fields in the SDLC frame. For example, a superviso- When the transmit buffer is full, the SIU can automati-
ry frame is formed by omitting theinformation field. cally (without CPU intervention) send an information
Supervisory frames are used to confirm received frame (I-frame) with the appropriate sequence num-
frames, indicate ready or busy conditions, and to report bers, when the data link becomes available (when the
errors. More details on frame formats are given in the 8044 is polled for information). After the SIU has
SDLC Frame Format Options section, below. transmitted the I-frame, it waits for acknowledgement
from the receiving station. If the acknowledgement is
13-4
RUPITM_44 SIU
negative, the SIU retransmits the frame. If the ac- CPU, to indicate that the transmit buffer may be re-
knowledgement is positive, the SIU interrupts the loaded with new information.
\J
iiTs 7
CTs
TRANSCEIVER/BUFFER 8
I/O 8044
10
J
-
C> DATA
11
<J
SCLK
15
296165-5
I'
I/O
- ).. / \"
.~
iiTS
- l \
~
/
ffi
- \ I~
TRANSMIT
ABORTED BY
C'i'S-1
296165-6
13-5
l
8044
:II RXD
10
ca
...c
CD
~ TXD
11
en
...
CD
e: 16X/32X
1S
5'
S' ::D
:::1
DI c::
n 'U
......~.
..... CD 296165-7
CfJ ::!
0) a
5'
en
1 2
[.~ X X
CD
:;: DATA GA
X ONE'S
X SHUT-OFF SEQ DATA
~
n
0 1 1 1 1 1 1 0 1 1 1 1 1 1 1. 1 1 1 1 1 1 1 0 0 0 o 0 0 0 0 1 1 1 1 1
;-
a.
iii:
0
a. DATA (BIT-DELAYED) GA CHANGED TO FLAG TRANSMIT FRAME DATA (BIT-DELAYED)
CD
[nw 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 A D D R E S S CON T R 0 L 1 1 1 1
TRANSMISSION
,. ABORTED BY
EXTRA "1" SHUT-OFF
INSERTED SEQUENCE
296165-8
---- --
infef RUPITM·44 SIU
In addition to transmitting the information frames, the SMD Bit 1: NB (Non-Buffered Mode-No Control
SIU in AUTO mode is capable of sending the following Field)
responses to the primary station: STS Bit 1: AM (AUTO Mode or Addressed Mode)
RR (Receive Ready): Acknowledges that the 8044 has Figure 5 shows how these three bits control the frame
correctly received numbered frames up through format.
NR - 1, and that it is ready to receive frame NR.
The following paragraphs discuss some properties of
RNR (Receive Not Ready): Indicates a temporary busy the standard SOLC format, and the significance of
condition (at the 8044) due to buffering or other inter- omitting some of the fields.
nal constraints. The quantity NR in the control field
indicates the number of the frame expected after the
busy condition ends, and acknowledges the correct re- 5.1 Standard SOLC Format
ception of the frames up through NR - 1.
The standard SOLC format consists of an opening flag,
an 8-bit address field, an 8-bit control field, an n-byte
4.2 FLEXIBLE Mode information field, a 16-bit Frame Check Sequence
(FCS), and a closing flag. The FCS is based on the
In the FLEXIBLE (or non-auto) mode, all reception CCITI-CRC polynominal (X16 + X12 + X5 + 1).
and transmission is under the control of the CPU. The The address and control fields may -not be extended.
full SOLC and HOLC protocols can be implemented, Within the 8044, the address field is held in the Station
as well as any bit-synchronous variants of these proto- Address (STAO) register, and the control field is held
cols. in the Receive Control Byte (RCB) or Transmit Con-
trol Byte (TCB) register. The standard SOLC format
FLEXIBLE mode provides more flexibility than may be used in either AUTO mode or FLEXIBLE
AUTO mode, but it requires more CPU overhead, and mode.
much longer recognition and response times. This is
especially true when the CPU is servicing an interrupt
that has higher priority than the interrupts from the 5.2 No Control Field (Non·Buffered
SIV. Mode)
In FLEXIBLE mode, when the SIU receives a frame, it When the control field is not present, the RCB and
interrupts the CPU. The CPU then reads the control TCB registers are not used. The information field be-
byte from the Receive Control Byte (RCB) register. If gins immediately after the address field, or, if the ad-
the received frame is an information frame, the CPU dress field is also absent, immediately after the opening
also reads the information from the receive buffer, ac- flag. The entire information field is stored in the 8044's
cording to the values in the Receive Buffer Start (RBS) on-chip RAM. If there is no control field, FLEXIBLE
address register and the Received Field Length (RFL) mode must be used. Control information may, of
register. course, be present in the information field, and in this
manner the No Control Field option may be used for
In FLEXIBLE mode, the 8044 can initiate transmis- implementing extended control fields.
sions without being polled, and thus it can act as the
primary station. To initiate transmission or to generate 5.3 No Control Field and No Address
a response, the CPU sets up and enables the SIU. The
SIU then formats and transmits the desired frame. Field
Upon completion of the transmission, without waiting The No Address I'"ield option is available only in con-
for a positive acknowledgement from the receiving sta- juction with the No Control Field option. The STAO,
tion, the SIU interrupts the CPU. RCB, and TCB registers are not used. When both these
fields are absent, the information field begins immedi-
ately after the opening flag. The entire information field
5.0 8044 FRAME FORMAT OPTIONS is stored in on-chip RAM. FLEXIBLE mode must be
used. Formats without an address field have the follow-
As mentioned above, variations on the basic SOLC ing applications:
frame consist of omitting one or more of the fields. The
choice of which fields to omit, as well as the selection of Point-to-point data links (where no addressing is neces-
AUTO mode versus FLEXIBLE mode, is specified by sary)
the settings of the following three bits in the Serial
Mode Register (SMO) and the Status/COntrol Register Monitoring line activity (receiving all messages regard-
(STS): less of the address field)
SMO Bit 0: NFCS (No Frame Check Sequence) Extended addressing
13-7
inter RUPITM_44 SIU
No Control Field
FLEXIBLE Mode
0 F A I FCS F
No FCS Field o o F A C F
FLEXIBLE Mode
NoFCS Field o F A C I F
AUTO Mode
NoFCS Field F A F
No Control Field
FLEXIBLE Mode
No FCSField o F F
No Control Field
No Address Field
FLEXIBLE Mode
Key to Abbreviations:
F= Flag (01111110)
A= Address Field
C= Control Field
1= Information Field
FCS = Frame Check Sequence
NOTE:
The AM bit is AUTO m<,>de control bit when NB = 0, and Address Mode control bit when NB = 1.
5.4 No FCS Field in the on-chip RAM. No FCS checking is done on the
received frames, and no FCS is generated for the trans-
In the normal case (NFCS = 0), the last 16 bits before mitted frames. The No FCS Field option may be used
the closing flag are the Frame Check Sequence (FCS) in conjunction with any of the other options. It is typi-
field. These bits are not stored in the· 8044's RAM. cally used in FLEXIBLE mode, although it does not
Rather, they are used to compute a cyclic redundancy strictly include AUTO mode. Use of the No FCS Field
check (CRC) on the data in the rest of the frame. A option AUTO Mode may, however, result in SDLC
received frame with a CRC error (incorrect FCS) is protocol violations, since the data integrity is not
ignored. In transmission, the FCS field is automatically checked by the sm.
computed by the SIU, and placed in the transmitted
frame just prior to the closing flag. Formats without an FCS field have the following appli-
cations:
The NFCS bit (SMDBit 0) gives the user the capability
of overriding this automatic feature. When this bit is set Receiving and transmitting frames without verifying
(NFCS = I), all bits from the beginning of the infor- data integrity.
mation field to the beginning of the closing flag are
treated as part of the information field, and are stored Using an alternate data verification algorithm.
13-8
RUPITM·44 SIU
Using an alternate CRC-16 polynomial (such as XI6 + SMD: SERIAL MODE REGISTER
XIS + X2 + I), or a 32-bit CRC (BYTE-ADDRESSABLE)
Bit: 7 6 5 4 3 2 1 0
Performing data link diagnosis by forcing false CRCs
to test error detection mechanisms I SCM21 SCM1 I SCMO I NRZII LOOP I PFS I NB I NFCS I
In addition to the applications mentioned above, all of The Serial Mode Register (Address C9H) selects the
the format variations are useful in the support of non- operational modes of the SIU. The 8044 CPU can both
standard bit-synchronous protocols. read and write SMD. The SIU can read SMD but can-
not write to it. To prevent conflict between CPU and
SIU access to SMD, the CPU should write SMD only
6.0 HOLC when the Request To Send (RTS) and Receive Buffer
Empty (RBE) bits (in the STS register) are both false
In addition to its support of SDLC communications, (0). Normally, SMD is accessed only during initializa-
the 8044 also supports some of the capabilities of tion.
HDLC. The following remarks indicate the principal
differences between SDLC and HDLC. The individual bits of the Serial Mode Register are as
follows:
HDLC permits any number of bits in the information Blt# Name Description
field, whereas SDLC requires a byte structure (multiple
of 8 bits). The 8044 itself operates on byte boundaries, SMD.O NFCS No FCS field in the SDLC
frame.
and thus it restricts fields to multiples of 8 bits.
SMD.1 NB Noon-Buffered mode. No
control field in the SDLC
HDLC provides functional extensions to SDLC: an un- frame.
limited address field is allowed, and extended frame
SMD.2 PFS Pre-Frame Sync mode. In
number sequencing. this mode, the 8044
transmits two bytes before
HDLC does not support operation in loop configura- the first flag of a frame, for·
tions. DPLL synchronization. If
NRZI is enabled, OOH is
sent; otherwise, 55H is sent.
7.0 SIU SPECIAL FUNCTION In either case, 16 pre-frame
transitions are guaranteed.
REGISTERS SMD.3 LOOP Loop configuration.
The 8044 CPU communicates with and controls the SMD.4 NRZI NRZI coding option.
SIU through hardware registers. These registers are ac- SMD.5 SCMO Select Clock Mode-Bit 0
cessed using direct addressing. The SIU special func- SMD.6 SCM1 Select Clock Mode-Bit 1·
tion registers (SIU SFRs) are of three types: SMD.7 SCM2 Select Clock Mode-Bit 2
Control and Status Registers The SCM bits decode as follows:
Parameter Registers SCM
Clock Mode Data Rate
ICE Support Registers (Bits/sec)·
210
000 Externally clocked 0-204M··
7.1 Control and Status Registers 001 Undefined
010 Self clocked, timer overflow 244-62.5K
There are three SIU Control and Status Registers:
011 Undefined
Serial Mode Register (SMD) 1 00 Self clocked, external 16x 0-375K
1 0 1 Self clocked, external 32x 0-187.5K
Status/Command Register (STS)
1 1 0 Self clocked, internal fixed 375K
Send/Receive Count Register (NSNR) 111 Self clocked, internal fixed 187.5K
The SMD, STS, and NSNR registers are all cleared by ·Based on a 12 MHz crystal frequency
• ·0-1 M bps in loop configuration
system reset. This assures that the SIUwill power up in
an idle state (neither receiving nor transmitting).
13-9
intJ RUPITM_44 SIU
should access STAD only when the sm is idle (RTS = RFL: RECEIVE FIELD LENGTH REGISTER
o and RBE = 0). Normally, STAD is accessed only (BYTE-ADDRESSABLE)
during initialization.
The Received Field Length register (Address CDH)
contains the length (in bytes) of the received I-field that
TBS: TRANSMIT BUFFER START ADDRESS has just been loaded into on-chip RAM. RFL is loaded
REGISTER (BYTE-ADDRESSABLE) by the sm. RFL = 0 is valid. RFL should be accessed
The Transmit Buffer Start address register (Address by the CPU only when RBE = O.
DCH) points to the location in on-chip RAM for the
beginning of the I-field of the frame to be transmitted. RCB: RECEIVE CONTROL BYTE REGISTER
The CPU should access TBS only when the SIU is not (BYTE-ADDRESSABLE)
transmitting a frame (when TBF = 0).
The Received Control Byte register (Address CAH)
contains the control field of the frame that has just been
TBL: TRANSMIT BUFFER LENGTH REGISTER received. RCB is loaded by the sm. The CPU can only
(BYTE-ADDRESSABLE) read RCB, and should only access RCB when RBE =
The Transmit Buffer Length register (Address DBH) O.
contains the length (in bytes) of the I-field to be trans-
mitted. A blank I-field (TBL = 0) is valid. The CPU
should access TBL only when the SIU is not transmit- 7.3 ICE Support Registers
ting a frame (when TBF = 0). The 8044 In-Circuit Emulator (ICE-44) allows the user
to exercise the 8044 application system and monitor the
NOTE: execution of instructions in real time.
The transmit and receive buffers are not allowed to
"wrap around" in the on-chip RAM. A "buffer end" The emulator operates with Intel's Intellec® develop-
is automatically generated if address 191 (BFH) is ment system. The development system interfaces with
reached. the user's 8044 system through an in-cable buffer box.
The cable terminates in a 8044 pin-compatible plug,
TCB: TRANSMIT CONTROL BYTE REGISTER which fits into the 8044 socket in the user's system.
(BYTE-ADDRESSABLE) With the emulator plug in place, the user can exercise
his system in real time while collecting up to 255 in-
The Transmit Control Byte register (Address DAH) struction cycles of real-time data. In addition, he can
contains the byte which is to be placed in the control single-step the program.
field of the transmitted frame, during NON-AUTO
mode transmission. The CPU should access TCB only Static RAM is available (in the in-cable buffer box) to
when the SIU is not transmitting a frame (when TBF emulate the 8044 internal and external program memo-
= 0). The Ns and NR counters are not used in the ry and external data memory. The designer can display
NON-AUTO mode. and alter the contents of 'the replacement memory in
the buffer box, the internal data memory, and the inter-
nal 8044 registers, including the SFRs.
RBS: RECEIVE BUFFER START ADDRESS
REGISTER (BYTE-ADDRESSABLE) Among the SIU SFRs are the following registers that
The Receive Buffer Start address register (Address support the operation of the ICE:
CCH) points to the location in on-chip RAM where the
beginning of the I-field of the frame being received is to DMA CNT: DMA COUNT REGISTER
be stored. The CPU should write RBS only when the (BYTE-ADDRESSABLE)
SIU is not receiving a frame (when RBE = 0).
The DMA Count register (Address CFH) indicates the
number of bytes remaining in the information block
RBL: RECEIVE BUFFER LENGTH REGISTER that is currently being used.
(BYTE-ADDRESSABLE)
The Receive Buffer Length register (A.ddress CBH) FIFO: THREE-BYTE (BYTE-ADDRESSABLE)
contains the length (in bytes) of the area in on-chip
RAM allocated for the received I-field. RBL = 0 is The Three-Byte FIFO (Address DDH, DEH, and
valid. The CPU should write RBL only when RBE = DFH) is used between the eight-bit shift register and
O. the information buffer when an information block is
received.
13-11
inter RUPITM_44 SIU
The SIU Suite Counter (Address D9H) reflects the 2SH Waiting for I field byte. This state can be
state of the internal logic which is under SIU control. entered from state 20H or from states
01 H, OSH, or 10H depending upon the
Therefore, care must be taken not to write into this
register. SIU's mode configuration. (Each time a
byte is received, it is pushed onto the top
of the FIFO and the byte at the bottom is
The SIUST register can serve as a helpful aid to deter-
put into memory. For no FOS formatted
mine which field of a receive frame that the SIU ex-
pects next. The table below will help in debugging 8044 frames, the FIFO is collapsed into a
reception problems. single register).
30H Waiting for the closing flag after having
SIUST overflowed the receive buffer. Note that
Function even if the receive frame overflows the
Value
assigned receive buffer length, the FOS
01H Waiting for opening flag.
is still checked.
OSH Waiting for address field.
10H Waiting for control field. Examples of SIUST status sequences for different frame
lSH Waiting for first byte of I field. This state formats are shown below. Note.that status changes af-
is only entered if a FOS is expected. It ter acceptance of the received field byte.
pushes the received byte onto the top of
the FIFO. . .
20H Waiting for second byte of I field. This
state always follows state lSH.
Example 2:
Frame Format 1 (Idle) 1 F 1 A 1 I 1 F0 S I. F 1 o
2S
SIUST Value _0_1:...,..J.L...0-=-1:..L.:.OS::..J....:1~S...JI...:2:.:0:..L1...:2::S:...J,-'::::::"":_L.::0:.:.
L, 1__
Example 3:
Frame Format I o o
SIUSTValue
Example 4:
Frame Format I (Idle) I F I A I I I F I
SIUSTValue I 01 I 01 I OS I 2S I 01 I
Example 5:
Frame Format t.!.(I"..dl,..;e)+1 _:...1_-I-I_F~I
",:-F-+I.;..' o
SIUST Value . L_ _0_1_J...,_01.;....L._~2.:.S_.L-=0~1...J
ExampleS:
Frame Format 1 (Idle) -, F l'
I .' 1 I OVERFLOW I FOS 1 F 1 o o
SIUSTValue 1 01 1 0111s120 12s1 30 1 .30 1011
13-12
intJ RUPITM-44 SIU
8.0 OPERATION TBS, TBL - to define the area in RAM allocated for
the Transmit Buffer.
The SIU is initialized by a reset signal (on pin 9), fol-
lowed by write operations to the SIU SFRs. Once ini- Once these registers have been initialized, the user may
tialized, the SIU can function in AUTO mode or NON- write to the STS register to enable the SIU to leave the
AUTO mode. Details are given beiow. ' idle state, and to begin transmits and/or receives.
END-OF-
FRAME
FLEXIBLE
MODE
STRTREC STRTXMIT
FLEXIBLE
MODE
END-OF·FRAME
AUTO MODE
13-13
inter RUPITM-44 SIU
13-14
RUPITM~44 SIU
RECEIVE
NEXTBYTE
NO
NO
YES
lAO
s •• Figure, 7c thru 7)
296165-10
13-15
inter RUPITM~44 SIU
uAM" ......
uSI" -4-1
"RBE tI. . - •
..SES......
uSER"~'
296165-11
13-16
RUPITM·44 SIU
.IIAMn~o
"RBE"..-O
"SI" .... 1
296165-12
NO
296165-13
13-18
inter RUPITM_44 SIU
BAD
I COMMAND
NRi~
N P --NRS
NllSl + 1
,,~ '- 1, "Na" - •
"RBE"_'
"TBF"_'
Ns-Ns+1
"5ES"_.
"SER"_'
"SI" _1
296165-14
13-19
intJ RUPITM·44 SIU
BAD
ICpMMAND
NRIP) ~ HsIS)
HsIP) ~ HRIS)
"AM" = ,,"Nan ....
.. RBE...... .
.. SES...... .
.. SER ...... .
"SI" .... 1
296165-15
BAD
I COMMAND
NAIP) " NsIS) + ,
NRIP) '" NsIS)
NsIP) - NAIS)
"AM" - " "NB" =0
"AM" ....
"SES"-+-'
"SER"-+-O
"RBE"_O
"51" ... ,
296165-16
13-21
inter RUPITM-44 SIU
BAD
I COMMAND
NR(P) - NS(S) + 1
NS(P) .. NR(S)
"AM" = 1, "NB" = 0
.. BOV..... 1
"AM" ....
..RBE.. ·....
"TBF"_.
NS~NS+l
"SES"_'
"SER" .... 1
"SI" _1
296165-17
13-22
RUPITM·44 SIU
BAD
I COMMAND
NRIP) - NsIS)
NsIP) .. NRIS)
"AM" "'" 1, "NB" = 0
"AM" _ _ "BOY"_1
"AM" _ _
"RBE" _ _ "RBE" . . _
SI _1
uSI" -4-1
296165-18
13-23
inter RUPITM·44 SIU
BAD
I COMMAND
HAIPI" Ha\SI + 1
NRP "NaS
NaIP)" NR P)
"AM" - 1. nNB" .. 0
UAM" ....
"RBE"'-'
"SES"'-l
"SER"~1
1181" ..... 1
296165-19
13·24
intJ RUPITM·44 SIU
296165-20
13-25
RUPITM-44 SIU
LOAD I-FIELD
INTO
XMITBUFFER
PROCESS
INFORMATION
OR
SET "RBP"
296165-21
13-26
inter RUPITM_44 SIU
RECEIVE
NEXT BYTE
NO -----j
I
YES
I
I
ABORT,
SHORT FRAME
I
OR INVALID I
RECEIVE MESSAGE
CTRL FIELD ....RCB,
- - -
I RBE ~.
.... (ABORT FROM CPU)
I FIELD .... REC BUF,
SET BOV ON OVERRUN
BAD
GOOD
CLEAR "RBE"
SET "SI"
L----------toII-------...J
296165-22
13-27
inter RUPITM-44 SIU
PROCESS MESSAGE,
SeT UP RESPONSE
IF NECESS;ARY
296165-23
13-28
inter RUPITM-44 SIU
~UT-OFF - LOOP) +
CTS-LOOP
r - - - - -=.- - -
TRANSMIT MESSAGE
USING TCB FOR
CONTROL FIELD
----,
[ABORT FROM PRIMARY]
I TBF
(ABORT FROM CPU)
I
I I
~ I
I
CLEAR "TBF"
I
~=~l_ _~_ _ _ _ _ _ _ _~~~~~ ______ J
CLEAR "RTS"
SET "SI"
TRANSMIT
ABORT
SEQUENCE
296165-24
13-29
inter RUPITM·44 Slu
CLEAR"SI"
lIMIT
= I,PENDING
TBF INDICATEB
BUFFULL LAST TRANSMIT
ABORTED IV CPU
ORPR_V.
BUFEMPTY
296165-25
9.0 MORE DETAILS ON SIU The zero insert/delete circuitry (ZID) performs zero
HARDWARE insertion/deletion, and also detects flags, GA's (Go-
Ahead's), and aborts (same as GA's) in· the data
The SIU divides functionally into two sections-a bit stream. The pattern 1111110 is detected as an early
processor (BIP) and a byte processor (BYP~haring GA, so that the GA may be turned into a flag for loop
some common timing and control logic. As shown in mode transmission.
Figure 14, the BIP operates between the serial port pins
and the SIU bus, and performs all functions necessary The shut-off detector monitors the receive data stream
to transmit/receive a byte of data to/from the serial for a sequence of eight zeros, which is a shut-off com-
data stream. These operations include shifting, NRZI mand for loop mode transmissions. The shut-off detec-
encoding/decoding, zero insertion/deletion, and FCS tor is a three-bit counter which is cleared whenever a
generation/checking. The BYP manipulates bytes of one is found in the receive data stream. Note that the
data to perform message formatting, and other trans- ZID logic could not be used for this purpose, because
mitting and receiving functions. It operates between the the receive data must be monitored even when the ZID
SIU bus (SIB) and the 8044's internal bus (IB). The is being used for transmission.
interface between the SIU and the CPU involves an
interrupt and some locations in on-chip RAM space As an example of the operation of the bit processor, the
which are managed by the BYP. following sequence occurs in relation to the receive
data:
The maximum possible data rate for the serial port is 1) RXD is sampled by SCLK, and then synchronized
limited to '12 the internal clock rate. This limit is im- to the internal processor clock (IPC).
posed by both the maximum rate of DMA to the on- 2) If the NRZI mode is selected, the incoming data is
chip RAM, and by the requirements of synchronizing NRZI decoded.
to an external clock. The internal clock rate for an 8044
running on a 12 MHz crystal is 6 MHz. Thus the maxi- 3) When receiving other than the flag pattern, the ZID
mum· 8044 serial data rate is 3 MHz. This data rate deletes the '0' after 5 consecutive 'l's (during trans-
drops down to 2.4 MHz when time is allowed for exter- mission this zero is inserted). The ZID locates the
nal clock synchronization. byte boundary for the rest ofthe circuitry. The ZID
deletes the 'O's by preventing the SR (shift register)
from receiving a clocking pulse.
9.1 The Bit Processor 4) The FCS (which is a function of the data between
the flags-notincluding the flags) is initialized and
In the asynchronous (self clocked) modes the clock is started at the detection of the byte boundary at the
extracted from the data stream using the on-chip digital end of the opening flag. The FCS is computed each
phase-locked-loop (DPLL). The DPLL requires a clock bit boundary until the closing flag is detected. Note
input at 16 times the data rate. This 16 X clock may that the received FCS has gone through the ZID
originate from SCLK, Timer 1 Overflow, or PH2 (one during transmission.
half the oscillator frequency). The extra divide by-two
described above allows these sources to be treated alter-
natively as 32 X clocks. 9.2 The Byte Processor
The DPLL is a free-running four-bit counter running Figure 15 is a block diagram of the byte processor
off the 16 X clock. When a transition is detected in the (BYP). The BYP contains the registers and controllers
receive data stream, a count is dropped (by suppressing necessary to perform the data manipulations associated
the carry-in) if the current count value is greater than 8. with SDLC communications. TheBYP registers may
A count is added (by injecting a carry into the second be read or written by the CPU over the 8044's internal
stage rather than the first) if the count is less than 8. No bus (IB), using standard 8044 hardware register opera-
adjustment is made if the transition occurS at the count tions. The 8044 register select PLA controls these oper-
of 8. In this manner the counter locks in on the point at ations. Three of the BYP registers connect to the IB
which transitions in the data stream occur at the count through the IBS, a sub-bus which also connects to the
of 8, and a clock pulse is generated when the count CPU interrupt control registers.
overflows to O.
13-31
RUPITM·44 SIU
INTERRUPT
IB'
1
RAM CPU
SIB I
I
L _____________ ~ _________ ~---J
296165-26
Simultaneous access of a register by both the IB and the 2) Assuming that there is a control field in the frame,
SIB is prevented by timing. In particular, RAM access the BYP takes the next byte and loads it into the
is restricted to alternate internal processor cycles for RCB register. The RCB register has the logic to
the CPU and the SIU, in such a way that collisions do update the NSNR register (increment receive count,
not occur. set SES and SER flags, etc.).
3) Assuming thatthere is an information field, the next
As an example of the operation of'the byte processor, byte is dumped into RAM at the RBS location. The
the following sequence occurs in relation to the receive DMA CNT (RBL at the opening flag) is loaded
data: from the DMA CNT register into the RB register
1) Assuming that there is an address field in the frame, and decremented. The RFL is then loaded into the
the BYP takes the station address from ihe regist~ RB register, incremented, and stored back into the
me into temporary storage. After the opening flag, register me.
the next field (the address field) is compared to the 4) This process continues until the DMA CNT reache~
station address in the temporary storage. If a match zero, or until a closing flag is received. Upon either
occurs, the operation continues. event, the BYP updates the status, and, if the CRC
is good, the NSNR register.
13·32
intJ RUPITM·44 SIU
Ir----~----------,
RAM
SIB
BYP
TIMING SHARED IB
AND REGISTERS
CONTROL
I
I
I
~ I
I
L ______________ ~~
296165-27
10.0 DIAGNOSTICS stream to the SIU by writing to P3.0. The transmit data
stream can be monitored by reading P3.1. Each succes-
An SIU test mode has been provided, so that the on- sive bit is transmitted from the sm by writing to any
chip CPU can perform limited diagnostics on the SIU. bit in .Port 3, which generates SCLK.
The test mode utilizes the output latches for P3.0 and
P3.1 (pins 10 and II). These port 3 pins are not useful In test mode, the P3.0 and P3.1 pins are placed in a
as out-put ports, since the pins are taken up by the high voltage, high impedance state; When the CPU
serial port functions. Figure 16 shows the signal routing reads P3.0 and P3.1 the logic level applied to the pin
associated with the SIU test-mode. will be returned. In the test mode, when the CPU reads
3.1, the transmit data value will be returned, not the
Writing a 0 to P3.1 enables the serial test mode (P3.1 is voltage on the pin. The transmit dilta remains constant
set to I by reset). In test mode the P3.0 bit is mapped for a bit time. Writing to P3.0 will result in the signal
into the received data stream, and the 'write port 3' being outputted for a short period of time. However,
control signal is mapped into the SCLK path in place of since the signal is not latched, P3.0 will quickly return
TI. Thus, in test mode, the CPU can send a serial data to a high voltage, high impedance state.
13-33
.~. ..
!J
SCLKI
'5
~_'_-r_IQ-~~-~-H~DI_·~
----' 1 ~. ~ I _,_
SYSCLK
I l
..
L!J
'IN1"
~
,I
/1
A
PH
~§-
_.-
.. RXDI
...
~ •
~
f
__
~n ~
....
w .~
~.,..,...
c:i!:
en
2
READ PORT 3
WRITE PORT 3
PINII
DATAl SlU
TXDI TRANSMIT
P31 DATA
STREAM
296165-28
inter RUPITM_44 SIU
The serial test mode is disabled by writing a I to P3.1. transmits a supervisory frame. This frame consists of an
Care must be taken that a 0 is never written to P3.1 in opening flag, followed by the station address, a control
the course of normal operation, since this causes the field indicat~g that this is a supervisory frame with an
test mode to be entered. , RNR command, and then a closing flag.
Figure 17 is an example of a simple program segment Each byte of the frame is transmitted by writing that
that can be imbedded into the user's diagnostic pro- byte into the A register and then calling the subroutine
gram. That example shows how to put the 8044 into XMIT8~ Two additional SCLKs are generated to guar-
"Loop-back mode" to test the basic transmitting and antee that the last bits in the frame have been clocked
receiving functions of the SIU. into the SIU. Finally the CPU reads the status register
(STS). If the operation has proceeded correctly, the
Loop-back mode is functionally equivalent to a hard- status will be 072H. If it is not, the program jumps to
wire connection between pins 10 and 11 on the 8044. the ERROR loop and terminates.
In this example, the 8044 CPU plays the role of the The SIU generates an SI (SIU interrupt) to indicate
primary station. The SIU is in the AUTO mode. The that it has received a frame. The CPU clears this inter-
CPU sends the SIU a supervisory frame with the poll rupt, and then begins to monitor the data stream that is
bit set and an RNR command. TheSIU responds with being generated by the SIU in response to what it has
a supervisory frame with the poll bit set and an RR received. As each bit arrives (via P3.1), it is moved into
command. the accumulator, and the CPU compares the byte in the
accumulator with 07EH, which is the opening flag.
The operation proceeds as follows: When a match occurs, the CPU identifies this as byte
boundary, and thereafter processes the information
Interrupts are disabled, and the self test mode is en- byte-to-byte.
abled by writing a zero to P3.1. This establishes P3.0 as
the data path from the CPU to the SIU. CTS (clear-to- The CPU calls the RCV8 subroutine to gct each byte
send) is enabled by writiIjg a zero to P1.7. The station into the accumulator. The CPU performs compare op-
address is initialized by writing 08AH into the STAD er~tions on (successively) the station address, the con-
(station address register). trol field (which contains the RR response), and the
closing flag; If any of 'these do not compare, the pro-
The SIU is configured for receive operation in the gram jumps to the ERROR loop. If no error is, found,
clocked mode and in AUTO mode. The CPU then the program jumps to the DONE loop.
13-35
inter RUPITM.-44 SIU
I'
2
0000 7SCaOO '3 INIT: MOIl . BTS.IOOH
. DDQ3 C211 4 CLR P3,I I Enebl. ,.U t •• t Mod.
0005 C297 5 ,CLR PI.7 En.bl. eTa
0007 7SCEBA 6 .II1I\I 'STAD. lBAH J Int tiel i Ie .eld" •••
,7
8 J' CONFIGURE RECEIVE OPERATION
9
OODA "7'D86~ 10 11011 NBHR • • •AH NSCS)-3; SES-C. NR(9)-,. SER-O
DODD 7,C901 11 II1I\I BI1D, eolH NFee-t
0010 7'CaC2 12 ICIII aTB. eOC2H J TIF-l. RIE-l, Nt-l
13
14· TRMSI1IT A _ERIiISORV FR_ FRDI1 THE PRII1M~ STATION WITH.THE POLL.
15 8 IT SET AND A RNA CDI1IIAND
16
0013 747E 17 S~N~: ICI\I A. 17EH Th. SIU rec .. i V.I .. ne. ftT's.'"
0015 1200..6 18 CALL XI1ITS
oole 74.... 19 11011 A. laAH , The .dd" ••• is n •• t
OOIA 120066
OOID 7495
20
21
CIILL
II1I\I
XI'IIT&
A. 1095H , RNIt SUP FANE with P/F-l. NRCP)-4
OOIF 120066 22 CIILL
0022 747E 23 11011
XI'IIT8
A. 17EH , Receive clasing fie.
0024 120066 24 " CIILL 1"IT8
0027 D210 25
'.26
SETa P3,O O.n.".t ••• t".
SCUV. to
0029 D210 ··8ETI P3,O Initiate "eceive acUon
27
002a E,eB 28 "Oil It.,i 8T9 Chec II '0" .p,,,o,,,i.te st.tus
002D 14722A 29 CJNE A. .72H. ERROR
30
31 ; PREPIt.RE TO RECEIVE RUP!'. RESPONCE TO PRI"lt.Ry·S RNA
32
33
34
0030 ·C2CC 35 REClio CLA Cl •• " II
0032 7400. 36 IlO\l .Cl •• " ACC
0034 710C 37 ICI\I I T"II l2 ti •••
38
39 LIIOK. FOR THE OPENING FLAO
40
0036 D210 41 WFLIIO I: :SETB P3.0 I SCL.M.'
0038 A211 42 1'1011 C, P3.1 I T".n •• itt.1I d.t•
003A 13 43 . ', RRC A
0031 147E03 44 C.JNE AI .07EH. WFLO 1
OOlE 0:10046 45 JI'ff' CNTINU
0041 DIF3 46 WFLO I : D.JNZ R3. WFLAOI
0043 0200"'" 47 JI1P ERROR
48
49
0046 1200SC 50 CNTINU: CALL RCIIB O.t SIU'. T".n •• itted .dd" ••• U.U
004914_ 51 A. 1000H. ERROR
004C 1200SC 52
C"NE
CALL RCIIB , P"'··"II e.pect. ta ,..eceiv. RR '''D. SIU
oo4F 141108 53 C"NE A. 10BlH. ERROR
0052 I:IOOSC 54 CALL RCIIS Receive clasing fl ••
0055 147E02
005e aOFE
"56 C"NE A. 107EH. ERROR
57
58
DONE: "11P DONE
00"," 80FE 5. ERROR: JI1P ERROR
60
61
OO5C 7808 62 RCIIB: 11011 RO.108 , In' tieU I. the, b" cDunt."
oo5E D2ao 63 OETB I T: SETB P3,O SCLK
0060 A211 64 11011 C. P3, I I T"e".1111 tted d.t.
0062 13 65 RRC A
0063 D8F9 66 DJNZ RO. OETIIT
0065 22 67 RET
68
6"
70
0066 780" 71
0068 13 72
73
006" DBOI 74
0068 22 75
76
006C 4004 77
7a
006E C2BO 79
0070 BOF6 80
81
007~ D280 82
0074 8OF2 83
84
296165-29
13-36
8044 Application Examples . 14
8044 APPLICATION EXAMPLES
1.0 INTERFACING THE 8044 TO A ure 3 shows the 8088 and support circuitry; the memo-
MICROPROCESSOR ry and decoders are not shown. It is a basic 8088 Min
Mode system with an 8237A DMA controller and an
The 8044 is designed to serve as an intelligent control- 8259A interrupt controller.
ler for remote peripherals. However, it can also be used
as an intelligent HDLC/SDLC front end for a micro- DMA Channel One transfers a block of memory to the
processor, capable of extensively off-loading link con- tri-state latch, while Channel Zero transfers a block of
trol functions for the CPU. In some applications, the data from the latch to 8088's memory. The. 8044's In-
8044 can even be used for communications preprocess- terrupt 0 signal vectors the CPU into a routine which
ing, in addition to data link control. reads from the internal RAM and writes to the latch.
The 8044's Interrupt 1 signal causes the chip to read
This section describes a sample hardware interface for from the latch and write to its on-chip data RAM. Both
attaching the 8044 to an 8088. It is general enough to DMA requests and acknowledges are active low.
be extended to other microprocessors such as the 8086 .
or the 80186. Initially, when the power is applied, a reset pulse com-
ing from the 8284A initializes the SR flip-flops. In this
initialization state, the 8044's transmit interrupt and
OVERVIEW the 8088's transmit DMA request are active; however,
the software keeps these signals disabled until either of
A sample interface is shown in Figure 1. Transmission the two processors are ready to transmit. The software
occurs when the 8088 loads a 64 byte block of memory leaves the receive signals enabled, unless the receive
with some known data. The 8088 then enables the buffers are full. In this way either the 8088 or the 8044
8237A to DMA this data to the 8044. When the 8044 are always ready to receive, but they must enable the
has received all of the data from the 8237A, it sends the transmit signal when they have prepared a block to
data in a SDLC frame. The frame is captured by the transmit. After a block has been transmitted or re-
Spectron Datascope™* which displays it on a CRT in ceived, the DMA and interrupt signals return to the
hex format. initial state.
In reception, the Datascope sends a SDLC information The receive and transmit buffer sizes for· the blocks of
frame to the 8044. The 8044 receives the SDLC frame, data sent between the 8044 and the 8088 have a maxi-
buffers it, and sends it to the 8088's memory. In this mum fixed length. In this case the buffer size was 64
e~ample the 8044 is being operated in the NON-AUTO
bytes. The buffer size must be less than 192 bytes to
mode; therefore, it does not need to be polled by a pri- enable 8044 to buffer the data in its on-chip RAM. This
mary station in order to transmit. design allows blocks of data that are less than (i4 bytes,
and accommodates networks that allow frames of vary-
THE INTERFACE ing size. The first byte transferred between the 8088
and the 8044 is the byte count to follow; thus the 8044
The 8044 does not have a parallel slave port. The knows how many bytes to receive before it transmits
8044's 32 I/O lines can be configured as a local micro- the SDLC frame. However, when the 8044 sends data
.processor bus master. In this configuration, the 8044 to the 8088's memory, the .8237A will not know if the
can expand the ROM and RAM memory, control pe- 8044 will send less than the count the 8237A was pro-
ripherals, and communicate with a microprocessor. grammed for. To solve this problem, the 8237A is oper-
ated in the single mode. The 8044 uses an I/O bit to
The 8044, like the 8051, does not have a Ready line, so generate an interrupt request to the 8259A. In the
there is no way to put the 8044 in wait state. The clock 8088's interrupt routine, the 8237A's receive DMA
on the 8044 cannot be stopped. Dual port RAM could channel is disabled, ~us allowing blocks of data less
still be used, however, software arbitration would be than 64 bytes to be received.
the only way to prevent collisions. Another way to in-
terface the 8044 with another CPU is to put a FIFO or
queue between the two processors, and this was the THE SOFTWARE
method chosen for this design. The software for the 8044 and the 8088 is shown in
Table 1. The 8088 software was written in PL/M86,
Figure 2 shows the schematic of the 8044/8088 inter- and the 8044. software was written in assembly lan-
face. It involves two 8-bit tri-state latches, two SR flip- guage.
flops, and some logic gates (6 TTL packs). The circuit-
ry implements a one byte FIFO. RS422 transceivers are The 8044 software begins by initializing the stack, in-
used, which can be connected to a multidrop link. Fig- terrupt priorities, and triggering types for the inter-
*Datascope is a trademark of Spectron Inc. rupts. At this point, the SIU parameter registers are
14-1
inter RUPITM_44
DATASCOPE
296166-1
initialized. The receive and transmit buffer starting ad- NormaIly this interrupt remains disabled. However, if a
dresses and lengths are loaded for the on-chip DMA. serial interrupt occurs, and the SERIAL INT routine
This DMA is for the serial port. The serial station ad- detects that a frame has been received, it caIls the
dress and the transmit control bytes are loaded too. SEND subroutine. The SEND subroutine loads the
. number of bytes which were received in the frame into
Once the initialization has taken place, the SIU inter- the receive buffer. Register RI points to the receive
rupt is enabled, and the external interrupt which· re- .buffer and R2 is loaded with the count. The TRANS-
ceives bytes from the 8088 is enabled. Setting the 8044's MIT DMA interrupt is enabled, and immediately upon
Receive Buffer Empty (RBE) bit enables the receiver. If returning from the SERIAL INT routine, the interrupt
thiS bit is reset, no serial data can be received. The 8044 is acknowledged. Each time the TRANSMIT DMA in-
then waits in a loop for either RECEIVE DMA inter- terrupt occurs, a byte is read from the receive buffer,
rupt or the SERIAL INT interrupt. written to the latch, and R2 is decremented. When R2
reaches 0, the TRANSMIT DMA interrupt is disabled,
The RECEIVE DMA interrupt occurs when the the SIU receiver is re-enabled, and the 8044 interrupts
8237A is transferring a block of data to the 8044. The the 8088.
first time this interrupt occurs, the 8044 reads the latch
and loads the count value into .the R2 register. On sub-
sequent interrupts, the 8044 reads the latch, loads the .CONCLUSION
data into the transmit buffer, and decrements R2. For the software shown in Table I, the transfer rate
When R2 reaches zero, the interrupt routine sends the from the 8088's memory to the 8044 was measured at
data in an SDLC frame, and disables the RECEIVE 75K bytes/sec. This transfer rate largely depends upon
DMA interrupt. After the frame has been transmitted, the number of instructions in the 8044's interrupt serv-
a serial interrupt is generated. The SERIAL INT rou- ice routine. Fewer instructions result in a higher trans-
tine detects that a frame has been transmitted and re- fer rate.
enables the RECEIVE DMA interrupt. Thus, while the
frame is being transmitted through the SIU, the 8237A There are many ways of interfacing the 8044 loca1ly to
is inhibited from sending data to the 8044's transmit another microprocessor: FIFO's, dual port RAM with
buffer. .
software arbitration, and 8255's are just a few. Alterna-
tive approaches, which may be more optimal for certain
The TRANSMIT DMA routine sends a block of data applications, are certainly possible.
from ·the 8044's receive buffer to the 8088's ~emory.
14-2
DACKI
l
"'II
c'
c
iil
!"
:g .
....
.... :D
..... 5'
....•
Co)
-
CD
::l.
c:
'U
~
~
CD
DACK,
•••
0'
if
CD
g
CD
Vee
PI
296166-2
CS ~
~ "''''''
OBOOOFOH
·s
l
B3 6520
PCLK rr:==~:j:~
SEL
A3
g~03
04
MEMR
lOR
MEMW
M~ ~
CLK B1 5257 +5V
~ 03 ~
"1\
iFi ~ M~ {~
c
; r---~------------------------~8237CS
r----i> +5V
~ - 0 RESET
CO
~~ITn~~t~!f::~====~3~~~~ HlDA
g ...,b-:==.......Ir--. DACK. DACK.
XI
c:
..... CO +5 HOLO ALE Dt g~~~
DREQt g:~~l
DREQt
"U
3C CLK 8237-2 DREQ2 DREQ2
~
.j>.
.P.. S" RESEli OACK2
OREQ3
OACK2
I
~ INTR 01lio
g-
j
r
li
NMI
8088 AD7
r========~STB~-JOE""--'
017 D07 J1
~
AO-A7
01lio
B =
3 (MIN) :: g:: gg: F1
TEST g:; N ~
INTR ~g~ gl~ :s gw,
A15A~ll1~ADt Ott .. Dot (((((((( -ooo-D7
~
...J.
~~~ l{ D~M
•
OESTB~
DI7 007
015 DOS '
014 N 004
g~; gg~
011 DOl
Ott Oot1J
296166-3
intJ RUPITM-44
14-5
intJ RUPITM·44
82 TRANSMILDMA
83
0079 E7 84 MOV A.@RI ; READ BYTE OUT OF THE RECEIVE BUFFER
007A FO 85 MOVX [email protected] ; WRITE IT TO THE LATCH
0078 09 86 INC RI
007C DA08 87 DJNZ R2.13 ; WHEN ALL 8YTES HAVE. BEEN SENT
88
007E C2A8 89 ClR IE.O ; DISABLE INTERRUPT
0080 C294 90 CLR PI.4 ; CAUSE 8088 INTERRUPT TO TERMINATE DMA
0082 D294 91 SETB PI. 4
0084 D2CE 92 SETB RBE ; ENABLE RECEIVER AGAIN
93
0086 32 94 13: RETI
95
96
97
0087 98 LOC-T~PSET S
0023 99 ORG 0023H
0023 020087 100 LJMP SERIALINT
0087 101 ORG LOC-TMP
102
103 SERIALINT:
104
0087 3OCE06· 105 JNB RBE.RCV ; WAS A FRAME RECEIVED
008A 30CFOB 106 JNB TBF.XMIT ; WAS A FRAME TRANSMITTED
008D 020056 107 LJMP ERROR ; IF NEITHER ERROR
108
00902OCBC3 109 RCV: JB BOV.ERROR ; IF BUFFER OVERRUN THEN ERROR
0093 1158 110 CALL SEND. . ; SEND THE FRAME TO THE 8088
0095 C2CC III CLR SI
0097 32 112 RETI
113
0098 C2CC 114 XMIT: CLR SI 296166-70
14-6
inter RUPITM-44
14-7
inter RUPITM-44
.DEBUg
.TITLE C'RUPI/BOBB INTERFACE EXA~PLE')
2 DECLARE
LIT LITERALLY 'LITERALLY',
TRUE LIT '01H',
FALSE LIT 'OOH',
RECV_BUFFER(64) BYTE,
X~IT_BUFFER(64) BYTE,
I BYTE,
WAIT BYTE,
'* 8237 PORTS*'
I'tASTER_CLEAR_37 LIT 'OFFDDH',
CO~AND_37 LIT 'OFFDBH',
ALL_~ASK_37 LIT 'OFFDFH',
SINQLE_I'tASK_37 LIT 'OFFDAH',
STATUS 37 LIT 'OFFDSH',
REQUEST_REg_37 LIT 'OFFD9H',
~DE_REg_37 LIT 'OFFDBH',
CLEAR_BYTE.fTR_37 LIT 'OFFDCH',
.EJECT
,. 8259 PORTS .,
STATUS_POLL_59 LIT 'OFFEOH',
ICWl_59 LIT 'OFFEOH',
OCWl_59 LIT 'OFFEIH',
OCW2_59 LIT 'OFFEOH', "
OCW3_59 LIT 'OFFEOH',
ICW2_59 LIT 'OFFEIH',
ICW3_59 LIT 'OFFEIH',
ICW4_59 LIT 'OFFEIH',
,. INTERRUPT SERVICE ROUTINE .,
OFF_RECVJ)I'IA: PROCEDURE INTERRUPT 32,
4 2 OUTPUTCSINQLEJ1ASK_37).40H,
5 2 WAIT-FALSE,
6 2 END,
296166-4
14-8
RUPITM-44
7 DISABLE.
'* INITIALIZE 8237 *'
8 I oUTPUTCMA8TER_CLEAR_37) -0.
9 I OUTPUT CCDHMAND_37) -04OH,
10 I OUTPUTCALL~ASK_37) -OFH.
II I OUTPUTCMDDE_REg_37) -C8INQLE~DE OR WRITE_XFER DR CHO_SEL),
12 I oUTPUTCMODEjREg_37) -CSINQLE_MDDE DR READ_XFER DR CHI_SEL),
13 I oUTPUTCCLEAR_BYTE-PTR_37) -0.
14 I oUTPUTCCHO~DDR) -OOH,
1:1 I oUTPUTCCHO~DDR) -40H.
16 I OUTPUTCCHO_COUNT) -64,
17 I OUTPUT CCHO_CoUNT) -00;
18 I OUTPUTCCHI_ADDR) -40H,
19 I oUTPUTCCHI_ADDR) -4OH,
20 I oUTPUTCCHI_COUNT) -64,
21 I OUTPUTCCHI_CoUNT) -00.
38
14-9
inter RUPITM·44
14-10
inter RUPITM·44
since the software for both the primary and secondary 2.2 SOLe Basic Repertoire
stations used far less than the 4K bytes provided on the
8744. For the async interface, the standard RS-232 me- The SDLe commands and responses implemented in
chanical and electrical interface was used. For the the data link include the SDLe Basic Repertoire as
SDLe channel, a standard two wire three state RS-422 defined in the IBM SDLe General Information manu-
driver is used. A DIP switch connected to one of the al. Table 3 shows the commands and responses that the
available ports on the 8044 allows the baud rate, parity, primary and the secondary station in this data link de-
and stop bits to be changed on the async interface. The sign recognize and send.
primary station hardware does not use the USART,
8254, nor the RS-232 drivers.
PRIMARY
STATION
296166-6
SECONDARY SECONDARY
STATION STATION
PRIMARY
STATION
SECONDARY SECONDARY
STATION STATION
296166-.7
14-11
RUPITM·44
CD
I
18
~
14·12
intJ RUPITM·44
g'
• •
=
Table 3. Data Link Commands and naI. The SSD is independent of the main application, it
Responses Implemented for This Design just provides the SDLC communications. Existing 8051
applications 'could add high performance SDLC com-
Primary Station munications capability by linking the SSD to the exist-
ing software and providing additional software to be
Responses Commands able to communicate with the SSD.
Recognized S.ent
Unnumbered UA SNAM DATA LINK INTERFACE AND USER
DM DISC INTERFACE STATES
FAMA
*AD The SSD has two Software interfaces: a data link inter-
face and a user interface as shown in Figure 8. The data
Supervisory AA AA link interface is the part of the software which controls
ANA ANA the SDLC communications. It handles link access,
command recognition/response, acknowledgements,
Information I I
and. error recovery. The user interface· provides four
functions: OPEN, CLOSE, TRANSMIT, and SIU_
Secondary Station RECV. These are the only four functions which the
application software has to interface in order to com-
Commands Responses
municate using SDLC. These four functions are com-
Recognized Sent mon to many I/O drivers like floppy and hard disks,
Unnumbered SNAM UA keyboard/CRT, and async communication drivers.
DISC DM
·TEST FAMA The data link and the user interface each have their
own states. Each inierface can only be in one state at
*AD
any time. The SSD uses the states of these two interfac-
"TEST es to help synchronize the application module to the
Supervisory AA AA data link.
ANA ANA
AEJ There are three states which the secondary station data
link interface can be in: Logical Disconnect State
Information I I (L...J)J), Frame Reject State (FRMRJ), and the
"not included in the SOLe Basic Repertoire Information Transfer State (I_T_S). The Logical
Disconnect State is when .a station is physically con-
The term command specifically means all frames which nected to the channel but either the primary or second-
the primary station transmits and the secondary sta.- ary have not agreed to enter the Information Transfer
tions receive. Response refers to frames which the sec- State. Both the primary and the secondary stations syn-
ondary stations transmit and the primary station re- chronize to enter into the InfOl:mation Transfer State ..
ceives. Only when the secondary station is in the I_T_S is it
able to transfer data or information to the primary. The
Frame Reject State (FRMR-S) indicates that the sec-
NUMBER OF OUTSTANDING FRAMES ondary station has lost software synchronization with
the primary or encountered some kind of error condi-
This particular data link design only allows one out- tion. When the secondary station is in the FRMRJ,
standing frame before it must receive an acknowledge- the primary station must reset the secondary to resyn-
ment. Immediate acknowledgement allows the second- cbronize.
ary station drivers to use the AUTO mode. In addition,
one outstanding frame uses less memory for buffering, The user interface has two states, open or closed. In the
and the software becomes easier to manage. closed state, the user program does not want to com-
municate overthe network. The communications chan.'
nel is closed and not available for use. The secondary
2.3 Secondary Station Driver using station tells the prill1ary this by responding to all com-
AUTO Mode mands with DM. The primary continues to poll the
secondary in case it wants to enter the I_T_S state.
The 8044 secondary station driver (SSD) was written as When the user program begins communication over the
it general purpose SDLC driver. It was written to be data link it goes into the open state. It does this by
linked to an application module. The application soft- calling the OPEN procedure. When the user interface is
ware implements the actual application in addition to in the open state it may transfer information to the
interfacing to the SSD. The main application could be, primary.
a printer or plotter, a medical instrument, or a termi-
14-14
inter RUPITM-44
SECONDARY STATION
APPLICATION ··SECONDARY
MODULE STATION
DRIVER
MODULE
DATA
LINK
INTERFACE
SSD
INTERFACE USER DATA LINK
A JI. INTERFACE STATES
1. LOGICAL
r USER STATES DISCONNECT
SSD
t
INTERFACE
1. OPEN
2. CLOSED
STATE
2. INFORMATION
TRANSFER
STATE
PROCEDURES 3. FRAME
REJECT
STATE
OPEN
CLOSE
TRANSMIT ,
SIU RECV
296166-10
14-15
inter RUPITM·44
14-16
intJ RUPITM·44
DISC
UA
~~~ER ____________~
296166-11
14-17
r------------------------------------~----- (
I I SIU_INT
II I II
1
I SIU_RECY I I
I I COMMAND_DECODE ' I I IN_FRMR_STATE I I IN_DISCONNECT_STATE
I
I
I I
I I
I I I
:!!
CI:I
C
I
I I XMIT_ FRMR I I SNRM_RESPONSE I
a; I
....
~
II
....
!
en
CD
g
:::J
i-J::i J
I XMIT_UNNUMBERED
l:I
c:
'0
':i
(XI
! r-------~---------~---------------------~-~
ill:
•
~
i
~
:::J
C
I POWER_ON_DI
::::!.
...~
.--~
!I OPEN I
I' _ . _ . _ . _ . _ . _ •...1
296166-12
inter RUPITM·44
SSD INITIALIZATION reasons for the SIU to automatically leave the AUTO
mode. The following is a list of these reasons, and the
Upon reset the application software is entered first. The responses given by the SSD based on each reason.
application software initializes its own variables then 1. The SIU has received a command field it does not
calls Power_On~ which is the SSD's initialization recognize.
routine. The SSD's initialization sets up the transmit
and receive data buffer pointers (TBS and RES), the Response: If the CPU recognizes the command, it
receive buffer length (RBL), and loads the State vari- generates the appropriate response. If neither the
ables. The STATION_STATE begins in the L_D_S SIU nor the CPU recognize the command, then a
state, and the USER--STATE begins in the closed FRMR response is sent.
state. Finally Power_OIL-D initializes XMIT_ 2. The SIU has received a Sequence Error Sent
BUFFER--EMPTY which is a bit flag. This flag (SES= 1 in NSNR register). Nr(p);6Ns(S)+ I, and
serves as a semaphore between the SSD and the appli- Nr(P);6Ns(S).
cation software to indicate the status of the on chip Response: Send FRMR.
transmit buffer. The SSD does not set' the station ad-
dress. It is the application software's responsibility to 3. A buffer overrun has occurred. BOV = 1 in STS reg-
do this. After initialization, the SSD is read to respond ister. '
to all of the primary station commands. Each time a Response: Send FRMR.
frame is received with a matching station address and a 4. An I frame with data was received while RPB = 1.
good CRC, the SIU_INT procedure is entered.
Response: Go back into AUTO mode and send an
AUTO mode response
SIU_INT PROCEDURE
In addition to the above reasons, there is one condition
The first thing the SIU_INT procedure clears is the where the CPU forces the SIU out of the AUTO mode.
serial interrupt_bit (SI) in the STS register. If the This is discussed in the SSD's User Interface Proce-
SIU_INT procedure returns with this bit set, another dures section in the CLOSED procedure description
SI interrupt will occur.
, Finally, case three is when the STATION_STATE is
The SIU_INT procedure is branches three indepen- in the I_T_S and the AUTO mode. The CPU frrst
dent cases. The first case is entered if the STATION_ looks at the TBF bit. If this bit is 0 then the interrupt
STATE is not in the 1_TJ . If this is true, then the may have been caused by a frame which was transmit-
SIU is not in the AUTO mode, and the CPU will have ted and acknowledged. Therefore the XMIT_BUFF-
to respond to the primary on its own. (Remember that ER--EMPTY flag is set again, indicating that the ap-
the AUTO mode is entered when the STATION_ plication software can transmit another frame.
STATE enters into LTJ.) If the STATION_
STATE is in the I_TJ, then either the SIU has just The other reason this section of code could be entered
left the AUTO mode, or is still in the AUTO mode. is if a valid I frame was received. When a good I frame
This is the second and third case, respectively. is received the RBE bit equals O. This means that the
receiver is disabled. If the primary were to poll the 8044
In the first case, if the STATIONJTATE is not in while'RBE=O, it would time out since no response
the I_T_S, then it must be in either the L~_S or would be given. Time outs reduce network throughput.
the FRMR--S. In either case a separate procedure is To improve network performance, the CPU first sets
called based on which state the station is in. The IlL- RBP, then sets RBE. Now when the primary polls the
Disconnect_State procedure sends to the primary a 8044 an immediate RNR response is given. At this
DM response, unless it received a SNRM command point the SSD calls the application software procedure
and the USER--STATE equals open. In that case the SIU~CV and passes the length of the data as a
SIU sends a UA and enters into the I_T_S. The IlL- parameter. The SIU_RECV procedure reads the data
FRMR--State procedure will send the primary the out of the receive buffer then returns to the SSD mod-
FRMR response unless it received either a DISC or an ule. Now that the receive information has been trans-
SNRM. If the primary's command was a DISC, then ferred, RBP can be cleared.
the secondary will send a UA and enter into the L_
D_S. If the primary's command was a SNRM, then
the secondary will send a UA, enter into the LT_S, COMMAND_DECODE PROCEDURE
and clear NSNR register.
The Command~ecode procedure is called from the
For the second case, if the STATION_STATE is in SIU_INT procedure when the STATION_STATE
the LT_S but the SIU left the AUTO mode, then t\le == I_TJ and the SIU left the AUTO mode as a
CPU must determine why the AUTO mode was exited, result of not being able to recognize the receive control
and generate a response to the primary. There are four byte. Commands which the SIU AUTO mode does not
14-19
inter RUPITM·44
I
THIS STATION'S PRESENT Ns
r ___
, 0
I THIS STATION'S PRESENT Nr
o
~
W X y Z
,
o o o o
,
HIGH·ORDER
recognize are handled here. The commands recognized fteld. Figure 11 displays the format for the three data
in this procedure are: SNRM, DISC, and TEST. Any bytes in the I fteld of a FRMR response. The XMIT_
other command received will generate a Frame Reject FRMR procedure sets up the Frame Reject response
with the nonimplemented command bit set in the third frame based on the parameter' REASON which is
data byte of the FRMR frame. Any additional unnum- passed to it. Each place in the SSD code that calls the
bered frame commands which the secondary station is XMITJRMR procedure, passes the REASON that
going to implement, should be implemented in this pro- this procedure was called, which in tum is communi-
cedure. cated to the primary station. The XMITJRMR pro-
cedure uses three bytes of internal RAM which it ini-
IF an SNRM is received the command_decode proce- tializes for the correct response. The TBS and TBL reg-
dure calls the SNR~L•.Response procedure. The isters are then changed to point to the FRMR buffer so
SNR~esponse procedure sets the STATION_ that when a response is sent these three bytes will be
STATE = LTJ, clears the NSNR register and re- included in the I fteld.
sponds with a UA frame. If a DISC is received, the
comman~decode procedure sets the STATION_ The INJRMR-STATE procedure is called by the
STATE = L~J, and responds with a UA frame. SIU_INT procedure when the STATION_STATE
When a TEST frame is received, and there is no buffer already is in the FRMR state and a response is re-
overrun, the command_decode procedure responds quired. The INJRMR-STATE procedure will only
with a TEST frame retransmitting the same data it re- allow two commands to remove the secondary station
ceived. However if a TEST frame is received and there from the FRMR state: SNRM and DISC. Any other
is a buffer overrun, then a TEST frame will be sent command which is received while in the FRMR state
without any data, instead of a FRMR with the buffer will result in a FRMR response frame.
overrun bit set.
XMIT_UNNUMBERED PROCEDURE
FRAME REJECT PROCEDURES
This is a general purpose transmit procedure, used only
There are two .procedures which handle the FRMR in the FLEXIBLE mode, which sends unnumbered ·re-
state: XMIT~R and IN_FRMR-STATE. sponses to the primary. It accepts the control byte as a
XMITJRMR is entered when the secondary station parameter, and also expects the TBL register to be set
ftrst goes into the FRMR state. The frame reject re- before the procedure is called. This procedure waits un-
sponse frame contains the FRMR response in the com- til the frame has been transmitted beforeretuming. If
mand fteld plus three additional data bytes in the I
14-20
RUPITM-44
this procedure returned before the transmit interrupt application software thinks that the SDLC channel is
was generated, the SIU_INT routine would be en- now open and it can transmit. This is not the case. For
tered. The SIU_INT routine would not be able to dis- the channel to be open, the SSD must receive an
tinguish this condition. SNRM· from the primary and respond' with a UA.
However; the SSD does not want to hang up the appli-
SSD's User Interface Procedures-OPEN, CLOSE, cation software waiting for an SNRM from the primary
TRANSMIT, SIU_RECV-are discussed in the fol- before returning from the OPEN procedure. When the
lowing section. TRANSMIT procedure is called, the SSD expects the
STATION_STATE to be in the I_T_S. If it isn't,
The OPEN procedure is the simplest of all, it changes the SSD refuses to transmit the data. The TRANSMIT
the USE~STATE to OPEN_S then returns. This procedure first checks to see if the USE~STATE is
lets the SSD know that the user wants to open the open. If not, the USE~STATE_CLOSED parame-
channel for communications. When the SSD receives a ter is passed back to the application module. The next
SNRM command, it checks the USE~STATE. If the thing TRANSMIT checks is the STATION_STATE.
USE~STATE is open, then the SSD will respond If this is not open, then TRANSMIT passes back
with a UA, and the STATION_STATE enters the LINILJ)ISCONNECTED. This means that the
I_T_S. USE~STATE is open, but the SSD hasn't received
an SNRM command from the primary yet. Therefore,
The CLOSE procedure is also simple, it changes the the application software should wait awhile and try
USE~STATE to CLOSED_S and sets the AM bit again. Based on network performance, one knows the
to O. Note that when the CPU sets the AM bit to 0 it maximum amount of time it will take for a station to be
puts the SIU out of the AUTO mode. This event is polled. If the application software waits this length of
asynchronous to the events on the network. As a result time and tries again but still gets a LINILJ)ISCON-
an I frame can be lost. This is what can happen. NECTED parameter passed back, higher level recovery
1. AM is set to 0 by the CLOSE Procedure. must be implemented..
2. An I frame is received and an SI interrupt occurs. Before loading the transmit butTer and calling the
3. The SIU_INT procedure enters case 2 (STA- TRANSMIT procedure, the application software must
TION_STATE = I_T_S, and AM = 0). check to see that XMIT_BUFFE~EMPTY = 1.
4. Case ~ detects that the USE~STATE = This flag tells the application software that it can write
CLOSED_S, sends an RD response anl.i ignores the new data into the transmit buffer and call the TRANS-
fact that an I frame was received. MIT procedure. After the application software has ver-
ified that XMIT.-BUFFE~EMPTY = I, it fills the
Therefore it is advised to never call the CLOSE proce- transmit buffer with the data and calls the TRANS-
dure or take the SIU out of the AUTO mode when it is MIT procedure passing the length of the buffer as a
receiving I frames or an I frame will be lost. parameter. The TRANSMIT procedure checks for
three reasons why it might not be able to transmit the
For both the TRANSMIT and SIU_RECV proce- frame. If any of these three reasons are true, the
dures, it is the application software's job' to put data TRANSMIT procedure returns a parameter explaining
into the transmit buffer, and take data out of the re- why it couldn't send the frame. If the application soft-
ceive buffet. The SSD does not transfer data in or out ware receives one of these responses, it must rectify the
of its transmit or receive buffers because it does not problem and try again. Assuming these three condi-
know what kind of buffering the application software is tions are false, then the SSD clears XMIT_BUFF-
E~EMPTY, attempts to send the data and returns
implementing. What the SSD does do is notify the ap-
plication software when the transmit buffer is empty, the parameter DAT~TRANSMITTED. XMIT_
BUFFE~EMPTY will not be set to I again until the
XMIT_BUFFE~MPTY = I, and when the re-
ceive buffer is full. data has been transmitted and acknowledged.
One of the functions that the SSD performs to synchro- The SIU.-R,ECV procedure must be incorporated into
nize the application software to the SDLC data link. the application software module. When a valid I frame
However some of the synchronization must also be is received by the SIU, it calls the SIU_RECV proce-
done by the application software. Remember that the dure and passes the length of the received data as a
SSD does not want to hang up the application software parameter. The SIU.-R,ECV procedure must remove
waiting for some event to occur on the SDLC data link, all of the data from the receive butTer before returning
therefore the SSD always returns to· the application to the SIU_INT procedure.
software as soon as possible.
14-21
inter RUPITM-44
LINKING UP TO THE SSD The SSD module uses the $REGISTERBANK(I) attri-
bute. Some procedures are modified with the USING
Figure 12 shows the necessary parts to include in a attribute based on the register bank Itwei of the calling
PL/M-51 application program that will be linked to the procedure. '
SSD module. RL51 is used to link and locate the SSD
and application modules. The command line used to do
this is: 2.4 Application Module; ASYNC to
SOLC Protocol Converter
RL51 SSD.obj ,filename.obj ,PLM51.LIB TO ,,' One of the purposes of this application module is to
filename & RAMSIZE(192) demonstrate how to interface software to the SSD. An-
other purpose is to implement and test a practical appli-
$registerbank(O) cation. This application software performs I/O with an
user$mod': do; async terminal through a USART, buffers data, and
$include (reg44.dcl) also performs I/O with the SSD. In addition, it allows
decl'are the user on the async terminal to: set the station ad-
lit literally 'literally', dress, set the dc:stination address, and go online lind
buffer_length lit '60', omine. Setting the station address sets the byte in the
SiU_lODit_buffer STAD register. The destination address is the first byte
(buffer_length) byte external idata, in the I field. Going online or otlline results in either
siu_recv_buffer calling the OPEN or CLOSE procedure respectively.
(buffer_length) byte external,
xmit_buffer_emptybit external; After the secondary station powers up, it enters the
'terminal mode', which accepts data from the terminal.
I' external procedures 'I, However, before any data is sent, the user must con-
figure the station. The station address and destination
power _on_d: procedure external,; address must be set, and the station must be placed
end power_on_d; oli1ine. To configure the station the ESC character is
entered at the terminal which puts the protocol con-
close: procedure external using 1; verter into the 'configure mode'. Figure 13 shows the
end close; menu which appears on the terminal screen.
The 8044 has four register banks. PL/M-51 assumes The secondary station also does error checking on the
that an interrupt procedure never uses the same bank as async interface for Parity, Framing Error, and Overrun
the procedure it interrupts. The USING attribute of a Error. If one of these errors are detected, an error mes-
procedure, or the $REGISTERBANK control, can be sage is displayed on the terminal screen.
used to ensure that.
14-22
inter RUPITM·44
...
MULTIDROP 1
!8
SOLe DATALINK u;
WN '"
'"
a:N
i:b
Na:
......a:W ......Wa:
~ ~
III III
W ...
, ,
in !i
III
Iil z
a: ~
....
::IE
C
a:
... oW
III III ....
...g CD~ ~I!!
>- ~~a:
III
...i!:W
~
Iila:
A .'" i
III
~
a:
N ::IE
C
a:
....
c
--z
a:
fZ
ii: ...6
Ii:
...W
)(
W
u w",
z a: ...
>-
III i;J;
C ... a:
1-....
- \
rO'i
~
ui!:
Z::IE
>-a:
!Ill!! ~~
'iP~
W
Figure 14. Block Diagram of Secondary Station Protocol Converter illustrating Buffering
14-23
RUPITM.·44
14-24
r-------~-----------------------I
I
I
MAIN_PROGRAM
II I . I
I (
~----------~I--------~ I I
I
FIFO_T_OUT I
I
I
I I
I I
I
:!!
I
ID I
...
C
III I
.... I
~ I
FIFO_T..JN
m I
0'
n
;I\"
:JJ
.....
C
iii" c:
"U
~
N ...
ID
DI ~
en 3 I
...
0
C
"'"'""
In
...
III
en
-...
0
~.
...
III·
I
I
I IUSART_XMIT_INT I TIMER_O_INT
I I
I
I
IL ______________________________________________ ~
296166-15
intJ RUPITM·44
pointed to by OUT~~T is read, then OUT_ stations and receives responses from them. The primary
PT~T is incremented; Since IN_PT~T and station controls link access, link level error recovery,
OVTJT~T are always incremented, they must be and the flow of information. Secondaries can only
able to roll over when they hit the top of the '256 byte transmit when polled by the primary.
address space. This is done automatically by having
both INJT~T and OUTJT~T declared as Most primary stations are either micro/minicomputers,
bytes. Each character inserted into the transmit FIFO or front end processors to a mainframe computer. The
is tested to see if it's a LF. If it is a LF, the variable example primary station in this design is standalone. It
SEND~ATA is incremented, which lets the main is possible for the 8044 to be used as an intelligent front
program know that it is time to send an I frame. Simi- end processor for a microprocessor, implementing the
larly each character removed from the FIFO is tested. primary station functions. This latter type of design
SEND_DATA is decremented for every LF character would extensively off-load link control functions for the
removed from the FIFO. microprocessor. The code listed in this paper can be
used as the basis for this primary station design. Addi-
INJT~T and OUT_PT~T are also used to in- tional software is required to interface to the micro-
dicate how many bytes are in the FIFO, and whether it processor. A hardware design example for interfacing
is full or empty. When a character is placed into the the 8044 to a microprocessor can be found in the appli-
FIFO and INJT~T is incremented, the FIFO is cations section of this handbook.
full if INJ~T equals OUTJT~T. When a
character is read from the FIFO and OUTJT~T The primary station must know the addresses of all the
is incremented, the FIFO is empty if OUT_PT~T stations which will be on the network. The software for
equals INJT~T. If the FIFO is neither full nor this primary needs to know this before it is compiled,
empty, then it is in use. A byte called BUFFE~ however a more flexible system would download these
STATUS_T is used to indicate one ofthese three con- parameters. '
ditions. The application module uses the buffer status
information to control the flow of data into and out of From the listing of the software it can be seen that the
the FIFO. When the transmit FIFO is empty, the main variable NUMBE~OF,,-STATIONS is a literal dec-
program must stop loading bytes into the SIU_ laration, which is 2 in this design example. There were
XMITJUFFER. Just before the FIFO is full, the three stations tested on this data link, two secondaries
async input must be shut off using CTS. Also, if the and one primary. Following the NUMBE~OF_
FIFO is full and SEND~ATA = 0, then SEND_ STATIONS declaration is a table, loaded into the ob-
DATA must be incremented to automatically send the ject code file at compile time, which lists the addresses
data without an LF. of each secondary station on the network.
The receive FIFO operates in a fashion similar to the The primary station keeps a record of each secondary
transmit FIFO. Data is inserted into the receive FIFO station on the network. This is called the Remote Sta-
from the SIUJECV procedure. The SIU_RECV tion Database (RSD). The RSD in this software is an
procedure is called by the SIUJNT procedure when a array of structures, which can be found in the listing
valid I frame is received. The SIU_RECV procedure and also in Figure 16. Each RSD stores the necessary
merely polls the receive FIFO status to see if it's full information about that secondary station.
before transferring each byte from the SIUJECV_
BUFFER into the receive FIFO. If the receive FIFO is To add additional secondary stations to the network,
full, the SIU_RECV procedure remains polling the one simply adjusts the NUMBE~OF_STATIONS
FIFO status until it can insert the rest of the data. In declaration, and adds the additional addresses to th~
the meantime, the SIU AUTO mode is responding to SECONDARY~DDRESSES table. The number of
all polls from the primary with a RNR supervisory RSDs is automatically allocated at compile time, and
frame. The USART~MIT_INT interrupt proce- the primary automatically polls each station whose ad-
dure removes data from the receive FIFO and trans- dress is in the SECONDARY~DDRESSES table.
mits it to the terminal. The USART transmit interrupt
remains enabled while the receive FIFO has data in it. Memory for the RSDs reSides in external RAM. Based
When the receive FIFO becomes empty, the USART on memory requirements for each RSD, the maximum
transmit interrupt is disabled. number of stations can be easily buffered in external
RAM. (254 secondary stations is the maximum number
SDLC will address on the data link; i.e. 8-bit address,
2.5 Primary Station FF H is the broadcast address, and 0 is the null ad-
dress. Each RSD uses 70 bytes of RAM. 70 x 254 =
The primary station is responsible for controlling the 17,780.)
data link.' It issues commands to the secondary
14-26
RUPITM·44
The station state, in the RSD structure, maintains the PRIMARY STATION SOFTWARE
status of the secondary. If this byte indicates that the
secondary is in the DISCONNECT_S, then the pri- A block diagram of the primary station software is
mary tries to put the station in the I_T_S by sending shown in Figure 17. The primary station software con-
an SNRM. If the response is a UA then the station sists of a main program, one interrupt routine, and sev-
state changes into the I_T_S. Any other frame re- eral procedures. The POWER-ON procedure begins
ceived results in the station state remaining in the DIS- by initializing the SIU's DMA and enabling the receiv-
CONNECT_S. When the RSD indicates that the sta- er. Then each RSD is initialized. The DPLL and the
tion state is in the LT_S, the primary will send either
an I, RR, or RNR command, depending on the local
°
timers are set, and finally the TIMER interrupt is
enabled.
and remote butTer status. When the station state equals
GO_TO_DISC the primary will send a DISC com- The main program consists of an iterative do loop with-
mand. If the response is a UA frame, the station state in a do. forever loop. The iterative do loop polls each
will change to DISCONNECT_S, else the station secondary station once through the do loop. The vari-
state will remain in GO_TO_DISC. The station state able STATION_NUMBER is the counter for the iter-
is set to GO_TO_DISC when one of the following ative do statement which is also used as an index to the .
responses occur: array of RSD structures. The primary station issues one
I. A receive butTer overrun in the primary. command and receives one response from every second-
ary station each time through the loop. The first state-
2. An I frame is received and Nr(P) =P Ns(S). ment in the loop loads the secondary station address,
3. An I frame or a Supervisory frame is received and indexed by STATION_NUMBER into the array of
Ns(P) + 1 =P Nr(S) and Ns(P) =P Nr(S). the RSD structures. Now when the primary sends a
4. A FRMR response is received. command, it will have the secondary's address in the
address field of the frame. The automatic address rec-
5. An RD response is received. ognition feature is used by the primary to recognize the
6. An unknown response is received. response from the secondary.
The send count (Ns) and receive count (Nr) are also Next, the main program determines the secondary sta-
maintained in the RSD. Each time an I frame is sent by tion's state. Based on this state, the primary knows
the primary and acknowledged by the secondary, Ns is what command to send. If the station is in the DIS-
incremented. Nr is incremented each time a valid I CONNECT_S, the primary calls the SNRM_P pro-
frame is received. BUFFER-STATUS indicates the cedure to try and put the secondary in the LT_S. If
status of the secondary station's butTer. If an RR re- the station state is in the GO_TO_DISC state, the
sponse is received, BUFFER-STATUS is set to DISCJ is called to try and put the secondary in the
BUFFER-READY. If a RNR response is received, L.-D_S. If the secondary is in neither one of the
BUFFER-STATUS is set to BUFFER-NOT_ above two states, then it is in the I_T_S. When the
READY. secondary is in the 1_T_S, the primary could send
one of three commands: I, RR, or RNR. If the RSD's
butTer has data in it, indicated by INFO_LENGTH
BUFFERING being greater than zero, and the secondary's BUFF-
The butTering for the primary station is as follows: ER-STATUS equals BUFFER-READY, then an I
within each RSD is a 64 byte array butTer which is frame will be sent. Else if RPB = 0, an RR supervisory
initially empty. When the primary receives an I frame, frame will be sent. If neither one of these cases is true..
it looks for a match between the first byte of the I frame then an RNR will be sent. The last statement in the
and the addresses of the secondaries on the network. If main program checks the RPB bit. If set to one, the
a match exists, the primary places the data in the RSD BUFFER-TRANSFER procedure is called, which
butTer of the destination station. The INFO_ transfers the data from the SIU receive butTer to the
LENGTH in the RSD indicates how many bytes are in appropriate RSD butTer.
the butTer. If INFOJENGTH equals 0, then the
butTer is empty. The primary can butTer only one I
frame per station. If a second I frame is received while
the addressed secondary's RSD butTer is full, the pri-
mary cannot receive any more I frames. At this point
the primary continues to poll the secondaries using
RNR supervisory frame. .
14-27
intJ RUPITM_44
14-28
inter RUPITM·44
MAIN PROGRAM
BUFFER TRANSFER
296166-16
If a supervisory frame is received, the Nr field is state is set to GO_TO~ISC. However, if the frame
checked. If a FALSE is returned, then the station state received is a FRMR, Nr in the second data byte of the I
is set to GO_TO_DISC. If the supervisory frame re- field is checked to see if the secondary acknowledged an
ceived was an RNR, buffer status is set to not ready. If I frame received before it went into the FRMR state. If
the response is not an I frame, nor a supervisory frame, this is not done and the secondary acknowledged an I
then it must be an Unnumbered franie: frame which the primary did not recognize, the pri-
mary transmits the I frame when the secondary returns
The only Unnumbered frames the primary recognizes to the I_T_S. In this case, the secondary would re-
are UA, DM, and FRMR. In any event, the ,station ceive duplicate I frames.
14-29
inter RUPITM·44
APPENDIX A
8044 SOFTWARE FLOWCHARTS
POWER-ON-D PROCEDURE
USER-STATE = CLOSED-S
STATION-STATION = DISCONNECT-S
XMIT-BUFFER-EMPTY =1
RE.TURN
296166-17
CLOSE PROCEDURE
AM=O
RETURN
OPEN PROCEDURE
RETURN
296166-18
14-30
infef RUPITM-44
XMIT-UNNUMBERED PROCEDURE
296166-19
TRANSMIT PROCEDURE
STATUS = USER·STATE·ClOSE
STATUS =
LINK_DISCONNECTED
STATUS =
?VERFlOW
XMIT·BUFFER·EMPTY =0
TBl = XMIT·BUFFER·lENGTH
I·FRAME·lENGTH = XMIT.BUFFER.lENGTH
296166-20
14-31
intJ RUPITM~44
XMIT-FRMR PROCEDURE
STATION·STATE = FRMR·S·
SEND FRMR
FRAME
296166-21
14-32
intJ RUPITM·44
IN·DISCONNECT·STATE PROCEDURE
296166-22
SNRM·RESPONSE PROCEDURE
296166-23
IN·FRMR·STATE PROCEDURE
296166-24
14·34
inter RUPITM·44
296166-25
14-35
. SIII-INT PROCEDURE l
6c
I ~ y
y
iiJ
,.
N
y
~ I CALL COIIMAND-DECODE 11--------,
Ie
n XMIT·BUFFER·EMPTY
0 =1
:=I
a. CALL XMIT·UNNUMBERED 1 1
DI (REQ.DISC) • :II
.... .c!. N
c:
."
Sfl
t
<»
-
DI
is"
:=I
y
CALL XIIIT-FRMR
~
..•
...C
...<"
CD
•~
0
:r
DI CALL COMMAND DECODE
::I.
296166-26
RUPITM·44
MAIN PROGRAM
LOAD DESTINATION
ADDRESS IN FIRST
BYTE OF SIU-XMIT
BUFFER
LOAD INFORMATION
INTO SIU XMIT-BUFFER
SIU BUFFER LENGTH
OR FIFO-T EMPTY
OUTPUT MESSAGE
TO TERMINAL
'UNABLE TO GET ON LINE'
296166-27
14-37
inter RUPITM·44
296166-28
14·38
intJ RUPITM-44
MENU PROCEDURE
OUTPUT MENU
TO TERMINAL
CALL OUTPUT·MESSAGE
'ENTER THE STATION ADDRESS:_'
CALL GET·HEX
SHIFT TO LEFT BY FOUR
LOAD ADDRESS
INTO STAD
CALL OUTPUT·MESSAGE
'THE. NEW STATION ADDRESS:_'
CALL OUTPUT·MESSAGE
'ENTER THE DESTINATION ADDRESS:_'
CALL GET·HEX
SHIFT TO LEFT BY FOUR
LOAD ADDRESS
INTO DESTINATION·ADDRESS
CALL OUT·MESSAGE
'THE NEW DESTINATION ADDRESS IS:_'
RETURN
296166-29
14-39
RUPITM·44
ERROR PROCEDURE
296166-30
14-40
RUPITM-44
FIFO·T-OUT PROCEDURE
296166-31
14·41
RUPITM·44
FIFo-T·IN PROCEDURE
RETURN
296166-32
14-42
RUPITM·44
SIU·RECV PROCEDURE
296166-33
POWER ON
I
FOR EACH STATION
INITIALIZE RSD RECORDS
1. STATlON·ADDRESS
3. BUFFER·STATE == =
2•.STATIQN·STATE DISCONNECT
BUFFER·NOT·READY
4. INFO-LENGTH 0
I
I RETURN I 296166-34
14·43
inter RUPITM_44
Y
CALL SEND-SNRM
Y
CALL SEND-DISC
CALL XMIT I T S Y
(T-I-FRAME) - I---------.,.-C
CALL XMIT-I-T-S Y
(T-RR)
v
CALL BUFFER-TRANSFER
296166-35
14-44
RUPITM·44
SEND·SNRM PROCEDURE
296166-36
SEND-DISC PROCEDURE
STATION·STATE =
DISCONNECT·S
BUFFER·STATUS =
BUFFER-NOT·READY
296166-37
14·45
inter RUPITM·44
XMIT·ToS PROCEDURE
BUILD CONTROL
FIELD USING EITHER
I, RR, RNR
AND NR AND/OR NS
y
CALL RECEIVE
296166-38
XMIT PROCEDURE
296166-39
14-46
RUPITM·44
BUFFER·TRANSFER PROCEDURE
296166-40
14·47
intJ RUPITM_44
CHECK-NRPROCEDURE
RETURN
TRUE
296166-41
CHECK-NsPROCEDURE
296166':'42
14·48
l
REMOTE BUFFER-sTATUS = BUFFER-READY
.,..
ac
a;
Co»
PI
~
:u
~j c:
'U
J..
<0
se
III
g
RECEIVE-FIELD-LENGTH
• RFL -\ .
':j
~
~
i:
i9
.,
~.
III STATION-STATE
= Go.TO-OISC
296166-43
RUPITM·44
APPENDIX B
LISTINGS OF SOFTWARE MODULES
/. To ••V~ p.p.,.
the RUP] ,. •• ht.,. • • r. nat U.t.d, but tbis is the .t.t.... n'
u ••• to inc Iud. the.: .INCLUDE' (:F2: RE044. DCL) . /
5 DECLARE LIT LITERALLV 'LITERALLV',
TRUI! LIT 'OFFH'.
FALSE LIT 'OOH',
FDREVER LIT 'WHILE 1"
LIT
LIT
LIT
'OIH', , . FRNE RE..IECT STATE
'02H'.
*' . *',
'OOH', , . LOCnCALLY DISCa...e:CTED STATE*'
296166-44
14-50
RUPITM-44
/. Ft. • • • /
la 2 USER.:,.sTATE-CL.OSED_S,
.9 2 BTItTIDN,JITItTE-DISCONNECT _BI
20 2 TI&-. SIUJlHITJlUFFEA(O),
21 2 AI&-. SIUJlECYJlUFFER(Oh
22 2 RIL-IUFFERJ.ENQTH,
23 2 ABE-I, /. En.bl. thl 8IU'. ,..edv.,. .,
24 2 X"ITJlUFFERJUPTY-l.
296166-45
14-51
inter RUPITM·44
35 3
36 3
37 3
38 3 TIF-S.
39 3 STATUllaMTA_TRANMITTEDI
40 3 END.
41 2 RETURN STATUS.
42 I 'END TR_IT.
51 END Xf1IT_UIIN.ItIEREDI
52 2 ~"~E.~: PROCE~E •
53 2 STATIONJTATE-I_T_BI
54 2 NsNR-O,
55 2 IF (RCI AND SOH) 0 0 , . R•• pond i' polhd . ,
THEN DO,
57 3 TlL-O,
H 3 CALL X"lT_UNNUI1IIEREDCUA),
59 3' ENDI
60 2 IF X"ITJI\FF'ER~TV-o
THEN DO,
,. If .n I frM • .,.. 1."
th.n r •• tor. U: *' p.ndj~. '".ndt •• tan
62 3 rlL.-IJRNEJ..ENQTH,
63 3 TlF-1,
64 3 ENDI
65 2
66
69 2 TC • .p'R""h
70 2 TBg., FR~JlUFFER(OIo
71 2 T8L-3.
72 :I FR~JlUFFER (Ol-RCBI
/ ....., nnu •• In NaIR . /
73 :I FRI'tR __ t.PFERU)-CSHLtcNBNR MD 0EH),41 OR He (NSNR AND OEOH)"4»,
74
75
3
3
DO CASE REA. . .,
FR"J:UFFER(2)-oIH, /. UNASBIONED_C *'
296166-46
14-52
inter RUPITM_44
*,- *'
76 3 FRI1RJUFFER C:2 J -02HI
77
78
3
3
FRtIR ..... UFFER (2) -o4H,
FRIIRJlUFFER cal-OSH.
'* BES~RR
1* ND_IJIELD.j&LLDWED
I-
lUFF OVERRUN
*1
79 3 END.
80 a STATIONJJTATE-FRf1RJJ'
a
99
*,
INjRKR_STATE: PROCEDURE I /* e.l hd b, SIU_INT .hen ,. , ...... " •• bun ,..cdv.d
..hen in th FR. . . t.t.
100 a IF CRCB AND OEFH)-SNAtt
TI£N DO,
loa 3
103
104
3
3 END.
CALL BNR"....RESPONSEI
Ta&-. BIU~"ITJlUFFER(OJJ 1* R•• ta .... ''riln •• U bu"." _,_"" .dd" ••• *'
lOS a ELSE IF (RCB AND OEFHJ-DISC
nEN DOl
107 3
109
109
3
3
STATIDNJJTATE-DISCDNNECT_SJ
TlS-. SIU~"ITJUFFERCO)1
IF CRCa AND IOH)<> 0
'* R•• tar. t".n •• U: bu,h" .t."t .dd" . . . .,
TtEN DOl
III 4 TaL-OI
lIa 4 CALL X"IT_UNNUI"I8EREDCUA)J
113 4 END.
114 3 END.
liS 3 ELSE DOl I . R.ceive cont:rol but. is sa •• thing oth." than D]SC a" SNR" . ,
116 3 IF CRCa AND 10tn 0 0
llEN DOl
118 4 TIF-.,
119 4 RT8-S,
296166-47
14-53
intJ RUPITM·44
••
I~O DO WHILE NOT BI,
I~I END,
I~ 4 END,
1~3 3 END,
••
143 TBL-eJ,
144 CALL XI'IIT_UNNU...EREDCTEST OR 1OH),
'END,
141
146
147
I
I
I
ELSE DO, '*
I f no BOY.
TIL....FL'
und received 1 flteld ... ck to pri ••,., *'
14B
•• TBS-R.S,
14. CALL. K"IT _UNNUPIIEREDCTEBT DR 10M) I
*'
••
ISO nB-.8IU_X"ITJlUFFERCOh /. R•• tD,.. TBS
1.1
I'~ 4
'* I'
END,
an I fir •••
IF Kf1IT JlUFFER..EftWITV-O
III., p.ndin,. ..t it II, _,.in .,
THEN DO,
1.4
I •• •
I-
TBL-IjRNE.-LENOTHI
TBF-l, .
1.6
117 •4 END,
I.B 3
II. 3
160 ~- ELSE IF CRCB AND OIH) • 0 /. Kich' out o. the AUTO .ode beceu ••
an 1 'ra...... received whUe RPB • 1 ./
llEN DOl
I~ 3 Apt. II
163 3 IF X"IT JlUFFER..EIPTV • I
16. 3
THEN TIL. O.
TBF • I. '* Send an AUTO .ad. 1" • • pon •• */
296166-48
14-54
RUPITM-44
,....
167
3
3 END,
RTS - 11
168 2 ELSE CALL X"ITJRf'lRC!JNASBJONED_C), , . Rec.ived an undwf1n.d Dr nat tllpl ••• nte. co_and *'
169 END CDfl'tANDJ)ECODE.
,,,
THEN DO,
177 DO CASE STATIDNJlTATE.
I.
178 CALL IN...DISCONNECT ....sTATE.
179
180
181
,
4
END.
CALL INJRIIIJlTATE.
R8E-l,
4 END.
183 3 RETURN,
184 3 END.
/ . %f tt.. P"ol" ....... cb . . 'hie ,oint. STATIONJITATE-I_T...S
which •••na th BtU .Uhe........ 01' still h in the AUTO I1DDE *'
18' 2 IF A....o
THEN DO.
187 3 IF (RCB AND OEFH)-UIBC
THEN CALL COfI'IANDJ)ECODE.
189 3 ELSE IF USER....sTATE-CLOSED_S
Tt-EN DO,
191 4 T8L-D •
. 192 4 CALL XMIT_UM«JMIEREDCREGJ)ISC),
193 4 END.
194 3 ELSE IF BEB-I
TIEN CALL X"IT JRIIA(BES..ERRl.
196 3 ELSE IF BOY-I
THEN DO.,. DON1T SEND FA . . IF A TEST WAS RECEIYED4t1
198 4 IF CRCB AND OEFH)-TEST
THEN CALL C~...DECaDE.
aoo 4 a.BE CALL XMITJRrtR (BUFF_OVERRUN) I
201 4 END.
202 3 ELSE CALL CDf'l'fANDJ)ECQOE,
203 3 RIE-I,
204 3 END;
20'
206
3
3
ELSE DO, '* PIJ8T STILL. IE IN AUTO t100E . ,
IF TBF-o
THEN X.. ITJlUFFERj:MPTV-I, , . TRANSI'IITTEO It FRNE . ,
208 3 IF RBE-o
THEN DC,
296166-49
217
_NlNOS:
4 IS TIE HIGHEST USED INTERRUPT
296166-50
14-55
intJ RUPITM-44
.8
CR
IEL
LIT
LIT
LIT
'DOH',
'OSH',
'07H',
EN'TY LIT 'DOH',
INUBE LIT "OtH'.
PULL LIT '02.4'.
UBER_STATE_CLOBEO LIT '00II',
LINKJ)ISCONECTED LIT 'OSH',
IlllERFLOW LIT '02.4'.
DATA_TR_ITTED LIT '03H',
/ . BUFFERS . /
296166-51
14-56
inter RUPITM·44
PL/tt-!U COI1PJLER Application t1odul.: ",..,nc/SDLt Protocol canve,.,!". IS: '0:'3 09/19/83 PAQE 2
OYERJtUNC.) BYTE CONSTANTCLF, CR. 'Ov.r ... un Error Dehc'hd I, LF. CR. 0)'
LINKe_» BYTE CONBTANTCLF.CR. 'Unable to Oet Onlin.'.LF.CR.OOH),
DE8Tj.DDRC*) BYTE CONSTANTCCR. LF. LF.·
'Ent.,-· the de.tination addre •• : _', as. 88. 0).
, . Fla •• and BU • •,
IMI TJlUFFER..EMPTY BIT EXTERNAL. I. S.m.phD,... ¥a,.. RUPl: SIOU TT'.n.lllit BuffeT' *1
STOP JIlT BIT AT(141) REO, 1* T.,...dn.I p.r ••• t." • •
1
ECHO BIT ATCOB4H) REO.
WAIT SIT. ,. n •• Dut fila. *1
ERRDRJ~Ao BIT. I . Erl'Dr III •••••• Fl •• *1
296166-52
14-57
intJ RUPITM·44
24
25
2
2
TIPER-.CDNTRDL-37H,
TltER_o-o4H.
'* InUSaUI. USART~ • • ., . . . . clod, 8254 *'
~~=:=~.77H1
26
27
2
2 '* IniU.UI. TIC. RIC *'
,. Defl.nUion '0," di, ... nch Ued to PI.O to PI. it
I" Ra'. 3 2
300 on on
1200
2400
on
on
on
0" 0"on
4800
9600
on
0" 0"
on 0"on
19200 0" on 0"
stop Ut 4
1 on
2 0"
,.,.tt . 6
0"0" on
on
on
0"
0"
even 0"
0"
D.
0"
296166-53
14-58
RUPITM·44
PL/1I-51 CIIIPILEA "'pplie.tion P1oduh: "' ... nc/SDLe PTotocal conv."hT 18: '0: 53 09119/83 PAGE 4
Echo 7
on
0"
on
0" .,
28 TEI'P-Pl AND 07H. /. ft •• , the dip ... itch to ... tn.in. the bit r.h ./
a1'
31
""
3
IF TEI'I'>5
Tt£N TEI1P-o.
DO CASE TEI'IP I
, . 300 . /
32 4 00.
33 4 TlttER_S-a3H.
34 4 TIttER S-2OH,"
35 4 END. -
a., 4
37 4 TlI'IER_1-20H1
38 4 TIPIER_l-o'H.
39 4 END.
40
41
4
4
'* 2400./ DO.
TIPIER_I-bOH.
4" 4 lUtER_I-OaHI
43 4 END.
44 4 /. 4800./ DO.
45 4 TII'IER_l-:1OH.
46 4 TlI'1ER_l-olH.
47 4 END.
48 4 /. 9600./ DO.
...
49"
51
4
4
4 END.
TI"ER_l-o'HI
TII'IER_l-o.
52
53
4
4
/. 19200 *' DO.
TlttER_1-33H1
54 4 TIPIER_I-O.
55 4 END.
56 END.
57
118
USMT-.8TATUS-O,
USMT_BTATUB-O,
./. So,t.,.,.. pOIIIII.,.-on r . . . t fot' B25.1'" *'
59 USNIT_STATUS-O,
60 UIIMT_STATUB-4OH.
61 TEJIP~HI /. D.tel".ln. the per it, end. of stop bU • • /
62 TE".-TEIF OR (P, AND 3OHl,
63 IF STOP..In-I
THEN ~.TaP OR oea.."
65 ELSE TEtP-TEPIP OR 40H.
66
67
UBART..BTATUS-'EPIP, '*
USART "0111. Wa'r"cI *'
USMTJlTATUS. USART_CI'ID-27H'/ttUSMT Co . . . nd Ward RlB. RIE. DTA. l.EN-le,
68 STIID_FH.
296166-54
14-59
inter RUPITM-44
72 2 CAU.. PDWER_tw_DI
73 2
'*
/* UBM,'. RIR." ,. the h1Ih •• ' P1'iD"U" *' *'
80th •• ,.,.n.l intel'f'upts .,.. I.Yel ''''1 •• '' ••
74 2' /. En.U. USMT RaR.,. SI . • nd '1me" 0 inh~"up·h./
75 2 ERRDRj'LAO-O.
76 END POWER_ONJ
al 2 IF 8UFFER_BTATUS_R-EKPTV
THEN DO.
a3 3 EAoO.
84 3
as
86
3
3
EXt-I,
EA-l,
'*
BUFFERJlTATUS..A-INUSE,
Enilbh USART'. TID int.,.,.upt *'
a7 3 END.
aa 2 ELSE IF CCIUFFER..BTATUSJl-INUSEI AND ClNJ'TRJI-OUTJ'TRJlI I
THEN BUFFER_BTATUSJloFULL.
90 END FIFOJl_IN.
91 2 FIFO-"_OUT: PROCEDURE BYTE USINO ••
92 2 DECLARE CHAR ... aYTE AUXILIARY,
93 2 CHARoFIFOJlCOUTJ'TRJlI.
94 '2 DUTJTR...R-OUTJTRJt+II
9S 2 IF' OUTJ'TRJI-INJ'TRJI
THEN DO,
97
98
3
3
EX1-oJ , . Shut off rwD :l.nt.,.,.upt
IUFFER_BTATUBJ'-Et1PTY'
*'
9' 3 END, L
296166-55
14-60
inter RUPITM_44
.05 DECLARE
" PESSAQE BASED ERR_PEBSAOEJ'TR ( 1 J BYTE CONSTANT'
IF ERROR.,FLAO
'0'
.oa
"3 THEN DO,
IF t1EBSAQECERRJlESSAQE_INDEXJ<>O , . Thn continu. to . . nd the . . . . . . . _,
THEN DO,
llO 4 USARTJ)ATA. ftESSADECEARJ£SSADE_INDEXJ,
4
"'
ll2 4
ERR..,.MESSAQE_INDEX-EAR.)IEBSAOE_INDEX+I.
END,
ll3
ll4
4
4
ELSE DO, '*
I f •••••, . h dan. ,. ••• t ERRORJLAO .nd .hut aff int.,.rupt "
ERADAJLAQ-OI
FIFO,s ...ptU *'
ll5 4 IF BUFFER_STATUSJI • EMPTY
THEN Ext-O,
ll7 4 ENOl
ua 3 END.
U9 2 ELSE UBARTJJATAraFIFO-"_OUT.
.".
.22
"
2
SIUJlECY: PROCEDURE (LENGTH) PUBLIC USING I,
DECLME LENGTH
I
BYTE.
BYTE AUXILIARY,
.23
.24
.25
3
4
4
DO 1-0 TO LENOTH-l,
DO WHILE BUFFER_SrArUSJlaFULL, , . Ch.d to . . . i f fUa h
END.
hll *'
126 3 CALL FIFD..JI_'NCSIU..JIECYJlUFFERU l l.
127 3 END.
129 END SIU..JIECY.
143 3
THEN SENDJ)ATA-:L,,*U ttl. buff.,. is full .nd na LF
END.
h•• b •• n ,..c.iv.d then •• nd d.t. *'
144 1
296166-56
14-61
intJ RUPITM_44
PL/.... I,. CDI'IP ILEA AppHe.tio" f1Dduh: .... unc/sDLe P'r'otocol cony_,.t.,. 18: :10: 53 09/19/83 PADE 7
147 2 CHM-FIFO_T([JUTJTR_T1 J
148
149
2
2
DUTJlTR_T-ouTJTR_T+11
IF ~T:Oi.INJTR_T '* Then FI~_T is ••pt'it *'
1S1 3 E"-O,
1'2 3 IUFFER_STATUB_T-EMPTY,
153 3 SEHD.J)ItTA-O.
1'4 3 E~ll
ISS 3 END.
1'6 2 ELSE IF CCIUFFER.-sTATUS_T-FULL) AHD CDUTjTR_T-ao-IN~TR_n)
THEN DO,
1118 3 USART.-sTATUS. USART_CHD-usART _CHD DR 2OH.
1'9 3 8UFFER-.sTATUB_'-INUSE, '
160 3 ENOl
161 2 IF (CHAR-LF AND SENDJ)ATA>O) TIEN SENDJ)ATA-SENDJ)ATA":I.
163 2 RETURN CHAR,
16~ 1 END FIFO_'_OUT.
296166-57
14-62
inter RUPITM·44
PL/I1-~l COttPtLER "'ppUCA'tiO" l1oduh: "s .. nc/SDLe Protocol convert.,- IB: SO: S3 09/19/83 PAGE 8
*'
••
.e DO WHILE WSART_BTATUS AND 01H)-O, /. W.U fa1' TIRDY on USART
.BO END,
.87 3 UBMTJ)ATA-P£SSAOEeJ) ,
.BB 3 oJ-..,+l •
• 89 3 END,
190 2 Ext-EX I_STORE, , . R•• to ........ nc trans.it intnrupt . /
'9' • END LINKJ)lSC.
206 3 DO 1-0 TO Uh
207 3 IF CHAR-HEX_TABLE( I)
lIEN GOTO L1,
209 END,
2.0 2 Ll: CALL COCHEX_TABLE(I»I
211 2 IF 1-14.
THEN OOTO LO,
2.3 2 RETURN II
2 •• END GET.}<EX,
296166-58
14-63
intJ RUPITM-44
221 3 ENDI
22' 2 STMT:
CIILL OUTPUTJIIEIISIICIE (. BIONJINII
226 2
227 3 DO 1-<1 TO 41
228 3 IF CHARof1ENU_CHII/IUI
TlEN ODTO "I.
230 3 ENDI
231 2 "l: CALL COUENU_CHMCI)I
232 2 IF 1-'
ntEN IIIITD ItOI
234 3 DO CIISE II
235 4 DOl
236 4 CIILL DUTPUTJESSIICIEC.BTAT....ADDllII
237 4 .STATIDN.,ADDRESS-sHLCOETJEI, 4) I
23'1 4 STAIIoSTIlTlON....ADDIIESSI
24' 4 DOl
296166-59
14-64
inter RUPITM_44
Appl'catlon Pladul.: " ... ne/BDLC P"o'ocol conv.,.t ... 18: ~Q: 53 09/19/83 PAGE 10
258 4 DQ.
259 4 CALL OUTPUT.,JESSAOEC. FIN),
260 4 CALL CLOSE'
261 4 END.
262 3 CALL DUTPUTftBBAGEC. FJN),
267 2 CHAR-uBARTJlATA.
268 2 STATUS-UllllRTJiTATUS AND 38H.
269 2 IF STATUSOO
THEN CALL ERRDRCSTATUSt,
271 2 Et.SE IF CHAR-ESC
THEN CALL PlENU.
273 3 ELSE DO,
274 3 CALL FIFO_T_INCCHAR',
275 3 IF ECHD-o
THEN CALL COCCHAR),
277 3 END.
278 END USART JlEC":'_INTI
279
2BO 2 DO FOREVER,
281 2 IF SENDJlATA)O
THEN DQ.
2B3 4 DO WHIL.E NOTCX"IT.JIUFFER~TV)I I.Wan until BIU_XPlIT_BUFFIf'
END. is •• p'" *'
284
285
2B6
4
3
3
LENGTH. CHAR -I.
SIU_X"IT..BUFFER CO'.DEBTIWATIQN..ADOREBB,
287 4 DO WHILE I CCHAR<>LFI AND CLENGTH<BUFFERJ.ENGTHI AND CBUFFER_STATUS_T<>EI1PTYII.
296166-60
14-65
intJ RUPITM·44
/. I f the Un • • nte" ••• , the ,.".In.1 .is ..... ,." than 8UFFER~NOTH ellar, ••nd the
Ll:
fh,t IUFFERJ.,ENOTH eb.,., n.n .. nd the " •• t, line. the SIU bu' f.,.
:Is an1u 8UFFERJ,.ENOTH ltV'.' . /
1-0, , . U.. J to cOUnt: the nUllb.,. of un.ute •• lul
:!92 3
tran •• Us ./
293
294
3
3
RETRY: JlESULT-TAANSMITCLENOTHJ I '*
Send th . . . . . . . . . ,
IF REBULT<>IUITA_TRANIIIIITTED
29. 4
,. w.n
THEN DD,
SO' ..I.e far Un. to connect then
WAIT-I,
1:", ••• in *'
297 4 THO-3CH,
29B 4 TLo-CMFlh
299 4 TRG-Il
300 S DO WHILE WAIT,
301 S END,
302 4 TRo-O.
303 4 1-1+1.
304 S IF 1)100 THEN DO. 1,* WaU 5 .. c to , . , on 1:I.n. et,.
'.nd ."1'01" ••••••• to t.rlllinel
~ S
and '''\1'
CALL LINKJ)ISC,
all*i" .,"
307 S GOTO Ll.
308 S END,
309
310
.-4 ODTO RETRY,
END,
311 3 END,
312 2
3'3 1
IIMNINOB:
2 ,IS THE HIOHEST USED INTERRUPT
296166-61
14-66
RUPITM_44
aNOLIST
'*
STATION STATES
DISCONNECT_S LIT
*' 'OOH'. 1* LOGICALLY DJSCONNECTED STATE*,
QO_TOJUSC L.IT '01H',
I_T _S L.IT '02H', /* INFORMATION TRANSFER STATE */
296166-62
14-67
RUPITM·44
RSDCNUI'1BER_OF..sTATIONS) STRUCTURE
(STATION_ADDRESS BYTE.
STATION_STATE BYTE.
NS BYTE.
NR BYTE.
BUFFER_STATUS
INFO_LENGTH
BYTE.
BVTE.
'* The .. htu .. o. th • • • conh1'V .t.tiDn. bu'''" *'
DATIII(64) BYTE) AUXILIARY,
'*
VARIABLES
STATlDN_NUrlBER IVTE
*' AUXILIARY.
RECYJ'IELD_LENQTH BYTE AUXILIARY,
WAIT BIT.
'*
BUFFERS . ,
SIU_XMITJUFFER(04) BYTE IDATA.
SIU~ECYJlUFFER(64) BYTE,
POWER_ON: PROCEDURE J
•
10
2
2
T8S-. SIU_X''lIT_BUFFERCOJi
RaS-. SIU..RECVJlUFFER(O),
11
12
2
2
R8L-64,
RBE-l,
'*/. En.bh tbl' SIU'. receiver*' ./
64 a"h reedv. buff.-r
13 00 1- 0 TO NUMBER_OF_STATIONS-I,
18 ENOl
1.
20
2
2
SMD-54HI 1* Using DPLL, NAZI. PFS. nMER 1, • 62.5 Mltps
TI'IOD-21H;
*'
2.
22
23
"
2
2
TH1-OFFHI
TCON-4DH,
IE-82H;
'*
U~. timer 0 for receive tim. out. int~r"upt *'
2" END POWER_ON.
296166-63
14-68
RUPITM_44
PL/M-51 CDMP ILER RUPI-44 PrilllArv Station 20: 47: 13 09/26/93 PAGE 3
29 2 RTS-.,
30 3 DC WHILE NOT SI;
3' 3 ENOl
32 2 BI-O,
33 END )1"11,
37 2 TIME_OUT: PROCEDURE BYTE, '* Tillie_out returns true if' there .... n't
.. flr.me rllceivlld within 200 m•• c.
40 3 WAn-II
4, 3 THO-3CH,
42 3 TLO-OAFH,
43 3 TRO-I,
44 4 DO WHILE WAITI
45 4 IF SI-l
THEN COTD T _0 I,
47 4 END;
48 3 END,
49 RETURN TRUE,
50
Sl-Ol
51 2 RETURN FAL.Se,
52 END TU1E~OUT;
53 SEND_DISC: PROCEDURE,
54 2 TBlcO,
55 2 CALL XMIT(DISC),
56 2 IF TIME_our-FALSE
THEN IF RCO-UA OR Rca-OM
57 3 THEN 001
59 3 RSD C9TAT ION_NUt1BER). BUFFER_ST '\TUS·BUFFER~OT.-READY I
60 3 RBO( STATION..NUI'1BER). STATION_STATE=-OISCONNECT_51
6' 3 ENOl
62 2
63
64 2 SEND_SNR"': PROCEDURE;
65 2 TBl-Ol
296166-64
14-69
inter RUPITM-44
66 2 CALL XI'IITCSNRI'I).
67 2 IF CTIME_our-FALSE> AND CRCa-UA)
THEN DO;
69 3 RSDCSTATJON_NUf1BER1. STATION_STATE"'I_T _51
70 3 RSD(STATJON_NUf'lDER)' Ns.-OI
71 3 RSDCSTATlONJruI'1BER)' NAcO,
72 3 ENO,
73 2 RBE-',
7.
70 2 CHECK-fiS: PROCEDURE BYTE,
79 END CHECK_NS;
_ls.
/ . Chu.k the Nt' f1hld of the ,.ltc:dvltd
h •• b •• n acknQlllhdgd.
,,..me.
If NsCP)+l-NrCS) then the frame
i f Ns(P)-NT'CS) then the fTame has not blten
ilcknollfledged. ehe r •• et th • • • conda,.v . /
8t 2 IF. «
(RSDCSlATION_NUMBER), NS + 1) AND 07H) • SHR(RCB, 5»
THEN DO;
83 3 RSD(STATIDN-.NUMBER). NS-' CRSDCSTATION.-NUI'IBER). NS+l) AND 07H),
a. 3 RSDCSTATlON_NUI'1BER). INFO_LENQTH-O;
ae 3 ENOl
a. 2 ELSE IF (RSDCSTATlON_NUf'fBERJ. NS <> SHRCRCB. 5J)
THEN RETURN FALSE,
as 2 RETURN TRUE,
a9 END CHECK-.NR,
90 2 RECElVE: PROCEDURE I
97
9S •• THEN DOl RSD(STATlON..NUMBERL NR-( CRSDC"STATION_NUMBER). NR+!) AND 07H)1
RDP-1i
296166-65
14-70
intJ RUPITM-44
••
100
RECV-FIELDJ.ENQTH-RFL-l;
ENOl
10. 3
THEN DO; '*
Supervillory Frame received *1
IF CHECK_NR.zFALSE
THEN RSO(STATION_NUHBER I. STATION_STATE-QO_TOJHSCi
110 3 ELSE DOi ,* Unnumber.d frame DT' unknown f,. .. m. received *'
III 3 IF RCB-FRMR
THEN Doi ,*.
*'
I f FRMR was received check NT' for an
ac:knollJledged I frallle
113 4 RCB-SIU_RECY_BUFFER( 1) I
114 4 I-CHECK_NRI
115 4 ENOl
tUt :3 RSO (STATION_NUMBER). STATIDN_STATE"OD_TOJ)I SCi
117 :3 ENOl
llS 2
120 2
122 IF TEl'IP-T_I_FRAME
THEN DOl
'* '* T1"an'lIit 1 frame *'
Transf.r the station buff.,. into int.rnal ram */
••
125 SIU_XMITJiUFFER (TEMP )"'RBOC STATJON-.NUMBER). DATA I TEMP) I
126 END;
133
13'
3
3
ELSE DO; '* Transmit RR or RNR.'
IF TEMP=T_RR
THEN TEMP-RRj
13' 3 ELSE TEHP ..RNRI
296166-66
14-71
inter RUPITM-44
PL,I'1-S1 COI1P]LER RUPI-44 Pri ... "u St.tion 20: 47: 13 09/26/83 PAOE 6
164 BEOIN:
CALL POWER_ONI
I.' a DO FOREvER I
I •• 3 DO STATlON_NUttBER-D TO NlR'tIER_OF'_STATIDNS-1J
,.7 3 STAD-RSDC STATION.JWt1BER). STATION..ADDRESSJ
16B 3 IF R9DCSTATION_NUf'IIBER). STATION_STATE. DISCONNECT_S
THEN CALL SEND~"J .
170 3 ELSE IF RSDCSTATIONJW"B~IU. BTATlON_STATE • OD_TOJUSC
THEN CALL SENDJlISC, .
172 3 ELSE IF CCRSDCSTATlDN_NUPlBERL IflFO-.LENQTH>OJ AND
CRSDCSTAnON~UMBER). 8UFFER..BTATUS-BUFFERJ'EADV»
THEN CALL XMIT_I_T_SCT_tJRAl'IEl,
174 3 ELSE IF RBP-O
THEN CALL XMJT_I_T_SCT_RR),
176 3 ELSE CALL XMIT_I_T_SCT_RNR);
177 3 IF RUP-1
THEN CALL BUFFER_TRANSFER,
296166-67
17" ENOl
190 02 ENOl
WARNINgS:
1 IS- THE HIGHEST USED INTERRUPT
296166-68
14-72
RUPITM Datasheet, 15
Application Note, Article
Reprint and Development
Support Tools
8044AH/8344AH/8744H
HIGH PERFORMANCE 8-BIT MICROCONTROLLER
WITH ON-CHIP SERIAL COMMUNICATION CONTROLLER
• 8044AH-lncludes Factory Mask Programmable ROM
• 8344AH-For Use with External Program Memory
• 8744H-lncludes User Programmable/Eraseable EPROM
Specifically, the 8044's Microcontroller features: 4K byte On-Chip program memory space; 32 I/O lines; two
16-bit timer/event counters; a 5-source; 2-level interrupt structure; a full duplex serial channel; a Boolean
processor; and on-chip oscillator and clock circuitry. Standard TTL and most byte-oriented MCS-80 and MCS-
85 peripherals can be used for 1/0 amd memory expansion.
The Serial Interface Unit (SIU) manages the interface to a high speed serial link. The SIU offloads the On-Chip
8051 Microcontroller of communication tasks, thereby freeing t~e CPU to concentrate on real time control
tasks.
The RUPI-44 family consists of the 8044, 8744, and 8344. All three devices are identical except in respect of
on-chip program memory. The 8044 contains 4K bytes of mask-programmable ROM. User programmable
EPROM replaces ROM in the 8744. The 8344 addresses all program memory externally.
The RUPI-44 devices are fabricated with Intel's reliable + 5 volt, Silicon-gate HMOSII technology and pack-
aged in a 40-pin DIP.
The 8744H is available in a hermetically sealed, ceramic, 40-lead dual in-line package which includes a
window that allows for EPROM erasure when exposed to ultraviolet light (See Erasure Characteristics). During
normal op.eration, ambient light may adversely affect the functionality of the chip. Therefore applications which
expose the 8744H to ambient light may require an opaque label over the window.
HOLCI
SOLC
port
231663-1
Figure 1. Dual Controller Architecture
October 1987
15-1 Order Number: 231663-004
inter 8044AH/8344AH/8744H
15-2
inter 8044AH/8344AH/8744H
XTAL 1 XTAL2
Input to the oscillator's high gain amplifier. Re- Output from the oscillator's amplifier. Input to the
quired when a crystal is used. Connect to VSS internal timing circuitry. A crystal or external source
when external source is used on XTAL 2. can be used.
Pl.0 vcc
'" P1.' PO.O ADO
PO.l AOI
f};
~:: c~
::a
Go
'"
iiTs
m
Pl1
P1 .•
Pl.S
Pl.7
PO.2
PO.3
PO••
PO.S
PO.I
A02
AD3
AOt
ADS
Alii
AST PO.7 A07
I/O Ii ·vpp
i[M:
RXD P3.0
DATA TXD P3.1 ALE PIIOG
INTO P3.2 mJii
l ".
INTI PU P2.7 A15
TO PU P2.I AU
_CTI
'" SCLK T1 P3.5 P2.5 AU
~ -~
Ii DATA TXD __ Wi P3.I P2.• A12
iiii P3.7 P2.3 All
-
Z INTO_ ..
~
~
i!I
iNfi.... ~
TO-., 0
SCLK..!!_ Go
=}@},...
"'-'"
2 _
. _
~
c
XTAL2
XTALI
VSS
P2.2
P2.1
P2.0
AID
A,
AI
~ WII_
~ iifi-- 231663-3
'" 231663-2
Pl.S 39 PO.4
P1.6 38 PO.S
P1.7 PO.6
RST/VPD PO.7
P3.0 EA
N/e N/e
P3.1 ALE
P3.2 PSEN
P3.3 P2.7
P3.4 P2.6
P3.S P2.S
231663-21
15-3 .
inter . 8044AH/8344AH/8744H
FREQUENCE
REFERENCE
r--
I DATA
I I-+I-----<'~~. 1/0
{D
either unit. Since the SIU possesses its own intelli- co•
••H
gence, the CPU is off-loaded from many of the com- .0H
A.H
munications tasks, thus dedicating more of its com~
puting power to controlling local peripherals or some
INDIRECT.
ADORESS·
ING
'
.B.
ADH
ID.
00.
external process. ' !!! 135 128 IOH
DIRECT
127 ADDRESS-
ING
The Microcontroller
The microcontroller is a stand-alone high-perform-
:"~ES",
BITS IN
Bl:A.
(121 BITS)
t!!
32
- A7
24 AD BANK3
127 120
0
15-4
8044AH/8344AH/8744H
• 1 p.s instruction cycle time for 60% of the instruc- Parallel 1/0
tions 2 p.s instruction cycle time for 40% of the
instructions The 8044 has 32 general-purpose I/O lines which
• 4 p.s cycle time for 8 by 8 bit unsigned Multiplyl are arranged into four groups of eight lines. Each
Divide group is called a port. Hence there are four ports;
Port 0, Port 1, Port 2, and Port 3. Up to five lines
from Port' 3 are dedicated to supporting the serial
INTERNAL DATA MEMORY channel when the SIU is invoked. Due to the nature
of the serial port, tWo of Port 3's lID lines (P3.0 and
Functionally the Internal Data Memory is the most P3.1) do not have latched outputs. This is true
flexible of the address spaces. The Internal Data whether or not the serial channel is used.
Memory space is subdivided into a 256-byte Internal
Data RAM address space and a 128-bit Special Port 0 and Port 2 also have an alternate dedicated
Function Register address space as shown in Figure function. When placed in the external access mode,
5. Port 0 and Port 2 become the means by which the
8044 communicates with external program memory.
The Internal Data RAM address space is 0 to 255. Port 0 and Port 2 are also the means by which the
Four 8-Register Sanks occupy locations 0 through 8044 communicates with external data memory. Pe-
31. The stack can be located anywhere in the Inter- ripherals can be memory mapped into the address
nal Data RAM address space. In addition, 128 bit space and controlled by the 8044.
locations of the on-chip RAM are accessible through
Direct Addressing. These bits reside in Internal Data
RAM at byte locations 32 through 47. Currently loca-
tions 0 through 191 of the Internal Data RAM ad-
dress space are filled with on-chip RAM.
15-5
inter .8044AH/8344AH/8744H ~OOI§Il.DIMJDOO~OOW
15-6
intJ 8044AH/8344AH/8744H ~OO~!LOfMlOOO&'OOW
PUSH direct
External RAM
(16-bit) addr
Push direct byte
2
RETI
" '. Return from
interrupt 1 2
AJMP addr11 Absolute Jump 2 2
onto stack 2 2
LJMP addr16 LOl']gJump 3 2
POP direct Pop direct byte
SJMP rei Short Jump
from stack 2 2
(relative addr) 2 2
XCH A,Rn Exchange
JMP @A + DPTR Jump indirect
register with
relative to the
Accumulator
DPTR 2
XCH A,direct Exchange direct
JZ rei Jump if
byte with
Accumulator is
Accumulator 2
Zero 2 2
XCH A,@Ri Exchange
JNZ rei Jump if
indirect RAM
Accumulator is
with A
Not Zero 2 2
XCHDA,@Ri Exchange low-
JC rei Jump if Carry
order Digit ind
flag is set 2· 2
RAMwA
JNC rei Jump if No Carry
flag 2 2
BOOLEAN VARIABLE MANIPULATION
JB bit,rel Jump if direct Bit
CLR C Clear Carry flag 1 set 3 2
CLR bit Clear direct bit 2 JNB bit,rel Jump if direct Bit
SETB C Set Carry Flag 1 Not set 3 2
SETB bit Set direct Bit 2 JBC bit,rel Jump if direct Bit
CPL C Complement is set & Clear bit 3 2
Carry Flag CJNE A,direct,rel Compare direct
CPL bit Complement toA&Jumpif
direct bit 2 Not Equal 3 2
ANL C,bit AND direct bit to CJNE A,#data,rel Comp, immed,
Carry flag 2 2 to A & Jump if
Not Equal 3 2
15-7
8044AH/8344AH/8744H
15-8
inter 8044AH/8344AH/8744H
SYMBOLIC BYTE
REGISTER NAMES ADDRESS BIT ADDRESS ADDRESS
~
~
SEND CDUNT RECEIVE COUNT NSNR 216 (D8H)
PROGRAM STATUS WORD PSW 208 208 (DOH)
'DMA COUNT DMA CNT 207 (CFH)
STATION ADDRESS STAD 206 (CEH)
RECEIVE FIELD LENGTH RFL 205 (CDH)
RECEIVE BUFFER'START RBS 204 (CCH)
RECEIVE BUFFER LENGTH RBL 203 (CBH) SFR's CONTAINING
RECEIVE CONTROL BYTE RCB 202 (CAH) D)RECT ADDRESSABLE BITS
SERIAL MODE SMD 201 (C9H)
STATUS REGISTER STS throuah 200 (C8H)
INTERRUPT PRIORITY CONTROL IP throuah 184 (B8H)
PORT 3 P3 throuGh 176 (BOH)
INTERRUPT ENABLE CONTROL IE 168 (A8H)
PORT 2 P2 throuah 160 (AOH)
PORT 1 PI throuah 144 (90H)
TIMER HIGH 1 THI 141 (8DH)
TIMER HIGH 0 THO 140 (8CH)
TIMER LOW 1 TLI 139 (8BH)
TIMER LOW 0 TLO 138 (8AH)
TIMER MODE TMDD 137 (89H)
TIME'R CONTROL TCON 143 136 (88H)
DATA POINTER HIGH DPH 131 (83H)
DATA POINTER LOW DPt. 130 (82H)
STACK POINTER SP 129 (81H)
PORTO PO 135 throuah 128 128 (80H)
231663-6
NOTE:
'ICE Support Hardware registers, Under normal operating conditions there is no need for the CPU to access these
registers,
SERIAL MODE REGISTER (SMD) SCM2 SCMl SCMO NRZI LOOP PFS NB NFCS
I I NON· BUFFERED
PRE· FRAME EYNC
LOOP
NON RETURN TO ZERO INVERTED
SELECT CLOCK MODE
I I
I RECEIVE BUFFER PROTECT
AUTO MODEIAODRESSED MODE
OPTIONAL POLL BIT
RECEIVE INFORMATION BUFFER OVERRUN
SERIAL INTERFACE UNIT INTERRUPT
REQUEST TO SEND
RECEIVE BUFFER EMPTY
TRANSMIT BUFFER FULL
231663-7
15·9
inter 8044AH/8344AH/8744H
With the addition of only a few bytes of code, the lowing responses without CPU intervention: I (Infor-
8044's frame size is not limited to the size of its mation), RR (Receive Ready), and RNR (Receive
internal RAM (192 bytes), but rather by the size of Not Ready).
external buffer with no degradation of the RUPI's
features (e.g. NRZI, zero bit insertion/deletion, ad- When the Receive Buffer Empty bit (RBE) indicates
dress recognition, cyclic redundancy check). There that the Receive Buffer is empty, the .receiver is en-
is a special function register called SIUST whose abled, and when the RBE bit indicates that the Re-
contents dictates the operation of the SIU. At low ceive Buffer is full, the receiver is disabled. Assum-
data rates, one section of the SIU (the Byte Proces- ing that the Receiver Buffer is empty, the SIU will
sor) performs no function during known intervals. respond to a poll with an I frame if the Transmit Buff~
For a given data rate, these intervals (stand-by er is full. If the Transmit Buffer is empty, the SIU will
mode) are fixed. The above characteristics make it respond to a poll with a RR command if the Receive
possible to program the CPU to move data to/from Buffer Protect bit (RBP) is cleared, or an RNR com-
external RAM and to force the SIU to perform some mand if RBP is set.
desired hardware tasks while transmission or recep-
tion is taking place. With these modifications, exter-
nal RAM can be utilized as a transmit and received FLEXIBLE (or NON-AUTO) Mode
buffer instead of the internal RAM.
In the FLEXIBLE mode all communications are un-
der control of the CPU. It is the CPU's task to en-
AUTO Mode code and decode control fields, manage acknowl-
edgements, and adhere to the requirements of the
In the AUTO mode the SIU implements in hardware HOLC/SOLC protocols. The 8044 can be used as a
a subset of the SOLC protocol such that it responds primary or a secondary station in this m9de.
to many SOLC frames without CPU intervention. All
AUTO mode responses to the primary station will To receive a frame in the FLEXIBLE mode, the CPU
comform to IBM's SOLC definition. The advantages must load the Receive Buffer Start register, the Re-
of the AUTO mode are that less software is required ceive Buffer Length register, clear the Receive Buff-
to implement a secondary station, and the hardware er Protect bit, and set the Receive Buffer Empty bit.
generated response to polls is much faster than do- If a valid opening flag is received and the address
ing it in software. However, the Auto mode can not field matches the byte in the Station Address regis-
be used at a primary station. ter or the address field contains a broadcast ad-
dress, the 8044 loads the control field in the receive
To transmit in the AUTO mode the CPU must load control byte register, and loads the I field in the re-
the Transmit Information Buffer, Transmit Buffer ceive buffer. If there is no CRC error, the SIU inter-
Start register, Transmit Buffer Length register, and rupts the CPU, indicating a frame has just been re-
set the Transmit Buffer Full bit. The SIU automatical- ceived. If there is a CRC error, no interrupt occurs.
ly responds to a poll by transmitting an information The Receive Field Length register provides the num-
frame with the P/F bit in the control field set. When ber of bytes that were received in the information
the SIU receives a positive acknowledgement from field.
the primary station, it automatically increments the
Ns field in the NSNR register and interrupts the To transmit a frame, the CPU must load the transmit
CPU. A negative acknowledgement would cause the information buffer, the Transmit Buffer Start register,
SIU to retransmit the frame. the Transmit Buffer Length register, the Transmit
Control Byte, and set the TBF and the RTS bit. The
To receive in the AUTO mode, the CPU loads the 81U, unsolicited by an HOLC/SOLC frame, will trans-
Receive Buffer Start register, the Receive Buffer mit the entire information frame, and interrupt the
Length register, clears the Receive Buffer Protect CPU, indicating the completion of transmission. For
bit, and sets the Receive Buffer Empty bit. If the SIU supervisory frames or· unnumbered frames, the
is polled in this state, and the TBF bit indicates that transmit buffer length would be O.
the Transmit Buffer is empty, an automatic RR re-
sponse will be generated. When a valid information
frame is received the SIU will automatically incre- CRC
ment Nr in the NSNR register and interrupt the CPU.
The FCS register is initially set to all 1's prior to cal-
While in the AUTO mode the SIU can recognize and culating the FCS field. The SIU will not interrupt the
respond to the following commands without CPU in- CPU if a CRC error occurs (in both AUTO and FLEX-
tervention: I (Information), RR (Receive Ready), IBLE modes). The CRC error is cleared upon receiv-
RNR (Receive Not Ready), REJ (Reject), .and UP ing of an opening flag.
(Unnumbered Poll). The SIU can generate the fol-
15-10
8044AH/8344AH/8744H
Frame Format Options be stored in the Transmit and Receive buffers. For
example, in the non-buffered mode the third byte is
In addition to the standard SDLC frame format, the treated as the beginning of the information field. In
8044 will support the frames displayed in Figure 7. the non-addressed mode, the information field be-
The standard SDLC frame is shown at the top of this gins after the opening flag. The mode bits to set the
figure. For the remaining frames the information field frame format options are found in the Serial Mode
will incorporate the control or address bytes and the register and the Status register.
frame check sequences; therefore these fields will
Standard SOLC
NON-AUTO Mode
0 0 0 IF IA IC I I I FCS I F I
Standard SOLC
AUTO Mode
0 0 1 IF IA IC I I I FCS I F I
Non-Buffered Mode
NON-AUTO Mode
0 1 1 IF IA I I I FCS I F I
Non-Addressed Mode
NON-AUTO Mode
0 1 0 I FI I
I FCS I F I
No FCS Field
NON-AUTO Mode
1 0 0 IF IA IC I I
I F I
No FCS Field
AUTO Mode
1 0 1 IF IA IC I I I F I
No FCSField
Non-Buffered Mode
1 1 1 IF IA I I
I F I
NON-AUTO Mode
No FCS Field
Non-Addressed Mode
1 1 0 IF I I I F I I
NON-AUTO Mode
Mode Bits:
AM - "AUTO" Mode/Addressed Mode
NB - Non-Buffered Mode
NFCS - No FCS Field Mode
Key to Abbreviations:
F = Flag (01111110) I = Information Field
A = Address Field FCS= Frame Check Sequence
C = Control Field
Note 1:
The AM bit function is controlled by the NB bit. When NB = 0, AM becomes AUTO mode select, when NB = 1, AM
becomes Address mode select.
Figure 7. Frame Format Options
15-11
inter 8044AH/8344AH/8744H
The SIU can be used in a SDLC non-loop configura- The SMD, STS, and NSNR, registers are all cleared
tion as a secondary or primary station. When the SIU by system reset. This assures that the SIU will power
is placed in the non-loop mode, data is received and up in an idle state (neither receiving nor transmit-
transmitted on pin 11, and pin 10 drives a tri-state ting).
buffer. In non-loop mode, modem interface pins,
RTS and CTS, become available. These registers and their bit assignments are de-
scribed below.
15-12
8044AH/8344AH/8744H
Receive Buffer Empty (RBE) bits (in the STS regis- CPU, and enables the SIU to post status information
ter) are both false (0). Normally, SMD is accessed for the CPU's access. The SIU can read STS, and
only during initialization. can alter certain bits, as indicated below. The CPU
can both read and write STS asynchronously. How-
The individual bits of the Serial Mode Register are as ever, 2-cycle instructions that access STS during
follows: both cycles ('JBC/B, REL' and 'MOV/B, C.') should
not be used, since the SIU may write to STS be-
Bit# Name Description tween the two CPU accesses.
SMD.O NFCS No FCS field in the SDLC frame. The individual bits of the Status/Command Register
SMD.1 NB Non-Buffered mode. No control are as follows:
field in the SDLC frame.
SMD.2 PFS Pre-Frame Sync mode. In this Bit# Name Description
mode, the 8044 transmits two STS.O RBP Receive Buffer Protect. Inhibits
bytes before the first flag of a writing of data into the receive
frame, for DPLL synchronization. buffer. In AUTO mode, RBP
If NRZI is enabled, OOH is sent; forces an RNR response instead
otherwise, 55H is sent. In either of an RR.
case, 16 preframe transitions are
guaranteed. STS.1 AM AUTO Mode/Addressed Mode.
Selects AUTO mode where
SMD.3 LOOP Loop configuration. AUTO mode is allowed. If NB is
SMD.4 NRZI NRZI coding option. If bit = 1, true, (= 1), the AM bit selects the
NRZI coding is used. If bit = 0, addressed mode. AM may be
then it is straight binary (NRZ). cleared by the SIU.
SMD.5 SCMO Select Clock Mode-Bit 0 STS.2 OPB Optional Poll Bit. Determines
SMD.6 SCM1 Select Clock Mode-Bit 1 whether the SIU will generate an
AUTO response to an optional
SMD.7 SCM2 Select Clock Mode-Bit 2 poll (UP with P = 0). OPM may
be set or cleared by the SII).
The SCM bits decode as follows: STS.3 BOV Receive Buffer Overrun. BOV
may be set or cleared by the SIU.
SCM Data Rate STSo4 SI SIU Interrupt. This is one of the
2 1 0 Clock Mode (Bits/sec)· five interrupt sources to the CPU.
0 0 0 Externally clocked 0-204M·· The vector location = 23H. SI
may be set by the SIU. It should
0 0 1 Reserved be cleared by the CPU before
0 1 0 Self clocked, timer overflow 244-62.5K returning from an interrupt
0 1 1 Reserved routine.
1 0 0 Self clocked, external16x 0-375K STS.5 RTS Request To Send. Indicates that
the 8044 is ready to transmit or is
1 0 1 Self clocked, external 32x 0-187.5K transmitting. RTS may be read or
1 1 0 Self clocked, internal fixed 375K written by the GPU. RTS may be
1 1 1 Self clocked, internal fixed 187.5K read by the SIU, and in AUTO
mode may be written by the SIU.
NOTES: STS.6 RBE Receive Buffer Empty. RBE can
• Based on a 12 Mhz crystal frequency be thought of as Receive Enable.
"0-1 M bps in loop configuration
RBE is set tq one by the CPU
when it is ready to receive a
STS: Status/Command Register (bit- frame, or has just read the buffer,
addressable) and to zero by the SIU when a
Bit: 7 6 5 4 3 2 1 0 frame has been received.
ITBF IRBE IRTS ISI IBOV IOPB IAM IRBP I S:rS.7 TBF Transmit Buffer Full. Written by
the ~U to indicate that it has
fille the transmit buffer. TBF may
The Status/Command Register (Address C8H) pro- be cleared by the SIU.
vides operational control of the SIU ~y the 8044
15-13
inter 8044AH/8344AH/8744H
NSNR: Send/Receive Count Register (blt- TBS: Transmit Buffer Start Address Register
addressable) (byte-addressable)
Bit:? 6 543210
The Transmit Buffer Start address register (Address
INs2INs1INsolsEslNR2INR1IN~0IsERI DCH) points to the location in on-chip RAM for the
beginning of the I-field of the frame to be transmit-
The Send/Receive Count Register (Address D8H) ted. The CPU should access TBS only when the SIU
contains the transmit and receive sequence num- is not transmitting a frame (when TBF = 0).
bers, plus tally error indications. The SIU can both
read and write NSNR. The 8044 CPU can both read TBl: Transmit Buffer Length Register
and write NSNR asynchronously. However, 2-cycle (byte = addressable)
instructions that access NSNR during both cycles
(,JBC /B, REl,' and 'MOV /B,C') should not be The Transmit Buffer length register (Address DB H)
used, since the SIU may write to NSMR between the contains the length (in bytes) of the I-field to be
two 8044 CPU accesses. transmitted. A blank I-field (TBl = 0) is valid. The
CPU should access TBl only when the SIU is not
The individual bits of the Send/Receive Count Reg- transmitting a frame (when TBF = 0).
ister are as follows:
NOTE:
Blt# Name Description
The transmit and receive buffers are not allowed to
NSNR.O SER Receive Sequence Error: "wrap around" in the on-chip RAM. A "buffer end"
NS (P) =1= NR (S) is automatically generated if address 191 (BFH) is
reached.
NSNR.1 NRO Receive Sequence Counter-Bit 0
NSNR.2 NR1 Receive Sequence Counter-Bit 1 TCB: Transmit Control Byte Register
NSNR.3 NR2 Receive Sequence Counter-Bit 2 (byte-addressable)
NSNR.4 SES Send Sequence Error: The Transmit Control Byte register (Address DAH)
NR (P) =1= NS (S) and contains the byte which is to be placed in the control
NR (P) =1= NS (S) + 1 field of the transmitted frame, during NON-AUTO
mode transmission. The CPU should access TCB
NSNR.5 NSO Send Sequence Counter-Bit 0 only when the SIU is not transmitting a frame (when
NSNR.6 NS1 Send Sequence Counter-Bit 1 TBF = 0). The Nsand NR counters are not used in
the NON-AUTO mode.
NSNR.? NS2 Send Sequence Counter-Bit 2
15-14
intJ 8044AH/8344AH/8744H
RFL: Receive Field Length Register The emulator operates with Intel's Inteliec™ devel-
(byte-addressable) opment system. The development system interfaces
with the user's 8044 system through an in-cable
The Receive Field Length register (Address CD H) buffer box. The cable terminates in a 8044 pin-com-
contains the length (in bytes) of the received I-field patible plug, which fits into the 8044 socket in the
that has just been loaded into on-chip RAM. RFL is user's system. With the emulator plug in place, the
loaded by the SIU. RFL = 0 is valid. RFL should be user can excercise his system in real time while col-
accessed by the CPU only when RBE = O. lecting up to 255 instruction cycles of real-time data.
In addition, he can single-step the program.
RCB: Receive Control Byte Register Static RAM is available (in the in-cable buffer box) to
(byte-addressable) emulate the 8044 internal and external program
The Received Control Byte register (Address CAH) memory and external data memory. The designer
contains the control field of the frame that has just can display and alter the contents of the replace-
been received. RCB is loaded by the SIU. The CPU ment memory in the buffer box, the internal data
can only read RCB, and should only access RCB memory, and the internal 8044 registers, including
when RBE = O. the SFR's.
15-15
inter 8044AH/8344AH/8744H
ABSOLUTE MAXIMUM RATINGS* *Notice: Stresses above those listed under 'i'\bso-
Ambient Temperature Under Bias ...... O°C to 70°C lute Maximum Ratings" may cause permanent dam-
age to the device. This is a stress rating only and
Storage Temperature ........... -65°C to -150°C
functional operation of the device at these or any
Voltage on EA, VPP Pin to VSS ... -0.5V to -21.5V other conditions above those indicated in the opera-
Voltage on Any Other Pin to VSS .... - 0.5V to -7V tional sections of this specification is not implied Ex-
Power Dissipation ........................... 2W posure to absolute maximum rating conditions for
extended periods may affect device reliability.
'NOTES:
1. Sampled not 100% tested. T A = 25'C.
2. Capacitive loading on Ports 0 and 2 may cause spurious noise pulses to be superimposed on the VOLs of ALE and Ports
1 and 3. The noise is due to ex1ernal bus capacitance discharging into the Port 0 and Port 2 pin when these pins make 1-to-
o transitions during bus operations. In the worst cases (capacitive loading > 100 pF), the noise pulse on the ALE line may
exceed O.SV. In such cases it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt
Trigger STROBE input.
15-16
inter 8044AH/8344AH/8744H
A.C. CHARACTERISTICS
T A = O°C to + 70°C, VCC = 5V ± 10%, VSS = OV, Load Capacitance for Port 0, ALE, and PSEN = 100 pF,
Load Capacitance for All Other Outputs = 80 pF
NOTES:
1. TLLAX for access to program memory is different from TLLAX for data memory.
2. Interfacing RUPI·44 devices with float times up to 75ns is permissible. This limited bus contention will not cause any
damage to Port 0 drivers.
15·17
8044AH/8344AH/8744H
NOTE:
1. TLLAX for access to program memory is different from TLLAX for access data memory.
15-18
inter 8044AH/8344AH/8744H
WAVEFORMS
Memory Access
~-------------------------------TCV--------------------------~
ALE
A7-AD INSTRIN
PORTO
TWHlH
~------"""" 1+------ TllDV------------~
ALE
PSEN
TllWl
RD ----------------~r_------------, ~~-----_+TRlRH------------~.__- - - - - -
TllAX TRHDX
A7-AO DATA IN
PORTO
TRlAZ
TWHLH
ALE
----------------4-----------~ 14-----------TWLWH------~--~~_____
TOVWH TWHQX
PORTO DATA OUT
231663-10
15-19
inter- 8044AH/8344AH/8744H
1-------,-----.;..- TDCy-------,----!
DATA
TTD
231663-11
1--------'TDCy-------!
- - - - - - - - , . I------,--TDCL - - - + l r------"""
SCLK
i+---TDCH - - + I
DATA
TDSS I-----'---TDHS-------+I
231663-12
15-20
intJ 8044AH/8344AH/8744H
=x
AC TESTING INPUT, OUTPUT, FLOAT WAVEFORMS
INPUT/OUTPUT
r------------------------------,
FLOAT
2.4
0.45
20
TEST POINTS
2.0)<=.
-"0.:::.8_ _ _ _ _......::0::::..;.8
231663-13
2.4
~
j >-----FLOAT-------<t.j
2 _ . 0_ _
U
2.0 2.4
M ~
AC testing inputs are driven at 2.4V for a Logic "1" and 0.45V for
a Logic "0" Timing measurements are made at 2.0V for a Logic 231663-14
"1" and 0.8V for a Logic "0".
TCHCl
1-------- T C l C l - - - - - - - l
231663-15
Variable Clock
Symbol Parameter Freq = 3.5 MHz to 12 MHz Unit
Min Max
TClCl Oscillator Period 83.3 285.7 ns
TCHCX High Time 20 TClCl-TClCX ns
TClCX low Time 20 TCI,.Cl-TCHCX ns
TClCH Rise Time 20 ns
TCHCl Fall Time 20 ns
15-21
intJ 8044AH/8344AH/8744H
CLOCK WAVEFORMS
INTERNAL
CLOCK I STATE 4
Pl1p2
I STATE 5
Pl1p2
STATE 6
~I~
I STATE 1
~I~
I~I~
STATE 2 I
~I~
STATE 3 I STATE 4
~I~
I STATE 5
~I~
XTAL2
ALE
PSEN
::2.
I
L.I__
L
PO
READ CYCLE
RD
PO
DPL OR RI
OUT ~¢' FLOATSr=O .n~
P2 INDICATES DPH OR P2 SFR TO PCH TRANSITIONS
WRITE CYCLE
!. ~I~OGRAM
DPL OR Ri
PO OUT
DATA OUT .$--;-;I tCl OUT
MEMORY IS EXTERNAL)
P2 INDICATES DPH OR P2 SFR TO PCH TRANSITIONS
PORT OPERATION
MOV PORT, SRC I
OLD DATA NEW DATA
This diagram indicates when signals are clocked internally. The time ittakes the signals to propagate to the
pins, however, ranges from 25 to 125 ns. This propagation delay is dependent on variables such as tempera-
ture and pin loading. Propagation also varies from output to output and component to component. Typically
though, (TA' = 25°C, fully loaded) RD and WR propagation delays are approximately 50 ns. The other signals
are typically 85 ns. Propagation delays are incorporated in the AC specifications.
15-22
inter 8044AH/8344AH/8744H
15-23
intJ 8044AH/8344AH/8744H
+5V
P2.4
P2.5 ALE - - ALE PFiOG
P2.6
P2.7
XTAL2 Eli --!A/VPP
- 231663-17
+5V
Vee
He PI
8744H
P2.0- PO Ne
He P2.3
P2.4
P2.5 ALE _ _ _ ALE/PAOG 50 ms PULSE TO GND
P2.6
TTL HIGH P2.7
XTAL2 EA - - EII/VPP +21V PULSE
15-24
8044AH/8344AH/8744H
+SV
P2.4
P2.S
A~ TTTLH'GH
P2.6
ENABLE - - - - - I P2.7 EA
XTAL2 RST VIH1
XTAL1
VSS =
231663-19
15-25
8044AH/8344AH/8744H
PROGRAMMING VERIFICATION
P1.0-P1.7
P2.0-PU ADDRESS ADDRESS "-
/
--
TAVOV
TDVGL -
TGHDX
TAVGL --
TGHAX
ALEPiffiG \
TSHGL "---...! ~
TGi:GH
21V ..SV
\
TT
~ TTL HIGH TTL HIGH TTL HIGH
D:vpp
___ )~
--
TEHSH
_ TELOV _ TEHOZ
P1.7)-_1
(ENAiiLE) i~ ..,J,
231663-20
15-26
inter APPLICATION
NOTE
AP-283
September 1986
PARVIZ KHODADADI
APPLICATIONS ENGINEER
1.0 INTRODUCTION suIDes that the reader is familiar with the 8044 data
sheet and the SDLC communications protocol.
The 8044 is a serial communication microcontroller
known as the RUPI (Remote Universal Peripheral In-
terface). It merges the popular 8051 8-bit microcontrol- 1.1 Normal Operation
ler with an intelligent, high performance HDLC/SDLC
serial communication controller called the Serial Inter- In Normal operation the on-chip CPU and the SIU
face Unit (SID). The chip provides all features of the operate in parallel. The SIU handles the serial commu-
microcontroller and supports the Synchronous Data nication task while the CPU processes the contents of
Link Control (SDLC) communications protocol. the on-chip transmit and receiver buffer,. services in~er
rupt routines, or performs the local real time processmg
There are two methods of operation relating to frame tasks.
size:
The 192 bytes of on-chip RAM serves as the interface
1) Normal operation (limited frame size) buffer between the CPU and the SIU, used by both as a
2) Expanded operation (unlimited frame size) receive and transmit buffer. Some of the internal RAM
space is used as general purpose registers (e.g. RO-R7).
In Normal operation the internal 192 byte RAM is . The remaining bytes may be divided into at least two
used as the receive and transmit buffer. In this opera- sections: one section for the transmit buffer and the
tion, the chip supports data rates up to 2.4 Mbps exter- other section for the receive buffer. In some applica-
nally clocked and 375 Kbps self-clocked. For frame tions, the 192 byte internal RAM size imposes a limita-
sizes greater than 192 bytes, Expanded operation is re- tion on the size of the information field of each frame,
quired. In Expanded operation the external RAM, in and, consequently, achieves less than optimal informa-
conjunction with the internal RAM, is used as the tion throughput.
transmit and receive buffer. In this operation, the chip
supports data rates up to 500 Kbps externally clocked Figure 1 illustrates the flow of data when internal
and 375 Kbps self-clocked. In both cases, the SIU han- RAM is used as the receive and transmit buffer. The
dles many of the data link functions in hardware, and on-chip CPU allocates a receive buffer in the internal
the chip can be configured in either Auto or Flexible RAM and enables the SIU. A receiving SDLC frame is
mode.
processed by the SIU and the information bytes of the
frame, if any, are stored in the internal RAM. Th~n,
The discussion that follows describes the operation of
the sm informs the CPU of the received bytes (Senal
the chip and the behavior of the serial interface unit. Channel interrupt). For transmission, the CPU loads
Both Normal and Expanded operations will be further· the transmitting bytes into the internal RAM and en-
explained with extra emphasis on Expanded operation
ables the SIU. The SIU transmits the information bytes
and its supporting software. Two examples of SDLC in SDLC format. '
communication systems will also be covered, where the
chip is used in Expanded operation. The discussion as-
----
TR~~;~~~ I F III
A C
---- I FCS1 I FCS2 II
F
SPECIAL ~UNCTION
REGjERS
OBFH
(
TRAJSMIT
BU1ER
..11. t
RECEIVE
v
/' BUFFER
t
t
GENERAL PURPOSE
-", - I FCS1 I FCS21 F I REGISTERS
t
---- INTERNAL RAM
OOH
, 292019-1
15-28
FLEXIBILITY IN FRAME SIZE WITH THE 8044
RECEIVE I
1.2 Expanded Operation features of the 8044 which are necessary to further ex-
plain expanded operation.
In Expanded operation the on-chip CPU monitors the
state of the SIU, and moves data from/to external buff-
er to/from the internal RAM and registers while recep- 2.0 THE SERIAL INTERFACE UNIT
tion/transmission is taking place. If the CPU must
service an interrupt during transmission or reception of
a frame or transmit from internal RAM, the chip can 2.1 Hardware Description
shift to Normal 0l'eration.
The Serial Interface Unit (SIU) of the RUPI, shown in
There is a special function register called SIUST, the Figure 3, is divided functionally into a Bit Processor
contents of which dictate the operation of the SIU. (BIP) and a Byte Processor (BYP), each sharing some
Also, at data rates lower than 2.4 Mbps, one section of common timing and control logic. The bit processor is
the SIU, in fixed intervals during transmission and re- the interface between the SIU bus and the serial port
ception, is in the "standby" mode and performs no pins. It performs all functions necessary to transmit/re-
function. The above two characteristics make it possi- ceive a byte of data to/from the serial data line (shift-
ble to program the CPU to move data to/from external ing, NRZI coding, zero insertion/deletion, etc.). The
RAM and to force the SIU to repeat or skip some de- byte processor manipulates bytes of data to perform
sired hardware tasks while transmission or reception is message formatting, transmitting, and receiving func-
taking place. With these modifications, external .RAM tions. For example, moving bytes from/to the special
can be utilized as a transmit and receive buffer instead function registers to/from the bit processor.
of the internal RAM.
The byte processor is controlled by a Finite-State Ma-
Figure 2 graphically shows the flow of data when exter- chine (FSM). For every receiving/transmitting byte,
nal RAM is used. For reception, the receiving bytes are the byte processor executes one state. It then jumps to
loaded into the Receive Control Byte (RCB) register. the next state or repeats the same state. These states
Then, the data in RCB is moved to external RAM and will be explained in section 3. The status of the FSM is
the SIU is forced to load the next byte into the RCB kept in an 8-bit register called SIUST (SIU State Coun-
register - The chip believes it is receiving a control byte ter). This register is used to manipulate the behavior of
continuously. For transmission, Information bytes (1- the byte processor.
bytes) are loaded into a location in the internal RAM
and the chip is forced to transmit the contents of this As the name implies, the bit processor processes data
location repeatedly. one bit at a time. The speed of the bit processor is a
function of the serial channel data rate. When one byte
Discussion of expanded operation is continued in sec- of data is processed by the bit processor, a byte bounda-
tions 4 and 5. First, however, sections 2 and 3 describe
15-29
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
ry is reached. Each time a byte boundary is detected in block of data into the shift register. The serial data is
the serial data stream, a burst of clock cycles (16 CPU also shifted; through SR, to a l6-bit register called
states) is generated for the byte processor to execute "FCS GEN/CHK" for CRC checking. The byte proc-
one state of the state machine. When all the procedures essor takes the received address and control bytes from
in the state are executed, a wait signal is asserted to the SR shift register and moves them to the appropriate
terminate the burst, and the byte processor waits for· registers. If the contents of the shift register is expected
the next byte boundary (standby mode). The lower the to be an information byte, the byte processor moves
data rate, the longer the byte processor will stay in the them through a 3-byte FIFO to the internal RAM at a
standby mode. starting location addressed by the contents of the Re-
ceive Buffer Start (RBS) register.
PH2
. - TIMER j
OVERFLOW
SClR
SPECIAL
FUNCTION
REGISTERS:
STAD TBl DUAL
RCB TCB PORT
RBl BCNT . RAM
RBS FIFOO
RFl FIF01 CONTROL <'
TBS 'FIF02 SIGNALS,
lB·
292019-3
15-30
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
3.0 TRANSMIT AND RECEIVE of the information field are pushed into the 3-byte
FIFO (FIFOO, FIF01, FIF02) and the Receive Field
STATES Length register (RFL) is set to zero. The 3-byte FIFO
The simplified receive and transmit state diagrams are is used as a pipeline to move received bytes into the
shown in Figures 4 and 5, respectively. The numbers on internal RAM. The FIFO prevents transfer of CRC
the left of each state represent the contents of the bytes and the closing flag to the receive buffer (i.e.,
SIUST register when the byte processor is in the stand- when the ending flag is received, the contents of FIFO
by mode, and the instructions on the right of each state are FLAG, FCS1, and FCSO.) The three byte FIFO is
represent the "state procedures" of that state. When the collapsed to one byte in No FCS mode.
byte processor executes these procedures the least three
significant bits of the SIUST register are being incre- In the DMA-LOOP state the byte processor pushes a
mented while the other bits remain unchanged. The byte from SR to FIFOO; moves the contents of FIF02
byte processor will jump from one state to another to the hiternal RAM addressed by the contents of
without going into the standby mode when a condition- SRAR, increments the SRAR and RFL registers, and
al jump procedure executed by the byte processor is decrements the DCNT register. If more information
true. - bytes are expected, the byte processor repeats this state
on the next byte boundaries until DMA Buffer End
occurs. The DMA Buffer End occurs if SRAR reaches
. 3.1 Receive State Sequence OBFH (192 decimal), DCNT reaches zero, or the RBP
bit of the STS register is set.
When an opening flag (7EH) is detected by the bit
processor, the byte processor is triggered to execute the The BOY-LOOP state, the last state, is executed if
procedures of the FLAG state. In the FLAG state, the there is a buffer overrun. Buffer overrun occurs when
byte processor loads the contents of the RBS register the number of information bytes received is larger than
into the Special RAM (SRAR) register. SRAR is the the length of the receive buffer (RFL > RBL). This
pointer to the internal RAM. The byte processor decre- state is executed until the closing flag is received.
ments the contents of the Receive Buffer Length (RBL)
register and loads them into the DMA Count (DCNT) At the end of reception, if the FCS option is used, the
register. The FCS GEN/CHK circuit is turned on to closing flag and the FCSbytes will remain in the 3-byte
monitor the serial data stream for Frame Check Se- FIFO. The contents of the RCB register are used to
querice functions as per SDLC specifications. update the NSNR (Receive/Send Count) register. The
SIU updates the STS register and sets the serial inter-
Assuming there is an address field in the frame, con- rupt.
tents of the SIUST register will then be. changed to
OSH, causing the byte processor to jump to the AD-
DRESS stl;lte ,and wait (standby) for the next byte 3.2 Transmit State Sequence
boundary. As soon as the bit processor moves the ad-
dress byte into the SR shift register, a byte boundary is Setting the RTS bit puts the SIU in the transmit mode ..
achieved and the byte processor is triggered to execute When the CTS pin goes active, the byte processor goes
the procedures in the ADDRESS state. into START-XMIT state. In this state the opening flag
is moved into the RAM Buffer (RB) register. The byte
In the ADDRESS state the received station address is processor jumps to the next state and goes into the
compared to the contents of the STAD register. If there standby mode.
is no match, or the address is not the broadcast address
(FFH), reception will be aborted (SIUST = 0IH). Oth- If the Pre-Frame Sync (PFS) option is selected, the
erwise, the byte processor jumps to the CONTROL PFSI and PFS2 states will be executed to transmit the
state (SIUST = lOH) and goes into standby mode. two Pre-Frame Sync bytes (OOH or 55H). In these two
states the contents of the Pre-Frame Sync generator are
The byte processor jumps to the CONTROL state if sent to the serial port while the Zero Insertion Circuit
there exists a control field in the receiving frame. In (ZID) is turned off. ZID is turned back on automatical-
this state the control byte is moved to the RCB register lyon the next byte boundary.
by the byte processor. Note that the only action taken
in this state is that a received byte, processed by the bit If the PFS option is not chosen, the byte processor
processor, is moved to RCB. There is no other hard- jumps to the FLAG state. In this state, the byte proces-
ware task performed, and DCNT and SRAR are not sor moves the contents of TBS into the SRAR register,
affected in this state. decrements TBL and moves the contents into the
DCNT register. The byte 'processor turns off the ZID
The next two states'-PUSH-I and PUSH-2, will be exe- and turns on FCS GEN/CHK. The contents of FCS
cuted if Frame check sequence (NFCS = 0) option is GEN/CHK are not transmitted unless the NFCS bit is
selected. In these two states the first and second bytes
15-31
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
set. If a frame with the address field is chosen. it moves byte' boundaries until all the information bytes are
the contents of the STAD register into the RB register transmitted. '
for transmission. At the same time. the opening flag is
being transmitted by the bit processor. The FCSI and the FCS2 states are executed to transmit
the Frame Check Sequence bytes generated by the FCS
In the ADDRESS (SIUST = AOH) and CONTROL generator, and the END-FLAG state is executed to
(SIUST = ASH) states, TCB and the first information transmit the closing flag.
byte are loaded into the RB register for transmission,
respectively. Note that in the CONTROL state, none of The XMIT-ACTION and the ABORT-ACTION
the registers (e.g. DCNT, SRAR) are incremented, and states are executed by the byte processor to synchronize
ZID and FCS GEN/CHK are not turned on or off. the SIU with the CPU clock. The XMIT"ACTION or
the ABORT-ACTION state is repeated until the byte
The procedures in the DMA·LOOP state are similar to processor status is updated. At the end, the STS and the
the procedures of the DMA·LOOP in the receive state TMOD registers are updated.
diagram. The SRAR register pointer to the internal
RAM is incremented, and the DCNT register is decre- The two ABORT-SEQUENCE states (SIUST = EOH
mented. The contents of DCNT reach'zero when all the and SIUST = ESH) are executed only if transmission
information bytes froni the transmit buffer are trans- is aborted by the CPU (RTS or TBF bit of the STS
mitted. A byte from RAM is moved to the RB register register is cleared) or by the serial data link (CTS signal
for transmission. This state is executed on the following goes inactive or shut-off occurs in loop mode.)
15-32
FLEXIBILITY IN FRAME SIZE WITH THE 8044
J
88H B8-1) IF NO PFS (SMD.2=0).
GOTO 98-1
'B8-2) XMIT A PFS BYTE
BB-3) ZID OFF
98H
I
FLAG 9B-1) (TBS)--SRAR
98-2) ZID OFF
9B-3) (TBL)-I-- (DCNT)
98-4) TURN ON ,CS GEN/CHK
98-5) IF POINT TO POINT MODE.
GOTO A8-1
98-6) (STAD)-- RB
COH
15-33
intJ FLEXIBILITY IN FRAME SIZE WITH THE 8044
15-34
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
If the RUPI is used in Auto mode (see Section 5), it 4.4 Maximum Data Rate in Expanded
will still respond to RR, RNR, REJ, and Unnumbered
Poll (UP) SDLC commands with RR or RNR auto-
Operation
matically, without using any transmit routine. For ex- Assuming there is no zero-insertion/deletion, the bit
.ample, if the on-chip CPU is busy performing some real processor requires eight serial clock periods to process
time operations, the SIU can transmit an information one block of data. The byte processor, running on the
frame from the internal buffer or transmit a supervisory CPU clock, processes one byte of data in 16 CPU states
frame without the help of CPU (Normal operation). (one state of the state diagrams). Each CPU state is two
oscillator periods. At an oscillator frequency of
Maximum data rate using this feature is limited primar- 12 MHz, the CPU clock is 6 MHz, and 16 CPU states
ily by the number of instructions needed to be executed is 2.7 /J-s. At a 3 Mbit rate with no zero-insertion/dele-
during the standby mode. tion, there is exactly enough time to execute one state
per byte (16 states at 6 MHz = 8 bits at 3M baud). In
Transmission or reception of a frame can be timed out other words, the standby time is zero.
so that the CPU will not hang up in the transmit or
receive procedures if a frame is aborted. Or, if the data Figure 6 demonstrates portions of the timing relation-
rate allows enough time (standby time is long enough), ship between the byte processor and the bit processor.
the CPU can monitor the SIUST register for idle mode In each state, the actions taken by the processors, plus
(SIUST = OIH). the contents of the SIUST register, are shown. When
the byte processor is running, the contents of SIUST
It is also possible to transmit multiple opening or clos- are unknown. However, when it is in the standby mode,
ing flags by forcing the byte processor to repeat the its contents are determinable.
END-FLAG state.
The maximum data rate for transmitting and receiving
long frames depends on the number of instructions
needed to be executed during standby, and is propor-
BIP:
:J<
CRTL BYTE - SR
X 1st I-BYTE - SR X 2nd I-BYTE -.- SR
K:
BYP: :J<SR-TMPX STANDBY
X
SR~ RCB X STANDBY X SR - FIFOO ~
~______~CO_N_T_RO_L______~X~______
STATE: FLAG
X ADDRESS·
X
15-35
FLEXIBILITY IN FRAME SIZE WITH THE 8044
tional to the oscillator frequency. The time the byte 5.2 Auto Mode
processor is in the standby mode, waiting for the bit
processor to deliver a processed byte, is at least equal to In the Auto mode, the 8044 can only be a secondary
eight serial clock periods minus 16 CPU states. If an station operating in the SOLC "Normal Response
inserted zero is in the block of data, the bit processor Mode". The 8044 in Auto mode does not transmit mes-
will process the byte in nine serial clock periods. sages unless it is polled by the primary.
The equation for theoretical maximum data rate is giv- For transmission of an information frame, the CPU al-
en as: locates space for the transmit buffer, loads the buffer
with data, and sets the TBF bit. The SIU will transmit
(2TCLCL) x (16 states) + (iI' of instruction cycles) x the frame when it receives a valid poll-frame. A frame
. (12TCLCL) = (BTOCy) Equation (1) whose poll bit of the control byte is set, is a poll-frame.
The poll bit causes the RTS bit to be set. If TBF were
Where: TCLCL is the oscillator period. not set, the SIU would respond with Receive Not
TOCY is the serial clock period. Ready (RNR) SOLC command if RBP = 1, or with
Receive Ready (RR) SOLC command if RBP = O.
At an oscillator frequency of 12 MHz and baud rate of After transmission RTS is cleared, and· the CPU is not
375 Kbps, about 18 instruction cycles can be executed interrupted.
when the byte processor is in the standby mode. At a
9600 baud rate, there is time to execute about 830 in- For reception, the procedure is the same as that of
struction cycles-plenty of time to service a long inter- Flexible mode. In addition, the SIU sets the RTS bit if
rupt routine or perform bit-manipulation or arithmetic the received frame is a poll-frame (causing an automat-
operations on the data while transmission or reception ic response) and increments the NS and NR counts
is taking place. accordingly.
15-36
infef FLEXIBILITY IN FRAME SIZE WITH THE 8044
~
FLAG F-I BYTE-FCS-F
ADDRESS BYTE
1
.~
INFORMATION
BYTES .~
1 CONTROL BYTE
INFORMATION
PRIMARY
F-255 I BYTES-FCS-F
SECONDARY
BYTES 292019-10
system, one secondary is chosen to simplify the primary (DATA) being connected to pin 14 (TO). In the pri-
station's software and focus on the long frame software mary station, the 8044 is "interrupted when activity is
code. Both the primary and the secondary stations are detected on the communication line by the on-chip tim-
in Flexible mode and the external clock option is used er. (in counter mode). This is explained more later. The
for the serial channel. The maximum data rate is serial clock to both stations is supplied by a pulse gen-
500 Kbps. The FCS bytes are generated and checked erator. The output of the pulse generator (not shown in
automatically by both stations. the diagram) is connected to pin 15 of the 8044s. Since
the two stations are located near each other (le~s than 4
feet), line drivers are not used.
6.1.1 POLLING SEQUENCE
The polling sequence, shown in Figure 8, takes place The central processor of each station is the 8044. The
continuously between the primary and the secondary data link program is stored in. a 2Kx8 EPROM
stations. The primary transmits a frame with one infor- (2732A), and a 2Kx8 static RAM (AM9128) is used as
mation byte to the secondary. The information byte is the external transmit and receive buffer. The RTS pin is
used by the secondary as an address byte. The second- connected to the CTS pin. For simplicity, the stations
ary checks the received byte, and if the address are assumed to be in the SDLC Normal Respond Mode
matches, the secondary responds with a long frame. In after Hardware reset.
this example, the information field of the frame is cho-
sen to be 255 bytes long. Since there is only one second- 6.1.3 PRIMARY STATION SOFTWARE
ary station, the address always matches. Upon success-
ful reception of the long frame, the primary transmits .The assembly code for the primary station software is
another frame to the secondary ~tation. listed in Appendix A. The primary software consists of
the main routine, the SIU interrupt routine, and the
receive interrupt routine. The receive interrupt routine
6.1.2 HARDWARE is executed when a long frame is being received.
The schematic of the secondary station is given in Fig-
ure 9. The circuit of the primary station is identical to In the flow charts that follow, all actions taken by the
the secondary station with the exception of pin 11 SIU appear in squares, and actions taken by the on-chip
CPU appear in spheres.
15-37
j "' ~!'::1-<iI,;~" 1 --l ~
~".~
I
~
~,
ADO-7
~ '~ •..
I
l
,~ ~ OO,,~
,;.. "' "00
~ ~"
AM9128
10pF I ---,
828L....., 19 AO Al 7 Al 01 '11 02
1
SWI "' , 5 00 00 ,.. ""'" " '"
~
~---J.
tl ~400 1'
- '
~'''' ~ "~,,.
,.Xl
I" I"
'"""i91
- '."
"'''
A01, -- 02
"
02
~.
.;. '"
3 012
00'"
002. 1 "6 A3
;;: "
A4
~
'"
4 A4
",,~
04 15
"
OS
.,,~,/- oo~
M. '" "" " M .. '..
R2 .!. '" " " . " " 00. " " .. '.. "" 00
~ ~
- -",,, '" "" '" M " '., " "11
[= -'"'' ""'; '" """ ., .. ,,- .. J;;
I .. " .. ><
~
. -'" 00 00 '" ""
'"
c"
t: A07, OE 1 Al0 19 Al0
6i
F
iiJ '\7 r 2-!.o WE
~
.
11 STB
~
------ lll1J",,, " , --, • 00 5:
"~"",
(J1 DI
Cu
00
<UI In
en
1
~"" .~""
00 '.. "
a
0"
...---
,..L,
-. ", " ..
'" _"
M ,
'.. "00,,,,,
'" " N
In
:::I.
:J:
.L "', "'" '., :e:::::j
DI "'" v "'J '.. " '.. '" ::z::
I A4
A5
A6
~
~
A4
A5
2 A6
. 04
05
06
'15
'16
'17
05
os
ii7
-I
::z::
In
CI)
o
"'"'""
A7 -;- A7
-::- 07 , ---4
A8 - .1.2 A8
A9 ~ A9
Al0 ~ Al0
.2!.. All
All
L----~--~==_~18~ CE
- 20 OE
~ l J
292019-11
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
Main Routine tasks. After reception of the long frame, the SIU inter-
rupt routine is executed again. This time, RTS, TBF,
First, the chip is initialized (see Figure 10). It is put in and RBE are set for another round of information ex-
Flexible mode, externally clocked, and "Flag-Informa- change between the two stations.
tion Field-FCS-Flag" frame format. Pre-Frame Sync
option (PFS = I) and automatic Frame Check Se- SIU never interrupts while reception or transmission is
quence generation/detection (NFCS = 0) are selected. taking place. The SIU registers are updated and the SI
The on-chip transmit buffer starts at location 20H and is set (serial interrupt) after the closing flag has been
the transmit buffer length is set to 1. This one byte received or transmitted. An SIU interrupt never occurs
buffer contains the address of the secondary station. if the receive interrupt routine or the transmit subrou-
There is no on-chip receive buffer since the long frame tine is being executed.
being received is moved to the external buffer. The
RTS, TBF, and RBE bits are set simultaneously. Set- Setting the RBE bit of the STS register puts the RUPI
ting the RTS and TBF bits causes the SIU to transmit in the receive mode. However, the jump to the receive
the contents of the transmit buffer. interrupt routine occurs only when a frame appears on
the serial port. Incoming frames can be detected using
the Pre-Frame Sync. option and one of the CPU timers
in counter mode. The counter external pin (TO) is con-
nected to the data line (pin 11 is tied to pin 14). Setting
the PFS (Pre-Frame Sync.) bit will guarantee 16 tran-
sitions before the opening' flag of a flame.
292019-12
Main Program
Figure 10. Primary Station Flow Charts
15-39
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
The counter registers are initialized such that the coun- 2) Monitor the SIUST register for standby in the
ter interrupt occurs,before the opening flag of a frame. PUSH-I state (SIUST = 18H). When the SIUST
When the PFS transitions appear on the, data line, the contents are 18H, the byte processor is waiting for
counter overflows and interrupts the CPU., The CPU the first information byte. The bit processor has al-
program jumps to the timer interrupt service routine ready recognized the flag and is processing the first
and executes the receive routine. In the receive routine, , information byte.
the received frame, isprocessed,and the information 3) In the standby mode, move the byte processor into
bytes are moved to the external RAM. Note that the the CONTROL state by writing "EFH" (comple-
maximum count ni.te of the 8051 counter is '124 of the ment of 10H) into the SIUST register. When the
oscillator frequency. At 12 MHz, the data rate is limit- next' byte boundary occurs, the bit processor has
ed to 500 Kbps. processed and moved a byte of data into the SR
register. The byte processor moves the contents of
Another method to detect a frame on the data line and SR into the RCB register, jumps to the PUSH-I
cause an interrupt is to use an external "Flag-Detect" state (SIUST ,;; 18H), and waits.
circuit to interrupt the CPU. The "Flag Detect" circuit
can be an 8-bit shift register plus some TTL chips. If 4) Monitor the SIUST register for standby in the
this option is used, the RUPI must operate in externally PUSH-l state. When the contents of SIUST be-
clocked mode because the clock is ,needed to shift the comes 18H, the contents of RCB are the first infor-
incoming data into the shift register. With this option, mation byte of the information field.
the maximum data rate is ,not limited by the maximum 5) While the byte processor is in the standby mode,
count rate of the 8051 counter. , move the contents of RCB to an external RAM or
an I/O port.
Receive Interrupt Routine 6) Check for the end of the information field. The end
can be detected by knowing the number of bytes
In Normal operation, the byte processor executes the transmitted, or by having a unique character at the
procedures of the FLAG state, jumps to the CON- end of information field. The length of the informa-
TROL state without going into the standby mode, and tion field can be loaded into the first byte(s) re-
executes 10-2 procedure of the state (see Figure 4). It ceived. The receive routine can load this byte into
then jumps to the PUSH-l state and goes into the the loop counter. ,
standby mode. At the following byte boundaries, the 7) If the byte receiv~ is not the last information byte,
byte processor executes the PUSH-I, PUSH-2, and move the byte processor back to standby in the
DMA-LOOP states, respectively. The receive interrupt CONTROL state and repeat steps 4 through 6. Oth-
routine as, shown iii the flow chart of Figure 12 and erwise, return from the interrupt routine.
described below forces the byte processot'to repeatedly
execute the CONTROL state before the PUSH-l state Upon returning from the receive interrupt routine, the
is executed. The following is the step by step procedure byte processor automatically executes the PUSH-I,
to receive long frames: PUSH-2, and DMA-LOOP before it stops. This causes
1) Turn off the CPU counter and save all the impor-, the remaining information bytes (if any) to be stored in
tant registers. Jump to the receive interrupt routine, the internal RAM at the starting location specified by
execution of the instructions to save regIsters, and the contents of RBS register. At the end of the cycle,
initialization of the receive buffer pointer take place the closing flag and the CRC bytes are left in the FIFO.
while the Pre-Frame Sync bytes and the opening The RFL register will be incremented by the number of
flag are being received. This is about three data byte bytes stored in the internal RAM. Then, the STS and
periods (48 CPU cycles at 500 Kbps). NSNR registers are updated, and an appropriate re-
sponse is generated by the SIU.
15-40
FLEXIBILITY IN FRAME SIZE WITH THE 8044
Main Routine
As shown in the secondary station flow chart (Figure
13), the external transmit buffer (external RAM) is
loaded with the information data (FFH, FEH, FDH,
... ) at starting location 200H. The internal transmit
buffer (ori chip RAM) starts at location 20H (TBS =
20H), and the transmit buffer length (TBL) is set to 1.
The on-chip CPU, in the transmit subroutine, moves
the information bytes from the external RAM to this
one byte buffer for transmission. The receive buffer
starts at location IOH and the receiver buffer length is
1. This buffer is used to buffer the frame transmitted by
the primary. The received byte is used as an address
byte.
15-41
intJ FLEXIBILITY IN FRAME SIZE WITH THE 8044
= 1. FRAME XMlmD
292019-15
292019-16
Main Program SIU Interrupt
Figure 13. Secondary Station Flow Charts Figure 14. Secondary Station Flow Charts
If they match,thesecondary will call the transmit sub· While the bit processor is transmitting the first Pre·
routine to transmit the long frame. Upon returning Frame Sync byte, the byte processor executes the PFS2
from the transmit subroutine, the RBE bit is set, and state and jumps to the standby mode in the FLAG
program returns from the SIU interrupt. Mter trans· state. The FLAG state is executed when the bit proces·
mission of the closing flag, sm interrupt occurs again. sor begins to transmit the sec9nd Pre·Frame Sync byte.
In the interrupt routine, the RBE is checked. Since the When the flag is being transmitted, the byte processor
RBE is' set, the program returns from the SIU interrupt executes the 98-1, 98-2, 98-3, and 98-4 procedures of
routine and waits until another long frame is received. the FLAG state, and jumps to execute the A8-1 proce-
dure of the CONTROL state. When the opening flag is
If the secondary were in Auto mode, the chip must be transmitted, the contents of RB are the fttst informa-
ready to execute the transmit routine upon reception of tion byte. (See transmit state diagram.)
a poll·frame; otherwise, the chip automatically trans·
mits the contents of the internal transmit buffer if the In the transmit subroutine (see Figure 15), the byte
TBF bit is set, or transmits a supervisory command processor is forced to repeat the CONTROL state be-
(RR or RNR) if TBF is clear. fore the DMA-LOOP state. In the CONTROL state,
the contents of a RAM location addressed by the TBS .
Transmit Subroutine register are moved to the RB register. The following is
the step by step procedure to transmit long frames:
In Normal operation the byte processor executes the 1) Put the chip in transmit mode by setting the ins
START·TRANSMIT state and jumps to the PFSI and TBF bits.
state. While the bit processor is transmitting some un· 2) Move an information byte from external RAM to a
wanted bits, the byte processor executes the PFSI state location in the internal RAM addressed by the con-
and jumps to the standby mode in the PFS2 state. tents of TBS.
15-42
infef FLEXIBILITY IN FRAME SIZE WITH THE 8044
PRIMARY
STATION
SECONDARY SECONDARY
STATION STATION
292019-18
PRIMARY
SECONDARY SECONDARY
292019-19
Figure 17. POlling Sequence Between the Primary and Secondary Stations
15-44
1 , ~
~"~,IH,' 'U.... "" ~, ~
AOO-7
(
~ ~" ~~ ~"~
I , '"
." ,~, ~~
,. ,;" .11 • , M"
' At.l91280 0 " "
1
SWI
~ SJ ..
l-~."~400 1 ~,,~,
""• ~ """" "~~ '" "",
"'" '" -!c' '" """"
....
" ., .. " !.
",,~~
0 0"
"0 0
'I' - = -
00 M '"
~'M'" ~~ ~~
". '" '''''" M M 'M "..
~::
U1 1\1 - - - - - -..
1 1111!J " ' ' ' " , ---, • "
"'"
m
U1 '<
rn en
io
:J
:J: SCLKOATA
,.l,
'-::::! -:-
rV ~ :: :: .::
''',,,
AII
J ." -"
~ -."
::
'-~A3'~ • A3
::::::l-
'" ,..
03 I:: "' 0;.-
N
m
:e:::j
...a.
1\1
::I:
~
~ M ~ A4 04 I 15 ii5 ::I:
iiJ A5 ~ A5 05 I 16 ii6 m
co
I A6 2 A6 06 I 17 D7 o
I A7 1 A7 07 --111 ./:100
./:100
A8-
.
22
-::- A8
rA9 ~A9
AIO ...2.9 AIO
All 21 All
20 or
L---------------===-~1~8 CE
V L J
292019-20
infef FLEXIBILITY IN FRAME SIZE WITH THE 8044
.6.2.3 PRIMARY SOFTWARE The station address register (STAD) is loaded with ad-
dress of one of the secondary stations. The RTS, TBF,
and RBE bits of the STS register are simultaneously set
Main Routine, and a call to the transmit routine follows. The transmit
During initialization (see Figure 19), the 8044 is set to routine transmits the contents of the external transmit
Flexible mode, internally clocked at 375 Kbps, and buffer. At the end of transmission, RTS and TBF are
configured to handle standard SDLC frames. The on- cleared by the SIU, and SIU interrupt occurs. In Flex-
chip receive and transmit buffer starting addresses and ible mode, SIU interrupt occurs after every transmis-
lengths are selected. The external transmit buffer is sion or reception of a frame.
chosen from physical location 200H to location 2FFH
(255 bytes). The external transmit buffer' (external SIU Interrupt Routine
RAM) is loaded with data (FFH, FEH, FDH, FCH,
... OOH). Timer 0 is put in counter mode and set to In the SIU interrupt service routine (see Figure 20), SI
priority I. The counter register (TLO) is loaded such is cleared and the RBE bit is checked. If RBE is set, a
that interrupt occurs after 8 transitions on the data line. long frame has been transmitted. The first time through
The Pre-Frame Sync option (setting bit 2 of the SMD the SIU interrupt service routine, the RBE test indi-
register) is selected to guarantee at least 16 transitions cates a long frame has been transmitted to one of the
before the opening flag of a frame. secondary stations. Therefore, the Counter is initialized
292019-21 292019-22
Main Program SIU Interrupt
Figure 19. Primary Station Flow Charts Figure 20. Prirriary Station Flow Charts
15-46
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
and turned on. The program returns from the interrupt The secondary is configured to transmit an Information
routine before a frame appears on the communication frame every time it is polled. The RTS pin is inverted
channel. and tied to INTI pin. External interrupt 1 is enabled
and set to interrupt on low to high transition of the
When a frame appears on the communication line, RTS signal. This will cause an interrupt (EXI set) after
counter interrupt occurs and the receive routine is exe- a frame is transmitted. In the interrupt routine the CTS
cuted to move the incoming bytes into the external pin is cleared to prevent any automatic response from
RAM. After reception of the frame and return from the the secondary. If the CTS pin were not disabled, the
receive routine, SIU interrupt occurs again. secondary station would respond with a supervisory
frame (RNR) since the TBF is set to zero by the SIU
In the SIU interrupt routine, RBE is checked. Since the due to the acknowledge. In the SIU interrupt routine,
RBE bit is clear, a frame has been received. Therefore, the CTS pin is cleared after the TBF bit is set. If this
the appropriate NS and NR counters are incremented option is not used, the primary should acknowledge the
and loaded into the TCB register (two pairs of internal previously received frame and poll for the next frame in
RAM bytes keep track of NS and NR counts for the two separate transmissions.
two secondary stations). Transmission of a frame to the
next secondary station is enabled' by setting the RTS
and the TBF bits. The chip is also put in receive mode SIU Interrupt Routine
(RBE set), and a call to transmit routine is made. After When a frame is received, counter 0 iiIterrupt occurs
transmission, SIU interrupt occurs again, and the pro- and the receive routine is executed (see Figure 22). If
cess continues. the incoming frame is addressed to the station, the in-
formation bytes are stored in external RAM; Other-
6.2.4 SECONDARY SOFTWARE wise, the program returns from the receive routine to
perform other tasks. At the end of the frame, SIU inter-
rupt occurs. In Auto mode, SIU interrupt occurs when-
Main Routine ever an Information frame or a supervisory frame is
Both secondary stations have idep.tical software (Ap- received. Transmission will not cause an interrupt. In
pendix B). The only differences are the station address- the SIU interrupt service routine, the AM bit of the
es. Contents of the STAD register are 55H for one sta- STS is checked.
tion and 44H for the other.
If AM bit is set, the interrupt is due to a frame whose
address did not match with the address of the station.
In this case, NFCS, AM, and the BOY bits are cleared,
the RBE bit is set, the counter 0 is initialized and
turned on, and program returns from the interrupt rou-
tine.
SET UP ~XTERNAL AND INTERNAL
TRANSMIT AND RECEIVE BUFFERS If AM bit is not set, a valid frame has been received and
stored in the external RAM. TBF bit is set, CTS pin is
activated, counter 0 is disabled and a call to transmit
routine is made which transmits the contents of exter-
nal transmit buffer. This frame also acknowledges the
reception of the previously received frame (NS and NR
are automatically incremented). Upon return from the
transmit routine RBE is set and counter 0 is turned on,
thereby putting the chip in the receive mode for anoth-
er round of data exchange with the primary.
15-47
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
6.2.5 RECEIVE INTERRUPT ROUTINE If the address byte matches the station address, the byte
processor is moved to the CONTROL state again. This
Assembly code for the receive interrUpt routine can be time, after execution of the CONTROL state the con-
found in both primary and secondary software (Appen- tents of RCB are the received control byte. .
dix B). The receive interrupt routine of the primary
station is very similar to that of the primary station in CPU investigates the type of received frame by check-
example 1. In the following two sections the receive and ing the received control byte. If the receiving frame is
transmit routine of the secondary stations are dis- not an information frame (i.e. Supervisory frame), exe-
cussed. cution of receive routine will be terminated to free the
15-48
(
SET BOV
"11
ci
,~, ",,,-,m ,~'". ~
SET SI
"TI
r-
c m
iil SUP-REeVED ><
I\) m
~
:II
r=
1\1 =i
n
1\1
<
<"
1\1
Z
"TI
::!l :lI
..... 0::e ~
3:
~ 0 m
CD
..-
:T
II)
'iii
rJ)
N
m
1\1
n
0
~ =i
==
..a.
DI
::t
-t
--
'<
1/1
DI
0'
.2-
::t
m
011
Q
"..
"..
292019-25
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
CPU. In Auto mode, the SIU checks the control byte byte from external RAM to the internal RAM location
and responds automatically in response to the supervi- addressed by TBS. The byte processor is then moved to
sory frame. CONTROL state. This will cause the byte processor, in
the next byte boundary, to move the contents of the
After the control byte is received, it is saved in the same location in the internal RAM to the RB register
stack. The byte processor is moved to the CONTROL (see transmit state diagram.)
state so that the next incoming byte will also be loaded
into the RCB register. The byte processor remains in When this byte is being transmitted, the byte processor
CONTROL state until a byte is processed by the bit jumps to the DMA-LOOP state (SIUST = BaH) and
processor and moved to SR. The byte processor is then waits. When the DMA-LOOP state is reached (CPU
triggered to move the contents of SR to the RCB regis- monitors SIUST for BOH), the CPU loads the next In-
ter. The CPU monitors SIUST and waits until the first formation byte into the same location -in the internal
Information byte is loaded into the RCB register. RAM and moves the byte processor to the CONTROL
state before it gets to execute the DMA-LOOP state.
When byte processor reaches the PUSH-I state (SIUST Note that the same location in the internal RAM is
= ISH), RCB contains the first Information byte. The used to transmit the subsequent Information bytes.
byte is moved to external RAM (receive buffer), and
the byte processor is moved back to the CONTROL When all the Information bytes from the external
state. The process continues until all of the Information RAM are transmitted, the byte processor is free to go
bytes are received. When all the Information bytes are through the remaining states so that it will transmit the
received, the program returns from the routine. The FCS bytes and the closing flag.
byte processor automatically goes through the remain-
ing states, updates the STS register, and interrupts the
CPU as it would in Normal operation. 7.0 CONCLUSIONS
The RUPI, with addition of only a few bytes of code,
6.2.6 TRANSMIT SUBROUTINE can accept and transmit large frames with some com-
promise in the maximum data rate. It can be used in
The transmit subroutine codes can be found in the pri- Auto or Flexible mode, with external or internal clock-
mary and the secondary software (Appendix B). The , ing, automatic CRe checking, and zero bit insertion/
transmit subroutines of the Primary and secondary sta-, deletion. In addition, almost all of the internal RAM is
tions are identical. A call to transmit routine is made available to be used as general purpose registers, or in
when the R TS and TBF bits of the STS register are set. conjunction with the external RAM as transmit and
In Auto mode, RTS is set automatically upon reception receive buffers.
of a poll-frame (poll bit of the control byte is set).
All in all, this feature opens up new areas of applica-
In the transmit routine (see Figure 15), the starting ad- tions for this device. Besides transmitting/receiving
dress and the transmit buffer length of the external long frames, it may now be possible to perform arith-
buffer are set. Then the CPU moiritors the SIUST regis- metic operations or bit manipulation (e.g. data scram-
ter for CONTROL state (SIUST = ASH). In the bling) while transmission or reception is taking place,
CONTROL' state the bit processor transmits the con-
resulting in high throughput. Transmission of continu-
trol byte, while the byte processor goes into the standby ous flags and transmission with no zero insertion are
mode after it has moved the contents of a location in also possible.
the internal RAM addressed by the contents of Trans-
mit Buffer Start (TBS) register to the RB register. In addition to unlimited frame size, an on-chip control-
ler, automatic SDLC responses, full support of SDLC
While the control byte is being transmitted' and the byte
protocol, 192 bytes of internal RAM, and the highest
processor is in standby, the CPU moves an Information data rate in self clocked mode compared to other chips
make this product very attractive. '
15-50
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
APPENDIX A
LISTING OF SOFTWARE MODULES
FOR APPLICATION EXAMPLE 1
$DEBUG NOMOD5l.
$INCLUDE (REG44.PDF)
ASSEMBLY CODE FOR PRIMARY STATION (POINT TO POINT)
FLEXIBLE MODE; FCS OPTION
ORG DOH LOCATIONS 00 THRU 26H ARE USED
SJMP INIT BY INTERRUPT SERVICE ROUTINES.
ORG OBH VECTOR ADDRESS FOR TlMERO INT.
JMP REC
ORG 23H VECTOR ADDRESS FOR SIU INT.
SJMP SIINT
; •• ***.*************** INITIALIZATION **** ••• ** ••••• ***.*** •••••
ORG 26H
INIT: MOV SMD, '00000110B EXT CLOCK; PFS=NB~l
MOV TBS,#20H INT TRANSMIT BUFFER START
MOV TBL,tOlH INT TRANSMIT BUFFER LENGTH
MOV 20H,#55H STATION ADDRESS
MOV THOD,'OOOOOlUB COUNTER FUNCTION; MODE
MOV IE,nOOlOOl.OB EA=l; SI=l.; ETO=l
MOV STS,#l.ll.OOOOOB TRANSMIT A FRAME
DOT: SJMP DOT WAIT FOR AN INTERRUPT
SIU TRANSMITS THE PFS BYTES, THE OPENNING FLAG, THE CONTENTS
OF LOCATION 20H, THE CALCULATED FCS-BYTES, AND THE CLOSING
FLAG. AT THE END OF TRANSMISSION, SIU INTERRUPT OCCURS.
;************* SERIAL CHANNEL INTERRUPT ROUTINE *.*.* •• *******.*
SIINT: CLR 81
JNB RaE,RECVED TRANSMITTED A FRAME ?
MOV TLO,'OF8H YES, INITIALIZE COUNTER REGISTER
MOV DPTR,'200H EXT RAM RECEIVE BUFFER START
MOV R5,'OFFH EXT RAM RECEIVE BUFFER LENGTH
SETS TRO TURN ON COUNTER 0
RETI RETURN 292019-28
WHEN A FRAME APPEARS ON THE SERIAL CHANNEL, COUNTER (RECEIVE)
INTERRUPT OCCURS. AFTER SERVICING THE INTERRUPT ROUTINE, SID
INTERRUPT OCCURS.
RECVED: MOV STS, 'l.ll.OOOOOB TRANSMIT A FRAME
RETI RETURN
15-51
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
$DEBUG NOMOD51
$INCLUDE (REG44.PDF)
ORG OOH
SJIIP INIT
ORG 23H ; VECTOR ADDRESS FOR SIU INT.
SJIIP SIINT
SIINT: CLR SI
JB RBE, RETlIN RECEIVED A FRAME?
HOV A,STAD YES
CJNE A,20H,NKACH STATION ADDRESS MATCHED?
ACALL TRAN YES, CALL TRANSMIT SUBROUTINE
15-52
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
APPENDIX B
LISTING OF SOFTWARE MODULES
FOR APPLICATION EXAMPLE 2
$DEBUG NOMODSl
$INCLUDE (REG44.PDF)
15-53
inter FLEXIBILITY IN FRAME SIZE WITH THE 8044
15-54
FLEXIBILITY IN FRAME SIZE WITH THE 8044
$DEBUG NOHODSl
$INCLUDE (REG44. PDF)
ASSEMBLY CODE FOR SECONDARY STATIONS (MULTIPOINT)
AUTO MODE; FCS OPTION
ORG OOH
SJHP INIT
ORG OBH VECTOR ADDRESS FOR TlHERO INT.
JHP REC
ORG 13H VECTOR ADDRESS FOR EXT. INT. 1
JHP XINTl
'ORG 23H VECTOR ADDRESS FOR SIU INTERRUPT
JHP SIINT
,********········***INITIALIZATION •••••••••••••••••••••••••••
ORG 26H
INIT: MOV SMD,U1010100B INT. CLKED @ 375KINRZI-l;PFS-l
HOV STAD,'SSH STATION ADDRESS; STAD-44H FOR THE
OTHER STATION
MOV RDS,UOH INT. RAN RECEIVE BUFFER START
MOV RBL, 'OOH INT. RAN RECEIVE BUFFER LENGTH
MOV Rl,#20H
MOV TBS,Rl INT. RAN XKIT BUFFER START
MOV TBL, 'OlH INT. RAN XKIT BUFFER LENGTH
MOV NSNR,tOOH NS~NR-O
MOV TCON,#OOOOOlOOBEXT. INT.: EDGE TRIGGERED
MOV IE,'OOOlOllOB SI~l; ETO~l; EXO=l
MOV IP"OOOOOOlOB TlHER 0: PRIORITY 1
MOV THOD,#OOOOOllB COUNTER FUNCTION: MODE
MOV STS,t01000010B RECEIVE I-FRAME.
MOV TLO"OF8H SET COUNTER TO OVERFLOW
AFTER B COUNTS
5ETB TRO TURN ON COUNTER
SETB EA I ENABLE ALL INTERRUPTS
DOT: SJHP DOT I WAIT FOR AN INTERRUPT. 292019-37
I CPU IS INTERRUPTED AT THE END OF RECEPTION (51 SET), AND AT.
; THE END OF LONG-FRAME TRANSMISSION (EXO SET). •
,****** •• *******EXTERNAL INTERRUPT •••••••••••••••••••••••••••
XINT1: SETB Pl. 7 ; DISABLE CTS PIN
RETI ; RETURN.
;•• *•••••••••••• SERIAL INTERRUPT ROUTINE ••••••••••••••••••••
SIINT: CLR SI
JB AM,HOP ADDRESS MATCHED?
CLR EA DISABLE ALL INTERRUPTS
MOV STS,#OlOOOOlOB RBE-l; NB=l
~OV TLO,#OF8H
SETB TRO TURN ON COUNTER 0
SETS EA ENABLE ALL INTERRUPTS
RETI RETURN.
;
HOP: JB TBF,GETI A FRAME TRANSMITTED?
SETB TBF ENABLE TRANSMISSION OF I-FRAME
CLR Pl.7 ENABLE CTS PIN
ACALL TRAN CALL TRANSMIT ROUTINE
GETI.: JB RBE,RETURN A FRAME RECEIVED?
CLR EA DISABLE ALL INTERRUPTS
SETB RBE PUT RUPI IN RECEIVE MODE
MOV TLO, ,OF8H
SETB THO TURN ON COUNTER 0
SETB EA ENABLE ALL INTERRUPTS
RETURN: RETI RETURN. 292019-38
,*.* •••••••••••••• TRANSMIT SUBROUTINE *.* ••••••••••••••••••••
TRAN: MOV DPTH,UOOH EXT. RAN TRANSMIT BUFFER START
MOV RS"OFFH EXT. RAN TRANSMIT BUFFER LENGTH
MOV A"OABH CONTHOL STATE
WAIT: CJNE A,SIUST,WAIT WAIT FOR CONTROL BYTE TRANSMISSION
MOVX A,@DPTR MOVE DATA FROM EXT. RAN TO ACC.
MOV @Rl,A MOVE DATA INTO INT. RAN AT @TDS
INC DPTH INCREMENT POINTER
DJNZ RS,NXTI IS IT THE LAST I-BYTE ?
MOV SIUST, '57H XMIT THE LAST I-BYTE
RET RETURN.
NXTI: MOV SIUST,157H KEEP "BYP" 'IN CONTROL STATE
MOV A,'OBOH DHA-LOOP STATE
JHP WAIT TRANSMIT THE NEXT BYTE
292019-39
15-55
FLEXIBILITY IN FRAME SIZE WITH THE 8044
15-56
intJ ARTICLE
REPRINT
AR-307
NOVEMBER 1983
January 1985
© INTEL CORPORATION ORDER NUMBER 230876-001
230876-1
15-57
intJ AR-307
INTRODUCTION What will the end user pay for the added value pro-
Today microcontrollers are being designed into vided by communications? The cost of the com-
virtually every type of equipment. For the household, munications hardware is not the only additional cost.
they are turning up in refrigerators, thermostats, There will be performance degradation in the main
burglar alarms, sprinklers, and even water softeners. application because the microcontroller now has
At work they are found in laboratory instruments, additional tasks to perform. There are two extremes
copiers, elevators, hospital equipment, and t~lephones. to the cost of adding communication capability. One
In addition, a lot of microcomputer equipment con- could spend very little by adding an I/O port and have
tains more than orie microcontroller. Applications the CPU handle everything from the baud rate to the
using multiple microcontrollers as well, as the office protocol. Of course the main application would be
and home, are now faced with the same requirements idle while the CPU was communicating. The other ex-
that laboratory instruments were faced with 12 years treme would be to add another microcontroller to
ago - they need to connect them together and have the system dedicated to communications. This
them communicate. This need was satisfied in the communications processor could interface to the main
laboratory with the IEEE-48B General· Purpose CPU through a high speed parallel link or dual port
Instrumentation Bus (GPIB). However, GPIB does RAM. This approach would maintain system per-
not meet the current design objectives for network- formance, but it would be costly.
ing microcontrollers.
Today there are many communications schemes and Adding HDLe/SDLC Networking Capability
protocols available; some of the popular ones are Figure I shows a microcamputer system with a can-
GPIB, Async, HDLC/SDLC, and Ethernet. Common ventianal HDLC, SDLC cammunications salutian.
design objectives of today's networks are: low cost, The additional hardware needed to realize the con-
reliable, efficient throughput, and expandable. In ventional design is: an HOLC SOLC communicatian
examining available solutions, GPIB does not meet chip. additional ROM for the communicatian saftware.
these design objectives; first, the cable is too expen- part af an interrupt cant railer. a baud rate generatar. a
sive (parallel communications), second, it can only be phase lacked laap. NRZI encaded decader. and a
cable driver lacked loap are used when the transmitter
used over a limited distance (20 meters), and third,
it can only handle a limited number of stations. For daes nat send the clack an a separate line fram the data
general networking, serial communications is (i.e. aver telephane lines. ar two. wire cable). the NRZI
encader decader is used in HOLC SDLC to. combine
preferable because of lower cable costs and higher
the clack into. the data line. A phase locked laap is used
reliability (fewer connections). While Ethernet pro-
to recaver the clock fram the data line.
vides very high performance, it is more of a system
backbone rather than a microcontroller interconnect.
Async, on the other hand, is inexpensive but it is not The majority of tire available communication chips
an efficient protocol for data block or file transfers. provide a limited number of data link control func-
Even with.some new modifications such as a 9 bit pro- tions. Most of them will handle Zero Bit Inser-
tocol for addressing, important functions such as tion/Deletion (ZBI/D), Flags, Aborts, Automatic
230876-2
15-58
inter AR-307
SERIAL
MICROCONTROLLER COMMUNICATIONS
SOLC/HOLe
BAUD
RATE
GENERATOR
address recognition, and CRC generation and check- require I LSI chip and about 10 TTL chips. The cost
ing. It is the CPU's responsibility to manage of CPU throughput degradation can be even greater.
link access, command recognition and response, The percentage of time the CPU has to spend servic-
acknowledgements and error recovery. Handling these ing the communication tasks can be anywhere from
tasks can take a lot of CPU time. In addition, servic- 10-1001170, depending on the serial bit rate. These high
ing the transmission and reception of data bytes can costs will prevent consumer acceptance of network-
also be very time consuming depending on the method ing microcomputer equipment.
used.
A Highly Integrated, High Performance Solution
The 8044 reduces the cost of networking micro-
U sing a D M A controller ca n increase the overall system
controllers without compromising performance. It
performance. since it can transfer a block of data in
contains all of the hardware components necessary to
fewer clock cycles than a CPU. In addition. the CPU
implement a microcomputer system with communica-
and the DMA controller can mUltiplex their access to
tions capability, plus it reduces the CPU and software
the bus so that both can be running at virtually the same
overhead of implementing HDLC/SOLC. Figure 2
time. However. both the DMA controller and the CPU
shows a functional block diagram of the 8044.
are sharing the same bus. therefore. neither one get to
utlize IOO~; of the bus bandwidth. Microcontrollers
available today do not support DMA. therefore. they
The 8044 integrates the powerful 80S I microcontroller
would have to use interrupts. since' polling is with an intelligent Serial Interface Unit to provide a
unacceptable in a multitasking environment.
single chip solution which efficiently implements a
distributed processing or distributed control system.
The microcontroller is a self sufficient unit contain-
In an interrupt driven, the CPU has overhead in ad- ing ROM, RAM, ALU and its own peripherals. The
dition to servicing the interrupt. During each inter- 8044's architecture and instruction set are identical to
rupt request the' CPU has to save all of the important the 80S 1~s. The Serial Interface Unit (SIU) uses
registers, transfer a byte, update pointers and bit synchronous HOLC/SOLCprotocol and can com-
counters, then restore all of its registers. At low bit municate at bit rates up to 2.4 Mbps, externally
rates this overhead may be insignificant. However, the clocked, or up to 37S Kbps using the on-chip digital
percentage of overhead increases linearly with the bit phase locked loop. The SIU contains its own pro-
rate. At high bit rates this overhead would consume cessor, which operates concurrently with the micro-
all of the CPU's time. There is another nuisance fac- controller.
tor associated with interrupt driven systems, interrupt
latency .. Too much interrupt latency will cause data The CPU and the SIU, in the 8044, interface through
to be lost: from underrun and overrun errors. 192 bytes of dual port RAM. There is no hardware
arbitration in the dual port RAM. Both processor's
The additional hardware necessary to implement the memory access cycles are interlaced; each processor'
communications solution, as shown in Figure I, would has access every other clock cycle. Therefore, there
230876-3
15-59
inter AR-307
I
1 SIU
1
,..------'-.., .1
I HDLC/SDLC
COMMUNICATIONS
PROCESSOR
8051
MICRO-
CONTROLLER
DMA
CONTROLLER
L __________ ___ _ ~
is no throughput loss in either processor as a result transmitted or received. Also, the nuisance of over-
of the dual pon RAM, and execution times are deter- run and underrun errors is totally eliminated since the
ministic: Since this has· always been the method for dedicated DMA controller is guaranteed to meet the
memory access on the 8051 microcontroller, 8051 pro- maximum data rates. Having a dedicated DMA con-
grams have the same execution time in the 8044. iroller means that the .serial channel interrupt can be
the lowest priority, thus allowing the CPU to have
By integrating all of· the .communication· hardware higher priority real time interrupts.
onto the 8051 microcontroller, the hardware cost of
the system is reduced. ·Now several chips have been Figure 3 sho'ws a c~mparison between the.conventionai
integrated into a single chip. This means that the and the 8044 solution on the percentage of time the
system power is reduced, P.C. board space is re- CPU must spend sending data. This diagram was
duced, inventory and assembly is reduced, and derive.d by assuming a 64 byte information frame is
reliability is improved. The improvement in reli- being transmitted repeatedly. The conventional solu-
ability is a result of fewer chips and interconnections tion is interrupt driven, and each interrupt service
on the P.C.board. routine is assumed to take about 15 instructions with
a I /oIsec instruction cycle time. At 533 Kbps, an in-
As·mentioned before, there can be two extremes in terrupt would occur every 15 usec. Thus, the CPU
a design which adds communications to the microcom- becomes completely dedicated to servicing the serial
puter system. The 8044 solution uses the high end ex- communications. The conventional design could not
treme. The SIU on the 8044 contains its own processor support bit rates higher than this because of under-
which communicates with the 8051 processor through runs .and overruns. For the 8044 to repeatedly send
dual port RAM and control/status registers. While 64 byte frames, it simply has to reinitiaIize the DMA
the SIU is not a totally independent communications controller. As a result, the 8044 can support bit rates
processor, it substantially offloads the 805 I processor up to 2.4 Mbps.
from the communication tasks.
Some of the other communications tasks the CPU has
Tbe DMA on the 8044 is dedicated to the SIU. It can- to perform. such as link access. command recogni-
not access external RAM. By having a DMA controller tion/response. and acknowledgements. are per-
in the SIU, the 8051 CPU is oftloaded. Asa result formed automatically by the SIU in a mode called
of the dual pon RAM design, the DMA does not share "AUTO;" The combination of the dedicated DMA
the running at full speed while .the frames are being controller and the AUTO mode. substantially offload
230876-4
15-60
inter AR-307
• CONCURRENT PROCESSING
CONVENTIONAL
SOLUTION
90
80
70
PERCENTAGE OF 60
CPU TIME SPENT 50
SERVICING SOLC 40
30
20 80.44
SOLUTION
1~~__-=====================~
250 K 500 K 750K 1M
BIT RATE (BITS/SECOND)
the CPU, thus allowing it ,to devote more of its power can directly set a bit Which communicates to the
to other tasks, primary what its transmit and receive buffering status
is.
8044's Auto Mode
In the AUTO mode'the SlU implements in hardware When the CPU wants to send a frame, it loads the
a subset of the SOLC protocol such that it responds . transmit buffer with the data, loads the starting
to many SOLC commands without CPU intervention. address and the COUrit of the data into the SIU, then
All AUTO mode responses to the primary station con- sets TBF to transmit the frame. The SIU waits for the
form to IBM's SOLC definition. In the AUTO mode primary station to poll it with a RR command. After
the 8044 can only be a secondary station operating the SIU is polled, it automatically sends the informa-
in SOLC specified "Normal Response Mode." tion frame to the primary with the proper control field.
Normal Response Mode means that the secondary The SIU then waits for a positive acknowledgement·
station· can not transmit unless it is polled by the from the primary before incrementing the Ns field and
primary station. The SIU in the AUTO mode can interrupting the CPU for more data. If a negative
recognize and respond to the. following SOLC com- acknowledgement is received, the SIU automatically
mands without CPU intervention: I (Information), RR retransmits the frame.
(Receive Ready), RNR (Receive Not Ready), REJ (Re-
ject), and for loop mode UP (Unnllmbered Poll). The When the 8044 is ready to receive information, the
.SIU can generate the following responses without CPU loads the receive buffer starting address and the
CPU intervention: I, RR, and RNR. In addition, the buffer length into the SIU, then.enables the receiver.
SIU manages Ns and Nr in the control field. If it When a valid information frame with the correct
detects an error in either Ns or Nr, it interrupts 'the address and CRe is received, the SIU will increment
CPU for error recovery. the Nr field, disable the receiver and interrupt the CPU
indicating that a good I frame has been received. The
How does the SIU know what responses to send to CPU then sets RBP, reenables the receiver and pro-
the primary? It uses two status bits which are set by cesses the received data. By enabling the receiver with
the CPU. The two bits are TBF (Transmit Buffer Full) RBP set, the SIU will automatically respond to polls
and RBP (Receive Buffer Protect). TBF indicates that with a Receive Not Ready, thus keeping the link
the CPU wants to send data, and RBP indicates that moving rather than timing out the primary from a
the receive data buffer is full. Table I shows the disabled receiver, or interrupting the CPU with
responses the SIU will send based on these two status another poll before it has 'processed the data. After
bits. This is an innovative approach to communica- the data has been processed, the CPU clears RBP,
tion design, The CPU in the 8044 with one instruction returning to the Receive Ready responses.
230876-5
15-61
AR-307
SDLC communications can be broken up into four In the Information Transfer State there are three com-'
states: Logical Disconnect State, Initialization State, mon events which occur as illustrated in Figure 4, they
Frame Reject State, and Information Transfer State. are: I) the primary polls the secondary and the secon-
Data can only be transferred in the Information dary is ready to receive but has nothing to send, 2)
Transfer State. More than 90070 of the time a station the primary sends the secondary information, and 3)
will be in the Information Transfer State, which is the secondary sends information to the primary.
where the SIU can run autonomously. In the other Figures 5, 6, and 7 compare the functions the con-
states, where error recovery, online/offline, and in- ventional design and the 8044 must execute in order
itialization takes place, the CPU manages the protocol. to respond to the primary for the cases in Figure 4.
PRIMARY
ISECONDARY I I SECONDARY I
Case 1. Primary polls secondary
secondary has nothing to send
. .
Command Response
RR
RR
Case 2. Primary polls secondary ,
secondary sends Information frame
Command Response
RR,NR ..
...
RR, NR+1 ..
Information frame
. .
RR, NR+1
Not~: RR = Recelv.e ready
15-62
intJ AR-307
CASE 1
8044 CONVENTIONAL
AUTO MODE PRIMARY DESIGN
-RR- Receive interrupts
Poll
Decode received control field
Check NR field
Load response into transmit control field
Send frame
Transmit interrupts
CASE 2
8044 CONVENTIONAL
·AUTO MODE PRIMARY DESIGN
Load transmit buffer Load transmit buffer and transmit
control byte
Set TBF bit
-.._ - RR _.- - 1 1...- Receive interrupts
poll Decode receive control byte
Check NR field
Send frame
Transmit interrupts
..........- - RR -___ Receive interrupts
poll Decode receive control byte
Transmit Interrupt Check NR field
Increment NS
15-63
inter AR-307
CASE 3
8044 CONVENTIONAL
AUTO MODE PRIMARY' DESIGN
----RR~ Receive interrupts
poll Decode received control field
Check NR field
Load response into transmit control
field
Send frame
Transmit interrupts
Receive interrupt ~Iframe_ Receive interrupts
Decode receive control field
Check NS NR fields
Increment NR
Load response into transmit control
field
Send frame
Transmit Interrupts
,
Using case 1 as an example, the conventional design . most critical parameter for calculating throughput on
first gets receive interrupts bringing the data from the any high speed network is the station turnaround time;
SOLC comm chip into memory. The CPU must then the time it takes a station to respond after receiving,
decode the command in the control field and deter- a frame. Since the 8044 handles all of the commands
mine the response. In addition, it must check the Nr and responses of the Information Transfer State in
field for any pending acknowledgements. The CPU hardware, the turnaround time is much faster than
loads the transmit buffer with the appropriate address handling it in software, hence a higher throughput.
and control field, then transmits the frame. When the
8044 receives this frame in AUTO mode, the CPU 8044's Flexible Mode
never gets an interrupt because the SIU handles the In the "NON-AUTO" mode or Flexible mode, the
entire frame reception and response automatically. SIU does not recognize or respond to any commands,
nor does it manage acknowledgements, which means
In SOLC networks, when there is no information the CPU must handle link access, command recogni-
transfers, case 1 is the activity on the line. Typically tion/response, acknowledgements and error recovery
this is 80010 of the network traffic. The CPU in the by itself. The Flexible mode allows the 8044 to have
conventional design would constantly be getting in- extended address fields and extended control fields,
terrupts and servicing the communications tasks, even thus providing HOLC support. In the Flexible mode
when it has nothing to send or receive. On the other the 8044 can operate as a primary station, since it can
hand, the 8044 CPU would only get involved in com- transmit without being polled.
municating when it has data to send pr receive.
Front End Communications Processor
Having the SIU implement a subset of the SOLC pro- Tile 8044 can also be used as an intelligent
tocol in hardware not only offloads the CPU, but it HOLC/SOLC front end for a microporcessor, capable
also improves the throughput on the network. The of extensively off-loading link control functions for
230876-8
15-64
AR-307
the microporcessor. In some applications the 8044 can computer. Sophisticated secondary stations could also
even be used for communications preprocessing, in take advantage of this design.
addition to data link control. For this type of design
the 8044 would communicate to the Host CPU Since the 8044 has ROM on chip, all the communica-
through a FIFO, or dual port RAM. A block diagram tions software is non-volatile. The 8044 primary
of this design is given in Figure 8. A tightly coupled station could down-line-load software to 8044 secon-
interface between the 8044 and the Host CPU would dary stations. Once down-line-loading is implemented,
be established. The Host CPU would give the 8044 software updates to the primary and secondary
high level commands and data which the 8044 would stations could be done very inexpensively. The only
convert to HOLC/SOLC. This . particular type of things which would remain fIXed in ROM are the
design would be most appropriate for a primary HOLC/SOLC communications software and the soft-
Station which is normally a micro, mini, or mainframe ware interface to the HOST.
SYSTEM
HOST MEMORY
INTERFACE
HARDWARE
8044
EXPANSION
MEMORY
15-65
inter ICETM·5100/044In·Circuit Emulator
for the RUPITM·44 Family
• Precise, Full-Speed, Real-Time
Emulation of the RUPITM-44 Family of • Symbolic Debugging Enables Access to
Memory Locations and Program
Peripherals Variables
• 64 KB of Mappable High-Speed
Emulation Memory
• Four Address Breakpoints Plus In-
Range, Out-of-Range, and Page Breaks
The ICETM-5100/044 in-~ircuit emulator is a high-level. interactive debugger that is used to develop and test
the hardware and software of a target system based on the RUPITM-44 family of peripherals. The ICE-
5100/044 emulator can be serially linked to an Intellec® Series III/IV or an IBM PC AT or PC XT. The emulator
can communicate with the host system at standard baud rates up to 19.2K. The design of the emulator
supports all of the RUPI-44 components at speeds up to and including 12 MHz.
·IBM is a registered trademark of International Business Machines Corporation. Intel Corporation assumes no responsibility
for the use of any circuitry other than circuitry embodied in an Intel product. No other patent licenses are implied. Information
contained herein supersedes previously published specifications on these devices from Intel.
280325-1
November 1988
15-66 Order Number: 280325-001
ICETM·5100/044
The ICE-5100/044 emulator can be operated with- • Software (includes the ICE-5100/044 emulator
software, diagnostic software, and a tutorial)
out being connected to the target system and before
any of the user's hardware is available (provided ex-
ternal data RAM is not needed). In this stand-alone The controller pod contains 64 KB of emulation
mode, the ICE-5100/044 emulator can be used to memory, 254- by 24-bit frames of trace memory, and
facilitate program development. the control processor. In addition, the controller pod
houses. a BNC connector that can be: used to con-
nect up to 10 multi-ICE compatible emulators for
synchronous starting and stopping of emulation.
Hardware Debugging
The ICE-51001044 emulator's AC/DC parametric The serial cable connects the host system to the
characteristics match the microcontroller's. The em- controller pod. The serial cable supports a subset of
ulator's full-speed operation makes it a valuable tool the RS-232C signals.
for debugging hardware, including time-critical serial
port, timer, and external interrupt interfaces. The user probe assembly consists of a user cable
and a processor module. The processor module
houses the emulation processor and the interface
System Integration logic. The target adaptor connects to the processor
module and provides an electrical and mechanical
Integration of software and hardware can begin , interface to the target microcontroller socket.
when the emulator is plugged into the microcontrol-
ler socket of the prototype system hardware. Hard- The crystal power accessory (CPA) is a small, de-
ware can be added, modified, and tested immediate- tachable board that connects to the controller pod
ly. As each section of the user's hardware is com- and enables the ICE-5100/044 emulator to run in
pleted, it can be added to the prototype. Thus, the stand-alone mode. The target adaptor plugs into the
hardware and software can be system tested in real- socket on the CPA; the CPA then supplies clock and
time operation as each section becomes available. power to the user probe.
280325-2
15-68
inter ICETM-5100'044
15-69
intJ ICETM·5100/044
~>Gon,"
<expr>
280325-4
PROCs can simulate missing hardware. or software, tor's memory along with the user's code to enable
set breakpoints, collect debug information, and exe- rapid debug of 8044 BITBUS applications code.
cute high-level software patches. PROCs can be
copied to text files on disk, then recalled for use in DESIGN CONSIDERATIONS
later test sessions. PROCs can also serve as pro-
gram diagnostics, implementing ICE-51 00/044 emu- The height of the processor module and the target
lator commands or user-defined definitions for spe- adaptor need to be considered for target systems.
cial purposes. Allow at least 1% inches (3.8 cm) of space to fit the
prqcessor module and target adaptor. Figure 5
On·Line Syntax Menu shows the dimensions of the processor module.
A special syntax menu, called the Integrated Com- Execution of user programs that contain interrupt
mand directory (ICD), similar to the one used for the routines causes incorrect data to be stored in the
121CETM system and the VLSiCE-96 emulator, aids in trace buffer, When an interrupt occurs, the next in-
creating syntactically correct command lines. Figure struction to be executed is placed into the trace buff-
3 shows an example of the ICD and how it changes er before it is actually executed. Following comple-
to reflect the options available for the GO command. tion of the interrupt routine, the instruction is execut-
ed and again placed into the trace buffer.
Help
ELECTRICAL CONSIDERATIONS
The HELP command provides ICE-51 00/044 emula-
tion command assistance via the host system termi- The emulation processor's user-pin timings and
nal. On-line HELP is available for the ICE-5100/044 loadings are identical to the 8044 component, ex-
emulator commands shown in Figure 4. cept as follows.
• Up to 25 pF of additional pin capacitance is con-
BITBUSTM Applications Support tributed by th~ processor module .and target
adaptor assemblies.
The ICE-5100/044 emulator provides an ideal envi-
o Pin 31, EA, has approximately 32 pF of additional
ronment for developing applications code for BIT-
BUS board products such as the RCB-44/10, the capacitance loading due to sensing circuitry.
RCB-44/20, the PCX-344, and the iSBXTM-344 • Pins 18 and 19, XTAL1 and XTAL2 respectively,
board. have approximately 15-16 pF of additional capac-
itance when configured for crystal operation.
The BITBUS firmware, available separately as BIT-
WARE, can be loaded into the ICE-51 00/044 emula-
It>HELP
HELP is available for:
ADDRESS APPEND ASM BASE BIT BOOLEAN BRKREG
BYTE CHAR CI CNTL_C COMMENTS CONSTRUCTS COUNT
CURHOME CURX CURY DCI DEBUG DEFINE DIR
DISPLAY DO DYNASCOPE EDIT ERROR EVAL EXIT
EXPRESSION GO HELP IF INCLUDE .INVOCATION ISTEP
KEYS LABEL LINES LIST LITERALLY LOAD LSTEP
MAP MENU MODIFY MODULE MSPACE MTYPE NAMESCOPE
OPERATOR PAGING PARTITION PRINT PROC PSEUDO_VAR PUT
REFERENCE REGS REMOVE REPEAT RESET RETURN SAVE
STRING SYMBOLIC SYNCSTART TEMP CHECK TRCREG TYPES VARIABLE
VERIFY VERSION WAIT WORD WRITE
hlt>
~ ~I~&J T
I·
H
CABLE BODY
39"
. (99 em) I
!
~~Z
!iis t
. z
i
4"
(10,2 em)
~
'i
---l
.
3':J/,."
rem)
SIDE VIEW
..
PROCESSOR MODULE
~-9;r··
TARGET
ADAPTOR
~
280325-6
15-72
intJ ICETM·5100/044
15-73
MCS®-80 /85 Data Sheets 16
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
intJ 8080A/8080A-1/8080A-2·
8-BIT N-CHANNEL MICROPROCESSOR
• TTL Drive Capability·
• Decimal, Binary, and Double Precision
The Intel@ 8080A is a complete 8-bit parallel central processing unit (CPU). It is fabricated on a single LSI chip
using Intel's n-channel silicon gate MOS process. This offers the user a high performance solution to control
and processing applications.
The 8080A contains 6 8-bit general purpose working registers and an accumulator. The 6 general purpose
registers may be addressed individually or in· pairs. providing Qoth single and double precision operators.
Arithmetip and logical instructions set or reset4 testable flags. A fifth flag provides decimal arithmetic opera-
tion. .
The 8080A has an external stack feature wherein any portion of memory may be used as a last in/first out
stack to store/retrieve the contents of the accumulator, flags, program counter, and all of the 6 general
purpose registers. The 16-bit stack pointer controls the addressing of this external stack. This stack gives the
8080A the ability to easily handle multiple level priority interrupts by rapidly storing and restoring processor
status. It also provides almost unlimited subroutine nesting.
This microprocessor has been designed to simplify systems design. Separate 16-line address and 8-line
bidirectional data busses are used to facilitate easy interface to memory and I/O. Signals to control the
interface to memory and I/O are provided directly by the 8080A. Ultimate control of t~e address and data
busses resides with the HOLD signal. It provides the ability to suspend processor operation and force the
address and data busses into a high impedance state. This permits OR-tying these busses with other control-
ling devices for (DMA) direct memory access or multi-processor operati.on.
. NOTE:
The 8080A is functionally and electrically compatible with the Intel 8080.
November 1986
16-1 Order Number: 231453-001
8080AI8080A-1/8080A-2
IIBITI
INTEAt:aAL DATA ius
..~ ,It
,.,'"
S
:::a:
REG.
0 .,
REG.
,., ,., REGISTER
~
H L
REG. REG. ARRAV
1111
TIMING
AND
CONTROL
ACK
231453-1
Figure 1. Block Diagram
A,. A11
GND A,.
D. An
'D. Au
O. A,.
D, At
D3 A. '
D. A,
D,O 32 At
D.O 10 8OIIOA 31 As
-5V II 30 OAo
RESET 12 29 -'3
HOLD 13 28 +1ZV
INT 14 27 A.
~. IS 26 A,
18 Au
.,
17 24 WAIT
Wii 18 23 READY
SYNC 19 22
+5V 20 21 HLDA
231453-2
Figure 2. Pin Configuration
16-2
SOSOA/SOSOA-1/S0S0A-2
, ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses abo.ve those listed under "Abso-
lute Maximum Ratings" may cause permanent dam~
Temperature Under Bias ............ O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature ,.......... - 65·C to + 150·C functional operation of the device at these or any
other conditions above those indicated in the opera-
All Input or Output Voltages
tional sections of this specification is not implied. Ex-
with Respect to Vss ........... - 0.3V to + 20V
posure to absolute maximum rating conditions for
Vcc, VDD and Vss extended periods may affect device reliability.
with Respect to Vss ...• '..••..• - 0.3V to + 20V
Power Dissipation .....•.................... 1.5W
D.C. CHARACTERISTICS
TA = O·C to 70·C, VDD = + 12V ±5%, Vcc = +5V ±5%, Vss = -5V ±5%, Vss = OV; unless otherwise
noted
Capacitance 231453-3
16-4
8080A/8080A-1/8080A-2
A.C. CHARACTERISTICS (8080A), TA = 0·Ct070·C, voo = +12V ±5%, vee = +5V ±5%,
VBB= -5V ± 5%, VSS = OV; unless otherwise noted
Symbol Parameter
-1 -1 -2 -2 Unit Test Condition
Min Max Min Max Min Max
tey(3) Clock Period 0.48 2.0 0.32 2.0 0.38 2.0 /Ls
tr, tf Clock Rise and Fall Time 0 50 0 25 0 50 ns
t</>1 I </>1 Pulse Width 60 50 60 ns
td>2 I d>2 Pulse Width 220 145 175 ns
t01 Delay <1>1 to <1>2 0 0 0 ns
t02 Delay <1>1 to <1>2 70 60 70 ns
t03 Delay <1>1 to <1>2 Leading Edges 80 60 70 ns
tOA Address Output Delay From <1>2 200 150 175 ns
CL = 100 pF
too Data Output Delay From <1>2 200 180 200 ns
toe Signal Output Delay From <1>1 or <1>2
120 110 120 ns CL = 50 pF
(SYNC, WR, WAIT, HLDA)
tOF DBIN Delay From <1>2 25 140 25 130 25 140 ns
tOI(1) Delay for Input Bus to Enter Input Mode tOF tOF tOF ns
tOS1 Data Setup Time During <1>1 and DBIN 30 10 20 ns
tOS2 Data Setup Time to <1>2 During DBIN 150 120 130 ns
tOH(1) Data Hold Time From <1>2 and DBIN (1) (1) (1) ns
tiE INTE Output Delay From <1>2 200 200 200 ns CL = 50 pF
tRS READY Setup Time During <1>2 120 90 90 ns
tHS HOLD Setup Time During <1>2 140 120 120 ns
tiS INT Setup Time During <1>2 120 100 100 ns
tH Hold Time From <1>2 (READY, INT, HOLD) 0 0 0 ns
tFO Delay to Float During Hold
120 120 120 ns
(Address and Data Bus)
tAW Address Stable Prior to WR (5) (5) (5) ns
tow Output Data Stable Prior to WR (6) (6) (6) ns
two Output Data Stable From WR (7) (7) (7) ns
tWA Address Stable From WR (7) (7) (7) ns
tHF HLDA to Float Delay (8) (8) (8) ns
tWF WR to Float Delay (9) (9) (9) ns
tAH Address Hold Time After DBIN During HLDA -20 -20 -20 ns
DEVICE
'1CL~100PF
UNDER
TEST
-= 231453-4
CL = 100 pF
CL Includes Jig Capacitance
16-5
~
., - ~t~'
~
tey .
f\ it'- ~ I~
<
m
."
oJ3
l
.2 -I ~
io---
s::
en
-.t03 _ "-f
~I t02 - -
---I
A'S-AO
I--toA--:r - - - -1 -- -- t-,.....--
tAW
------ --- -4
-too-I -- tOi 1- ~
toHI""'- I--t oo-
~-- L _____
--·t:-~
---:::.. :,1= ~ ---- - ---
g~TA IN ATA OUT
° ,° oJ
-
7 0 -f
to
~ ~
-lOW
T ~
SYNC _ 1052 - I»
Q
DBIN
-- to~l-- - tDel-
11 l.
I»
i:.....
I--toF~1 ---'OF-!
I»
Q
..... I»
[. Q
en
m
WR
----------- ~
,L tH -
toe 1---1
J-:-- ....
co
~~~--:I
READY -X@
------------ f.-- Q
~
- t R5
WAIT tH- ..- 71 ~
HOLD
t oc- -
- - ...X@tH --0
J--
-X
N
~r;;.; Q-
HLDA
- .............. rf
INT
X~ '-4
tlSJ:-:
'H_
~
...
~
INTE
231453-5
NOTE:
Timing measurements are made at the following reference voltages: CLOCK "1" = a.ov, "0" = 1.0V; INPUTS "1" = a.av, "0" = o.av; OUTPUTS "1" = 2.0V,
"0" = o.av
8080A/8080A-1/8080A-2
~, ,J\ f\ !
>
:5
~
w
~2 ~
I-J Q
-
--- ---~-'FD I--
~
.~
o
A,s·Ao I-~--
I-
Y
tWA
-- 1--. '1
+100
HLDA
- -
to'
_X-
- 2:170 ns).
.6. If not HLDA, two = tWA = t03 + tr<j>2 + 10 ns.
If HLDA, two = tWA = tWF·
~
7. tHF = t03 + trcf>2 -SO ns.
INT 8. tWF = toa + tr<f>2 - 10 ns.
9. Data in must be stable for this period during
DBIN T 3. Both tOSl and tOS2 must be satisfied.
INTE
I
~:~- 10. Ready signal must be stable for this period dur-
ing T 2 or TW. (Must be. externally synchronized.)
11. Hold signal must be stable for this period during
231453-6 T 2 or TW when entering hold mode, and during T 3,
T4, T 5 and TWH when in hold mode. (External syn-
chronization is not required.)
NOTES:
(Parenthesis gives -1, - 2 specifications, respec- 12. Interrupt signal must be stable during this peri-
tively.) od of the last clock cycle of any instruction in order
1. Data input should be enabled withDBIN status. to be recognized on the following instruction. (Ex-
ternal synchronization is not required.)
No bus conflict can then occur and data hold time
13. This timing diagram shows timing relationships
is assured.
only; it does not represent any specific machine cy-
tOH = SO ns or tOF, whichever is less.
cle.
2. lev = t03 + tr<1>2 + t<f>2 + tf<j>2 + t02 + tr<j>l ~
480 ns (-1 :320 ns, - 2:380 ns).
16-7
inter 8080A/8080A-1/8080A-2
The ability to branch to different portions of the pro- The following special instruction gro!-,p completes
gram is provided with jump, jump conditional, and the 8080A instruction set: the NOP instruction"
computed jumps. Also the ability to call to and return HALT to stop processor execution and the OAA in-
from subroutines is provided both conditionally and structions provide decimal arithmetic capability. STC
unconditionally. The RESTART (or single byte call allows the carry flag to be directly set, and the CMC,
instruction) is useful for interrupt vector operation. instruction allows it to be complemented. CMA com-
plements the contents of the, accumulator and
Double preCision operators such as stack manipula- XCHG exchanges the contents of two 16-bit register
tion and double add instructions extend both the pairs directly.
arithmetic and Interrupt 'handling capability of the
DATA WORD
The program instructions may be one, two, or three bytes in length. Multiple byte instructions must be stored in
:~~cessive words in program memory.. The instruction formats then depend on the particular operation execut-
For the 8080A a logiC "1" is defined as a high level and a logiC "0" is defined as a low level.
16-8
inter 8080A/8080A-1/8080A-2
NOTES:
1. DDD or SSS: B = 000, C = 001, D = 010, E = 011, H = 100, L = 101, Memory = 110, A = 111.
2. Two possible cycle times (6/12) indicate instruction cycles dependent on condition flags.
'AII mnemonics copyright @ Intel Corporation 1977
16-10
8085AH/8085AH-2/8085AH-1
8-BIT HMOS MICROPROCESSORS
• Single + SV
Voltage Margins
Pow~r Supply with 10%
• On-Chip System Controller; Advanced
Cycle Status Information Available for
Large. System Control.
•. Available
3 MHz, S MHz and 6 MHz Selections
• Non-Maskable) Plus an SOSOA-
Four Vectored Interrupt Inputs (One Is
• SOSSA
20% Lower Power Consumption than
for 3 MHz and S MHz Compatible Interrupt
• Arithmetic
• On-Chip
100% Software Compatible with S080A
• Direct Addressing Capability to 64K
• Crystal, LCClock Generator (with External.
or RC Network) Bytes of Memory
• Available
Packages
in 40-Lead Cerdip and Plastic
(See Packaging Spec., Order # 231369)
The Intel 8085AH is a complete 8-bit parallel Central Processing Unit (CPU) implemented in N-channel,
depletion load, silicon gate technology (HMOS). Its instruction set is 100% software compatible with the
8080A microprocessor, and it is designed to improve the present 8080A's performance. by higher system
speed. Its high level of system integration allows a minimum system of three IC's [8085AH (CPU),8156H
(RAMIIO) and 8755A (EPROM/IO)] while maintaining total system expandability. The 8085AH-2 and
8085AH-1 are faster versions of the 80B5AH.
The 8085AH incorporates all of the features that the 8224 (clock generator) and 8228 (system controller)
provided for the 8080A, thereby offering a higher level of system integration. .
The 8085AH uses a multiplexed data bus. The address is split between the 8-bit address bus and the 8-bit
data bus. The on-chip address latches of 8155H/8156H/8755A memory products allow a direct interface with
the 8085AH.
liifA
Xl Vee
X2 HOLD
RESET OUT HLDA
eLK lOUT!
SIO RESET IN
TRAP REAOV
RST 7.5 101M
RST 6.5 S1
}-.
I ,.. C III
RST 5.5 iii5
'1(0 REG INTR iVA
D
REG.
II, I.
flEO
'"
iNfA ALE
Kill l ,"
REG. MG. ARRAY ADO So
STACI(POINTEA fill AOl Al5
PROGRAM COUNTER 1111 AD2 Al4
INCAEM1NTEA/DECREMlNTEA ADJ All
ADDR($SLATCIl "I! AD4 Al2
AD5 All
AD6 AlO
AD7 Ag
x,
x, Vss AS
231718-2
AII-At ADJ-ADo
AODAlSIIDAT A aus
ADDItEII8US
Figure 2. 8085AH Pin
231.718-1
Configuration
Figure 1. 8085AH CPU Functional Block Diagram
September 1987
16-11 Order Number: 231718-001
intJ 8085AH/8085AH-2/8085AH-1
16-12
intJ SOS5AH/SOS5AH-2/S0S5AH-1
NOTES:
1. The processor pushes the pe on the stack before branching to the indicated address.
2. The address branched to depends on the instruction provided to the CPU when. the interrupt is acknowledged.
16-13
inter 8085AH/8085AH-2/8085AH-1
:
R, In addition to these features, the 8085AH has three
I~
Vee 0 maskable, vector interrupt pins, one nonmaskable
I
Typical Power-On Reset RC Values'
RI = 75 KO
f 231718-3
TRAP interrupt, and a bus vectored interrupt, INTR.
16-14
intJ 8085AH/8085AH-2/8085AH-1
highest priority. It is not affected by any flag or mask. hence, the 8085AH is operated with a 6 MHz crystal
The TRAP input is both edge and level sensitive. (for 3 MHz clock), the 8085AH-2 operated with a 10
The TRAP input must go high and remain high until it MHz crystal (for 5 MHz clock), and the 8085AH-1
is acknowledged. It will not be recognized again until can be operated with a 12 MHz crystal (for 6 MHz
it goes low, then high again. This avoids any false clock). If a crystal is used, it must have the following
triggering due to noise or logic glitches. Figure 4 il- characteristics:
lustrates the TRAP interrupt request circuitry within
the 8085AH. Note that the servicing of any interrupt Parallel resonance at twice the'clock frequency de-
(TRAP, RST 7.5, RST 6.5, RST 5.5, INTR) disables sired
all future interrupts (except TRAPs) until an EI in- CL (load capacitance) s 30 pF
struction is executed. Cs (Shunt capacitance)s 7 pF
Rs (equivalent shunt resistance) s 75!l
Drive level: 10 mW
Frequency tolerance: ± 0.005% (suggested)
INSIDE THE
EXTERNAL 8085AH
TRAP
INTERRUPT
Note the use of the 20 pF capacitor between X2 and
REOUEST ground. This capacitor is required with crystal fre-
quencies belpw 4 MHz to assure oscillator startup at
the correct frequency. A parallel-resonant LC citcuit
RESET I':;; SCHMITT may be used as the frequency-determining network
TRIGGER
for the 8085AH, providing that its frequency toler-
ance of approximately ± 10% is acceptable. The
+5V 0 elK components are chosen from the formula:
D
FIF
16-15
inter 8085AH/8085AH·2/8085AH·1
+IY
Xt eOllIAtI
,----,
I
I
*I
I CINT
-15pF
'--:........~_~2 X2_ _ _ J
+IY
;! x. I
'----+-....,--11... -""- - _....J
.. 231718-6
b. LCTuned Circul~ Clock DrIver
x, 47011
'-----lx.
1
-8K .
20
231718-9
pF ' - - - - (
e.1-12 MHz Input Frequency
External Clock Driver Circuit
231718-7
c. RC Circuit Clock Driver
Figure 5. Clock Driver Circuits
GENERATING AN8085AH WAIT As in the,8080, the READY line is used to extend the
STATE . read and write pulse lengths so that the 8085AH can
be used with slow memory. HOLD causes the CPU
If your system requirements are such that' slow to relinquish the bus when it is thOrough with it by
memories or peripheral devices are being used, the floating the Address and Data Buses.
circuit shown in Figure 6 may. be used to insert one
WAIT state in each 8085AH machine cycle.
SYSTEM INTERFACE
Th~ D flip-flops should be chosen so that
• ClK is rising edge-triggered The 8085AH family includes memory components,
• CLEAR is low-level active. which are directly compatible to the 8085AH CPU.
For example, a system consisting of the three chips,
8085AH, 8156H, and 8755A. will have the following
features:
~
CLEAR 808SAH • 2K Bytes EPROM
ClK CLlUIUTPIIT"" - ClK TO
808SAH • 256 Bytes RAM
"0" '"0'" READY
F/F F/F - INPUT • 1 Timer/Counter
+5V- 0
Q
0 ~~
• 4 8-bit 110 Ports,
231718-10 .1 6-bitll0 Port
'ALE and ClK (OUT) should be buffered if ClK input of latch
exceeds 8085AH IOl or IOH. • 4 Interrupt Levels
Figure 6. Generation of a • Serial In/Serial Out Ports
Wait State for 8085AH CPU
16-16
8085AH/8085AH-2/8085AH-1
This minimum system, using the standard 1/0 tech- shows the system configuration of Memory Mapped
nique is as shown in Figure 7. 1/0 using 8085AH. .
In addition to the standard 1/0, the memory mapped The 8085AH CPU can also interface with the stan-
1/0 offers an efficient 1/0 addressing technique. dard memory that does not have the multiplexed ad-
With this technique, an area of memory address dressldata bus. It will require a simple 8-bit latch as
space is assigned for 1/0 address, thereby, using shown in Figure 9.
the memory address for 110 manipulation. Figure 8
r1D~x,
Vss vee
rl I
-- TRAP
RST1.5
x, RESET IN
HOLD
HlDA
I-
I--
---
RST6.5 SOD I-- ,
8085AH
RST5.5 SID I-
5,1--
- INTR
TNTA
ADDR
ADDRI
DATA ALE AD Wli
RESET
101M
OUT S.
RDY ClK
I--
ALE PORT~
A J.. DATAl C 161
ADDR
~
101M
RESET
IN
TIMER
OUT -
r--
iow
AD
~
ALE
PORT
Itr- CE A
~.;:: '"
V
A8-10
8755A
.A J..
DATAl
ADDR
~.
1011\; PORT
B
RESET
I- * RDY Vee
~ ClK lOR -.J
.t tJ 1.
Vss Vee Voo PROG
Vee
Vee
Vee
231718-11
• NOTE:
Optional Cqnnection
16-17
AS-1S - ,
r-
"-
l
, v
~O-7
ALE 0 0
l!
(D
...IDc.
8085AH RD
WR
101M
-
-
-
-
- Vee
vce
!»
co
CI
co
CLK
RESET OUT f
- II co
01 - READY
- 0
co
3C i - en
S" 1 vec )I-
3" I. .. 1
I.
::z::
.....
c co
3 :TIMER AD A8- AD 101
1 0
...... (I) RESET + WR AD ALE CE ",-,70-7 101M
~A10VO.7 CE M ALE AD iOW CLK RS1RDY co
m '<
IN en
~
to
,!,
ID
3
.
)I-
::z::
PI)
.....
3:
ID
co
0
3 Tb~~R_ CO
en
0 )I-
~ 8158H ::z::
3C
III
[RAM + I/O + COUNTERlTIMERj 8755A [EPROM + I/O] .....•
~
~
ID
Co
:::::
.9
231718-12
'NOTE:
Optional Connection.
inter 8085AH/8085AH-2/8085AH-1
-- TRAP
X, X2 RESET IN
HOLD
-
-_.
-
RST7 HlDA
--- ---
RST6 SOD
RST5 8085AH SID
INTR S,
RESET
INTA OUT So
ADDRI
ADDR DATA ALE AD WR 101M RDYClK
' ~~
'Qr V' .1\.
101M (CS)
WR
RD
DATA
~
" STANDARD
MEMORY
\ ADDR (CS)
, V
/
(16)
--- ClK
RESET
B
WR
RD
...
V
r--..
DATA
" STANDARD
1/0
...
I ADDR
V
DUI II AA
Y:V
YAY;
Vee
Vee
.. YV Vee
231718-13
16-19
inter 8085AH/8085AH-2/8085AH-1
BASIC SYSTEM TIMING the three control signals (RD, WR, and INTA). (See
Table 3.) The status lines can be used as advanced
The 8085AH has a multiplexed Data Bus. ALE is controls (for device selection, for example), since
used as a strobe to sample the lower 8-bits of ad- they become active at the T 1 state, at the outset of
dress on the Data Bus. Figure 10 shows an instruc- each machine cycle. Control lines RD and WR be-
tion fetch, memory read and 1/0 write cycle (as come active later, at the time when the transfer of
would occur during processing of the OUT instruc- data is to take place, so are used as command lines.
tion). Note that during the 1/0 write and read cycle
that the 1/0 port address is copied on both the up- A machine cycle normally consists of three T states,
per and lower half of the address. . with the exception of OPCODE FETCH, which nor-
mally has either four or six T states (unless WAIT or
There are seven possible types of machine cycles. HOLD states are forced by the receipt of READY or
Which of these seven takes place is defined by the HOLD inputs). Any T state must be one of ten possi-
status of the three status lines (101M, S1, So) and ble states, shown in Table 4 ..
16-20
intJ 8085AH/8085AH-2/8085AH-1
M, M2 M3
CLK T,
AO O_7
ALE
iID
WR
101M
231718-14
16-21
8085AH/8085AH~2/8085AH·1
ABSOLUTE MAXIMUM RATINGS· • Notice: Stresses above those listed under ':4bso-
Ambient Temperature under Bias .....,. O·C to 70·C lute Maximum Ratings" may cause permanent dam-
age to the device. This is a stress rating only and
Storage Temperature .......... - 65·C to + 150·C funCtional operation of the device at these or any
Voltage on Any Pin other conditions above those indicated in the opera-
with Re!!pect to Ground .........• - 0.5V to + 7V tional sections of this specification is not implied. Ex-
Power Dissipation ........•................. 1.5W posure to absolute maximum rating conditions for
extended periods may IfIffect device reliability.
D.C. CHARACTERISTICS
8085AH, 8085AH-2: TA = O·C to 70·C, Vee = 5V t 10%, Vss = OV; unless otherwise specified" '
80S5AH-1: TA = O·C to 70·C, Vee = 5V ±5%, Vss = OV; unless otherwise specified"
Symbol Parameter Min Max Units Test Condlti,ons
VIL Input Low Voltage -0.5 +O.S V
VIH Input High Voltage 2.0 Vee +0.5 V
VOL Output Low Voltage 0.45 V IOL = 2mA
VOH Output High Voltage 2.4 V IOH = -400 p,A
Icc Power Supply Current 135 rnA 8085AH, SOS5AH-2
200 rnA 8085AH-1
IlL Input Leakage ±10 . p,A o ~ VIN ~ Vee
ILO Output Leakage ±10 p,A 0.45V ~ VOUT ,~ Vee
VILR Input Low Level, RESET, -0.5 +O.S V
VIHR Input High Level, RESET 2.4 Vee + 0.5 V
VHY Hysteresis, RESET 0.15 'V
A.C. CHARACTERISTICS
SOS5AH, 8085AH-2: TA = o·c to 70·C, Vee = 5V ±10%, vss = ov·
S085AH-1: TA = O·C to 70·C, vee = 5V ±5%, vss = OV
8085AH (2) 8085AH.2 (2) 8085AH~1 (2)
Symbol Parameter Units
Min Max Min Max Min Max
tCYC CLK Cycle Period 320 2000 200 2000 167 2000 ns
t1 CLK Low Time (Standard CLK Loading) SO 40 20 ns
t2 CLK High Time (Standard CLK Loading), 120 70 50 ns
tr, tf CLK Rise and Fall Time 30 30 30 ns
tXKR X1 Rising to CLK Rising 20 120 20 100 20 100 ns
tXKF X1 Rising to CLK Falling 20 150 20 110 20 110 ns
tAC A8-15 Valid to Leading Edge of Control (1) 270 115 70 ns
tACL AO-7 Valid to Leading Edge of Control 240 115 60 ns
tAD AO-15 Valid to Valid Data In 575 350 225 ns
tAFR Address Float after Leading Edge of 0 0 0 ns
READ (lNTA)
tAL A8-15 Valid before Trailing Edge'of ALE (1) 115 50 25 ns
°NOTE:
For Extended Temperature EXPRESS use M8085AH Electricals Parameters.
16-22
SOS5AH/SOS5AH·2/S0S5AH·1
NOTES:
1. Aa-A15 address Specs apply 101M. SO. and 51 except Aa-A15 are undefined during T4-T6 of OF cycle whereas 101M.
SO. and 51 are stable.
2. Test Conditions: tCYC = 320 ns (SOS5AH)/200 ns (SOS5AH-2);/167 ns (SOS5AH-1); CL = 150 pF.
*
3. For all output timing where C 150 pF use the following correction factors:
25 pF s;; CL < 150 pF: -0.10 ns/pF
150 pF < CL S;; 300 pF: +0.30 ns/pF
4. Output timings are measured with purely capacitive load.
5. To calculate timing specifications at other values of tCYC use Table 5.
16-23
inter 8085AH/8085AH-2/8085AH-1
OEVICE
<u)C
IJCL~150PF.
UNDER
TEST
~~...
0.45
~
0.8
> TEST POINTS .
.
.
0.8.
231718-16
231718-15
CL = 100 pF
A.C. Testing: Inputs are driven at 2.4V for a .Logic "I" and 0.45V CL .Includes Jig Capacitance
for a Logic "0". Timing measurements are made at 2.0V for a
Logic "I" and 0.8V for a Logic "0".
NOTE:
N is equal to the total WAIT states. T = tCYC'
16-24
8085AH/8085AH-2/8085AH-1
WAVEFORMS
CLOCK
X, INPUT
t
r
_]. _ __
t
~
elK
OUTPUT
1 _ 11 _1
I-------'CVC - - - - - - + 1
_lXKF-
231718-17
READ
T, I T, I T, T,
• )! ADDRESS
l
AO
_ tRDH __ ~1_tRAE
.....
-, - -
J
_Iq._
ADDRESS 1;/ $ff~ DATA IN
"I
-
i
-
f---tLA-
ALE
J
t AFR .......
tLOA
I _
I-'CL-
1
_IAL_ RO
_--'cc I
RDilNTA
_llC_ ~
~tAC_
231718-18
WRITE
T, I T, I T, I T,
.
Al
-tee
WR
~tAC-
-'lC :j~ ....... t el -.-
231718-19
16-25
SOSSAH/SOSSAH-2/S0SSAH-1
WAVEFORMS (Continued)
HOLD
elK :\
T,
, I
T,
I
T HOLD
\
T HOLD
I - , T,
HLOA t t HABF -
\
I. tHABE-H
READ OPERATION WITH WAIT CYCLE (TYPICAL)-SAME READY TIMING APPLIES TO WRITE
I T, T2 TWAIT T, T,
elK
/ \ ~ /
- - tlCK
·1 _ICA_
As-A,. ). ADDRESS
)
- 'AD
//II/) -
tRDH .. ~rRA'-
....
ADo-AD, ADDRESS
elL DATA IN
~
-)
ALE
r- r- tLL--'" -tLA-
tAFR_
- 'LOA
-'Cl-Y
. 'Al ~
1- 'Ro . ,I
tee
--'L~-rt
IJ
RD/iNTA
'i.
<'---'LRY
/:==
. tAC_
'ARY •~ ]---
I 'RY' 'RYH _I .
- .... ---....
lAYS tRYH
NOTE:
1. Ready must remain stable during setup and hold times.
/
16-26
8085AH/8085AH·2/8085AH·1
WAVEFORMS (Continued)
MI-------------l-----,~----------------~
HOLD
HLOA
231718-22
'NOTE:
101M is also floating during this ·time.
16-27
8085AH/8085AH-2/8085AH-1
16-28
inter 8085AH/8085AH·2/8085AH·1
16-29
inter 8085AH/8085AH-2/8085AH-1
NOTES:
1. DDS or SSS: B 000, 'C 001, D 010, E011, H 100, L101, Memory 110, A 111.
2. Two possible cycle times (6/12) indicate instruction cycles dependent on condition flags.
"All mnemonics copyrighted @lIntel Corporation 1976.
16-30
8155H/8156H/8155H-2/8156H-2
2048-BIT STATIC HMOS RAM
WITH I/O PORTS AND TIMER
• Single + 5V Power Supply with 10%
• 1 Programmable 6-Bit 1/0 Port
•
Voltage Margins
30% Lower Power Consumption than
• Programmable 14-Blt Binary Counter1
Timer
the 8155 and 8156
•
Completely Static Operation
Internal Address Latch
• Available in EXPRESS
- Standard Temperature Range
The Intel® 8155H and 8156H are RAM and I/O chips implemented in N-Channel, depletion load, silicon gate
technology (HMOS), to be used in the 8085AH and 8088 microprocessor systems. The RAM portion is
designed with 2048 static cells organized as 256 x 8. They have a maximum access time of 400 ns to permit
use with no wait states in 8085AH CPU. The 8155H-2 and 8156H-2 have maximum access times of 330 ns for
use with the 8085H-2 and the 5 MHz 8088 CPU.
The I/O portion consists of three general purpose I/O ports. One of the three ports can be programmed to be
status pins, thus allowing the other two ports to operate in handshake mode.
A 14-bit programmable counter/timer is also included on chip to provide either a square wave or terminal
count pulse for the CPU system depending on timer mode.
PC, Vee
PC. PC.
101M
TIMER IN PC I
G
PAa - 7
RESET PC.
ADo 7 256 X 8 PC, PB,
STATIC TIMER OUT PBs
RAM 101M PBs
* PB.
ALE
RO
G PBo-7 AD
WR
ALE
AD.
PB,
PB.
PB,
PB.
WR AD, PA,
RESET TIMER
G PCa - s AD.
AD,
AD.
AD,
PAs
PAs
PA.
PA,
December 1986
16-31 Order Number: 231719-001
inter . 8155H/8156H/8155H·2/8156H·2
16·32
8155H/8156H/8155H-2/8156H-2
FUNCTIONAL DESCRIPTION
I
The 8155H/8156H contains the following: I
I
e2K Bit Static RAM organized as 256 x8 I
I
e Two 8-bit I/O ports (PA & PB) and one 6-bit I/O I
port (PC) I
I
e 14-bit timer-counter I
TIMER
MODE I
The 101M (IO/Memory Select) pin selects either the L ____ _ _________ JI
five registers (Command, Status, PAO-7, PBO-7,
PCO-5) or the memory (RAM) portion. .
231719-3
The 8-bit address on the Address/Data lines, Chip
Enable input CE or CE, and 101M are all latched on- Figure 3. 8155H/8156H Internal Registers
chip at the falling edge of ALE.
CE(8155H)
\ V '\
OR
CE(8156H)
/ 1\ /
101M
\ V \
A°0-7
X ADQRESS
I\. I X DATA VALID
ALE
iiiiORWR
NOTE: 231719-4
For detailed timing information, see Figure 12 and A.C. Characteristics.
16-33
intJ 8155H/8156H/8155H-2/8156H-2
r=
5 4 3 2 0
ITM. TM,I IEBI lEAl Pc.1 PC, PB I PA I
'--r---'
DF.FINESPAo-, }
0;; INPUT
. DEFINES P90-1 1 '" OUTPUT
, { 00- ALT 1
" • ALT 2
DEFINES PCo.. 01 • ALT 3
10 .. ALl'"
ENABLE PORT A }
INTERRUPT 1 '" ENABLE
'-----'-_ _ _ _ _ _ ~:::RL~U~RT B 0 • DISABLE
~ ~,.W"' .."'~_
(lNPUT/OUTPUTI
16-34
inter 8155H/8156H/8155H-2/8156H-2
NOTES:
(1) Output Mode
(2) Simple Input
1 Multiplexer
. Control
231719-7
16-35
inter
."
8155H/8156H/8155H-2/8156H-2
Note in the diagram that when the 1/0 ports are pro- TIMER SECTION
grammed to be output ports, the contents of the out-
put ports can still be read by a READ operation The time is a 14-bit down-counter that counts the
when appropriately addressed. TIMER IN pulses and provides either a square wave
or pulse when terminal count (TC) is reached.
The outputs of the 8155H/8156H are "glitch-free"
meaning that you can write a "1" to a bit position The timer has the. 1/0 address XXXXX100 for the
that was previously "1" and the level at the output low order byte of the register and the I/O address
pin will not change. XXXXX101 for the high order byte of the register.
(See Figure 7.)
Note also that the output latch is cleared when the
port enters the input mode. The output latch cannot To program the timer, the COUNT LENGTH REG is
be loaded by writing to the port if the port is in. the loaded first, one byte at a time, by selecting the tim-
input mode. The result is that each time a port mode . er addresses. Bits 0-13 of.the high order count reg-
is changed from input to output, the output pin will ister will specify the length of the next count and bits
go low. When the 8155H/56H is RESET, the output 14-15 of the high order register will specify the timer
latches are all cleared and all 3 ports enter the input output mode (see Figure 10). The value loaded into
mode. . the count length register can· have any value from
2H through 3FFFH in Bits 0-13. .
When in the ALT 1 or ALT 2 modes, the. bits of
PORT C are structured like the diagram above in the
simple input or output mode, respectively. 765432·10
I~I~I~I~I~I~I~I~I
Reading from an input port with nothing connected ~' r
TIMER MODE MSB OF CNT LENGTH
to the pins will provide unpredictable results.
7 6 5 4 3 2 ,1 O'
I
TO 8085AH RST INPUT
Figure 10. Timer Format
--1
PORTA OUTPUT PORT A
A tNTR ISIGNALS DATA RECEIVED)
A SF (SIGNALS DATA READY) There are four modes to choose from: M2 and M1
}-~
A 5Ta (ACKNOWL. DATA RECEIVED) define the timer mode, as shown in Figure 11.
PORTC B STa (LOADS PORT B LATCH) PERIPHERAL
INTERFACE
B BF (SIGNALS BUFFER IS FULLI
B tNTR (SIGNALS BUFfER
READY FOR READING)
PORTB INPUT MODE START TERMINAL (TERMINAL)
TO INPuJ PORT (OPTIONALI BITS COUNT COUNT COUNT
TO 8085AH RST INPUT M2 M, ~ _____ i ____ .
o 1. SINGLE
231719-8 0
saUAAEWAVE
4. CONTINUOUS
PULSES' -----,ur----~
231719-10
Bits 6-7 (TM2 and TM1) of command register con- The counter in the 8155H is not initialized to any
tents are used to start and stop the counter. There particular mode or count when hardware RESET oc-
are four commands to choose from: curs, but RESET does stop the counting. Therefore,
TM2 TM1 counting cannot begin following RESET until a
o 0 Nap-Do not affect counter operation. START command is issued via the CIS register.
o 1 STOP-Nap if timer has not started; stop
counting if the timer is running. Please note that the timer circuit on the 6155HI
o STOP AFTER TC-Stop immediately after 8156H chip is designed to be a square-wave timer,
present TC is reached (Nap if timer has not an event counter. To achieve this, it counts
not started) down by twos twice in completing one cycle. Thus,
START-Load mode and CNT.length and its registers do not contain values directly represent-
start immediately after loading (if timer is ing the number of TIMER IN pulses received. You
not presently running). If timer is running, cannot load an initial value of 1 into the count regis-
start the new mode and CNT length im- ter and cause the timer to operate, as its terminal
mediately after present TC is reached. count value is 10 (binary) or 2 (decimal). (For the
detection of single pulses, it is suggested that one of
Note that while the counter is counting, you may the hardware interrupt pins on the 8085AH be used.)
load a new count and mode into the count length After the timer has started counting down, the val-
registers. Before the new count and mode will be ues residing in the count registers can be used to
used by the counter, you must issue a START com- calculate the actual number of TIMER IN pulses re-
mand to the counter. This applies even though you quired to complete the timer cycle if desired. To ob-
may only want to change the count and use the pre- tain the remaining count, perform the following oper- ,
vious mode. ations in order:
1. Stop the count
In case of an odd-numbered count, the first half-cy- 2. Read in the 16-bit value from the count length
cle of the squarewave output, which is high, is one registers
count longer than the second (low) half-cycle, as
shown in Figure 12. 3. Reset the upper two mode bits
4. Reset the carry and rotate right one position all 16
bits through carry
5. If carry is set, add % of the full original count (%
full count-1 if full count is odd).
NOTE:
If you started with an odd count and you read the
count length register before the third count pulse
occurs, you will not be able to discern whether one
5
or two counts has occurred. Regardless of this, the
231719-11 8155H/56H always counts out the right number of
pulses in generating the TIMER OUT waveforms.
NOTE:
5 and 4 refer to the number of clocks in that time peri-
od. .
Figure 12. Asymmetrical Square-Wave Output
Resulting from Count of 9
16-37
8155H/8156H/8155H-2/8156H-2
J\
A8-15
Y1 _J\
ADO·1 )
, r-
~
ALE
asAN jjjj
WA t--
101M t--
ClK
r---
RESET OUT
t--
READY
t--
t--
Vee
RESET
TIMER.
IN WARD ALE CE:-; .7 101M ,
,
7:~~ 7: 0
_101
0-7 CE M
ALE jjjj~Oii ClK RS ROY
J:
'-!. LATCHES J
T:'~~R_
G -~~
CONTROL
256 x 8
RAM
8755A (EPROM + 1/0)
,,- ~ I
~~cp~
B88 88 231719-12
16-38
inter 8155H/8156H/8155H-2/8156H-2
~ Vss Vee
j j
H- ~ POR!fOV
>--_WR ~
AD PORT (8)
11111101 8
...
ALE
DATAl
ADDR
PORT
C W (6)
IN_
" 101M TIMER
OUT f--
RESET
As-A19 AD DR lOW
RD
A p-,
~
ADDRIOATA ALE
. - - CLKADo-AD7
T~
PORT
" CE A
L-
... A8 _10
8088 /,-- V 1755A-I
~ READY ... DATAl
--I
MN/MX f--Vee ADDR
Vee
rD1 ALE f- ~ 101M PORT
~4
RST@ AD f- I-- I- RESET 8
X, X,
CLK 'NA f- READY Vee
READY I-- 101M i-- ~-l
?'"
RESET Vss Vee Voo
Vee
RDY'
WR
6
GND
GND
MANUAL,
RESET
.... RD
(V,,) G) CE,
118502
ALE
If- <:S,
I~
i-- CE,
f- A•• Ag
"'"-
ADO_7
"
I J
V" Vee
,
231719-13
16-39
8155HI8156H/8155H-2/8156H-2
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may cause permanent dam-
Temperature Under Bias ............ O·C to + 70·C' age to the device. This is a stress rating only and
Storage Temperature .......... - 65·C to + 150·C functional operation of the device at, these or any
other conditions above those indicated in the opera-
Voltage on Any Pin
with Respect to Ground .......... -O.5V to + 7V ' tional sections of this specification is not impliecl.' Ex-
posure' to absolute maximum rating conditions for
Power Dissipation .......................... 1.5W extended periods may affect device reliability.
'8155H/8156H 8155H-2/8156H-2
Symbol Parameter Units
Min Max Min Max
tAL Address to Latch Setup Time 50 30 ns
tLA Address Hold Time after Latch 80 30 ns
tlC Latch to ,READ/WRITE Control 100 40 ns
tRO Valid Data Out Delay from READ Control 170 140 ns
tLO Latch to Data Out Valid 350 270 n,s
tAD Address Stable to Data Out Valid 400 330 ns
tll Latch Enable Width 100 70 ns
tROF Data Bus Float after READ 0 100 0 80 ns
tCl READ/WRITE Control to Latch Enable 20 10 ns
tCll WRITE Control to Latch Enable for CIS Register 125 125 ns
tcc READ/WRITE Control Width 250 200 ns
tow Data In to WRITE Setup Time 150 100 ns
two Data In Hold Time after WRITE 25 25 ns
tRV Recovery Time between Controls 300 200 ns
twp WRITE to Port Output 400 300 ns
16-40
8155H/8156H/8155H-2/8156H-2
231719-14
DEVICE
UNDER
TEST
i cl = 150pF
A.C. testing: inputs are driven at 2.4V for a logic "I" and O.45V for
a logic "0". Timing measurements are made at 2.0V for a logic 231719-15
"I" and O.BV for a logic "0".
CL = 150 pF
CL Includes Jig Capacitance
16-41
inter 8155H/8156H/8155H-2/8156H-2
WAVEFORMS
READ
CEC1155HI / '\
CECI15IHI /- \. /
-
101M \ V \
lAO
7
>- ADDRESS
>-
DATA VALID
~
- tAl - - t LA -
Al E
/ i\ ~
_t AOf _
- t LL- - I--t ROF -
_ILC-~
_tRD_
1/
"-
_ I CC · -
- -tel-
_ t Rv -
ILO
231719-16
WRITE
151H) \ / \
aR
CE(I158H)
/ '"'\ 7
lolM'
\ I '\
AO O_7
X ADDRESS
K )~ DATA VALID
~
I- I AL- f---t LA - _ t ow - _ t el -
ALE
J ~ V
l - t LL - _ t LC -==1 I- two---':""
Wi!
tCLL---l 1- tee ------
\I
IWT
_ t Rv -
~-
I--
TIMER IN j
"
231719-17
16-42
inter 8155H/8156H/8155H-2/8156H-2
WAVEFORMS '(Continued)
STROBED INPUT
OF
INTR
INPUT DATA
FROM PORT
------------------~~-----+----~~-------------------------------------------------------------
231719-18
STROBED OUTPUT
OF
INTR
'w,
OUTPUT DATA
TO PORT
--------------------------------------------~~------------------------------------------------------
231719-19
RD
}
'.P J -I WR
OATABUS· - -- -
-------
- - =x OUTPUT
231719-20 231719-21
'Data Bus Timing is shown in Figure 7,
16-43
~
:e
ii!
m
::D
0
c:
»
<
m
."
(
~ 0
"tI
c: :::u
~ 3:
0
en
0
c:
'0
0
z ~
~ :::l
c
_I C
I~
<D
I
LOAD COUNTER FROM CLR
2 I 5 3
RELOAD COUNTER FROM CLR
I 2 I -\ 5
.s
""::D0 ....co
s::: en
TIMER IN en
en ::r:
......
~
0 ....
CO
en
en
TIMER OUT
\ INOTE 1) II
::r:
......
IPULSEI ___ J
~
\~
....enCO
en
::r:
~
......
TlMEROOT
I
ISQUARE WAVE)
\
\
INOTE 11
I ....
CO
en
~...,-------..1 en
::r:
~
231719-22
NOTE:
1. The timer output is periodic if in an automatic reload mode (Ml Mode bit = 1).
intJ 8185/8185·2
1024 x 8·BIT STATIC RAM FOR MCS®·85
• Multiplexed Address and Data Bus • Low Standby Power Dissipation
• Directly Compatible with B085AH and • Single + 5V Supply
8088 Microprocessors • High Density 1B-Pln Package
• Low Operating Power Dissipation·
The Intel 8185 is an 8192·bit static random access memory (RAM) organized as 1024 words by 8·bits using N·
channel Silicon·Gate MOS technology. The multiplexed address and data bus allows the 8185 to interface
directly to the 8085AH and 8088 microprocessors to provide a maximum level of system integration.
The low standby power dissipation minimizes system power requirements when the 8185 is disabled.
The 8185·2 is a high·speed selected version of the 8185 that is compatible with the 5 MHz 8085AH·2 and the
5 MHz 8088.
ADD Vee
, cs
CE,
. AD,
A~
RD
WR
CE2
RD RJW AD3 ALE
LOGIC
WR
ALE AD4 CS
l ADs
AD6
CE,
CE2
~ AD7 A9
DATA tK.'
BUS RAM
BUFFER MEMORY Vss As
V ARRAY
231450-2
.X.YDECODE
Figure 2. Pin Configuration
~'="~~
Pin Names
May 1987
16·45 Order Number: 231450-002
8185/8185-2
FUNCTIONAL DESCRIPTION
The 8185 has been designed to provide for direct
r1Dh
Vss Vee
RESET
OUT
SOD
SID
s,r-
"of-
r-
I-
the 8185 by the falling edge of ALE. If the latched ADDR DATA ALE ml WR IO/~ RovelK
status of both GEl and GE2 are active, the 8185
powers itself up, but no action occurs until the GS
(8' C8, Vi' Vr
line goes low and the appropriate RD or WR control 11-- CE
.
PORT~
A
signal input is activated. .
WR PORT ~
8
RDS156B ('
The GS input is not latched by the 8185 in order to
ALE PORT~
allow the maximum amount of time for address de- DATAl C (61
coding in selecting the 8185 chip. Maximum power ADDR'
IN
consumption savings will occur, however, only when
GEl and GE2 are activated selectively to power 1-- -
101M TIMER
RESET OUT
:::
down the 8185 when it is not in use. A possible con-
nection wduld be to wire the 8085A's IOlM line to lOW .
the 8185's GEl input, thereby keeping the 8185 AD
powered down during liD and interrupt cycles.
Table 1. Truth Table for H-
ALE
CE
PORT
A ¢!!>
Power Down and Function Enable ~~ AoIO
S755A
ROY
PoRT
' B W
X 0 X 0 Power Down and I- CLK
Function Disable(l)
0 1 1 0 powered Up and
~1 v!c vtD tRaG
Function Disable(l) WR
AD
0 1 0 1 Powered Up and
CE'·S1·S5
Enabled ALE
NOTES: ~- CS.CE2
X = Don't Care. . .' ~- ,. Aa.Ag
16-46
8185/8185-2
I I
I ~I- ~ POR!~
WR
RD POR~ k A
(81 >
.1_
ALE PORTkA>
~ DATAl C (61
ADDR
"f ~ IN_
101M TIMER
RESET
OUT f.-
~
ADDR/DATA ALE
.---- CLKAOo- ADr
'J
J~ ee
PORT
A
.-
8088
READY
:= "-
V
Aa_1o
,1755A02
DATAl
MNIMX I--vee ADDR
y
rD1 ALE ~ ~
~
r
Vee 101M PORT
r- RST ® RD l- I - I-- RESET B
X, x,
WR I-
l4
ClK
READY
Vee
READY I-- 101M ~ iDA -.J
RES ~
I284A
RESET
r---
I-
III
Vss Vee VDD
LROG
RDY1 Vee
I~ GND
MANUAL ....
W1i
Ali
GND RESET
(Vss) CD ee, .1115-2
ALE
\1- es.
Irl- CE,
II-I- AI,A,
V ADo·,
Iv•• t Vee
, 7
231450-4
16-47
8185/8185-2
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under ':4bso-
lute Maximum Ratings" may cause permanent dam-
Temperature Under Bias ............ O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .......... -65·C to + 150·C functional operation of the device at these. or any
Voltage on Any Pin other conditions above those indicated in the opera-
with Respect to Ground .......... - 0.5V to + 7V tional sections of this specification is not implied. Ex-
Power Dissipation .......................... 1.5W posure to absolute maximum rating conditions for
extended periods may affect device reliability..'
16-48
inter 8185/8185-2
INPUT/OUTPUT
"=X >
0.45
2.0
0.8
TEST POINTS < )C
. 2.0
0.8
DEVICE
UNDER
TEST
i Cl = IS0pF
231450-5
221450-6
A.C. Testing: Inputs Are Driven at 2,.4V for a Logic "I" and
0.45V for a Logic "0." Timing Measurements Are Made at CL=150pF
.2.OV for a Logic "I" and O.SV for a Logic "0."
CL Includes Jig Capacitance
WAVEFORM
ALE
(CE1-01-
(CE2'"'l'
WR.RD
--.cc----I
cs.
(SELECTEDl {DESELECTEDl
231450-7
16-49
intJ 8224
CLOCK GENERATOR AND DRIVER
FOR 8080A C.PU
. Single Chip Clock Generator/Driver for
8080A CPU • Crystal Controlled for Stable
System Operation
The Intel 8224 is a single chip clock generator/driver for the 8080A CPU. It is controlled by a crystal, seiected
by the designer to meet a variety of system speed requirements.
Also included are circuits to provide power-up reset, advance status strobe, and synchronization of ready.
The 8224 provides the designer with a significant reduction of packages used to generate clocks and timing
for 8080A.
RESET Vee
RESIN XTAL1
RDYIN XTAL2
§> XTAL1
,....,.----I>---osc IE> READY TANK
1!9 XTAL2
I!D TANK
I--i~---~, [E>
SYNC
.. ~, (TTLI .,
osc
STSTB ~,
I--i~---., §>
GND VDD
I-----¢,ITTLI(D
231464-2
ID SYNC ----t----ll-..,
RESiN Reset Input
IV mrN --I,>-t-l RESET Reset Output XTAL 1 } Connections
XTAL2 for Crystal
l -........--RESET II> RDYIN Ready Input
READY Ready Output TANK Us9d with Overtone XTAL
IV RDYIN --,...---+-1 t----READY[9
OSC Oscillator Output .
SYNC Sync Input
STSTB StatusSTB <l>2(lTL) <1>2 CLK (TTL Level)
231464-1 (Active Low) Vee +5V
Figure 1. Block Diagram ~ } 801i0 Voo +12V
<1>2 Clocks GND OV
Figure 2. Pin Configuration
December 1986
16-50 Order Number: 231464-001
inter 8224
ABSOLUTE MAXIMUM RATINGS* • Notice: Stresses above those listed under '~bso
lute Maximum Ratings" may cause permanent dam-
Temperature Under Bias ............ O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature .......... -65·C to + 150·C functional operation of the device at these or any
other conditions above those indicated in the opera-
Supply Voltage, Vee ............... -0.5V to + 7V
tional sections of this specification is not implied. Ex-
Supply Voltage, VOD ............ -0.5V to + 13.5V posure to absolute maximum rating conditions for
Input Voltage ..................... -1.5V to + 7V extended periods may affect.device reliability.
Output Current .......................... 100 mA
D.C. CHARACTERISTICS
TA = O·Cto +70·C, Vee = +5.0V ±5%, Voo = +12V ±5%
Limits
Symbol Parameter Units Test Conditions
Min Typ Max
IF Input Current Loading -0.25 mA VF = 0.45V
IR Input Leakage Current 10 ,."A VR = 5.25V
Ve Input Forward Clamp Voltage 1.0 V Ie = -5mA
VIL Input "Low" Voltage 0.8 V Vee = 5.0V
VIH Input "High" Voltage 2.6 V Reset Input ..
2.0 V All Other Inputs
VIWVIL RESIN Input Hysteresis 0.25 V Vee = 5.0V
VOL Output "Low" Voltage 0.45 V (4)1, 4>2), Ready, Reset, STSTB
IOL = 2.5mA
0.45 V All Other Outputs
IOL = 15 mA
VOH Output "High" Voltage
4>1, 4>2 9.4 V IOH = -100,."A
READY,RESET 3.6 V IOH = -100,."A
All Other Outputs 2.4 V IOH = -1 mA
lee Power Supply Current 115 mA
100 Power Supply Current 12 mA
NOTE:
1. For crystal frequencies of 18 MHz connect 510n resistors between the Xl input and ground as well as the X2 input and
ground to prevent oscillation at harmonic frequencies.
Crystal Requirements
Power Dissipation (Min): 4 mW
Tolerance: 0.Q05% at 0·C-70·C
Resonance: Series (Fundamental)' "NOTE:
Load Capacitance: 20 pF-35 pF With tank circuit use 3rd overtone mode.
Equivalent Resistance: 750-200
16-51
inter 8224
A.C. CHARACTERISTICS
Limits Test
Symbol Parameter Units
Min Typ Max Conditions
NOTE:
These formulas are based on the internal workings of the part and intended for customer convenience. Actual testing of the
part is done at Icy = 488.28 ns.
1S-52
8224
-r-Vcc
R,
DEVICE
UNDER
TEST
~ R2
C'i
~
231464-3
-=- -:;:-
A.C. Tesling: Inputs are driven at 2.4V for a logic "1" and 0.45V 231464-4
for a logic "0". Timing measurements are made at 2.0V for a
logiC "1" and O.SV for a logic "0" (unless otherwise noted). CL Includes Jig Capacitance
16-53
8224
WAVEFORMS
~----~------~------b------------------~
.,
., ----~~------~~------~ ~------
¢ZITTLI
SYNC
IFROM 8OBOAI
i-----tORH'-----t
~Ir~--------------,I,--------- -------------------
ROVIN OR R~~IN
- ;. . - - - - - - - - - - -'1'-----------+-----------------------
READY OUT
-------------------'r--~----+_----~~~------------
RESHOUT
231464-5
VOLTAGE MEASUREMENT POINTS: <1>1, <1>2 Logic "0" = 1.0V, Logic "1" = B.OV. All other signals measured at 1.5V.
Xl eLK
18MHz 0"'T
X2
Rl R2
":-
- 231464-6
16-54
intJ 8228
SYSTEM CONTROLLER AND BUS DRIVER
FOR 8080A CPU
• Single Chip System Control for
MCS®·80 Systems • User Selected Single Level Interrupt
Vector (RST 7)
CPU
DATA
BUS 1 0.-
0,_
°2-
°3-
0,_
0 .. -
0,-
0,-
_aBo}
- O B1
- ° 82
::: g:!
-as,
-DB,
- O B7 _
SYSTEM DATA BUS
.
.
III ~
~LATCH
STATUS
GATING
ARRAY
S'rSfii _ _ _ _ _ _ _ _ _-'
231465-2
m ---------------l
____________________
OlIN ~
September 1987
16-55 Order Number: 231465-002
inter 8228
ABSOLUTE MAXIMUM RATINqS*· *Notice: Stresses above those listed under ':Abso-
lute Maximum Ratings" may cause permanent dam-
Temperature Under Bias ............ O'C to+ 70'C age to the device. This is a stress rating only and
Storage Temperature .......... - 65'C to + 150'C functional operation of the device at these or any
other conditions. above those indicated in the opera-
Supply Voltage, Vee ............... ":'05V to + 7V tional sections of this specification is not implied Ex-
Input Voltage ...................... -1.5 to + 7V posure to absolute maximum rating conditions for
Output Current ...... :' .......... , ....... ,.100 mA ex/ended periods may affect device reliability.
VOH Output High Voltage 00-0 7 3.6 3.8 V Vee = 4,.75V; 10H = -10p.A
All Other Outputs 2.4 V 10H = -1 mA
los Short Circuit Current, All Outputs 15 90 mA Vee = 5V
10 (off) Off State Output Current 100 p.A Vee = 5.25V; Vo = 5.25V
All Control Outputs -100 p.A Vo = 0.45V
liNT INTA Current 5 mA (See INTATestCircuit)
NOTE:
1. Typi9al values are for TA'= 25°e and nominal supply voltages.
16-56
8228
Limits
Symbol Parameter Unit
Min Typ(1) Max
CIN Input Capacitance 8 12 pF
COUT Output Capacitance 7 15 pF
Control Signals
1/0 1/0 Capacitance 8 15 pF
(Dor DB)
.12Y
~Vcc
lKO:l:l0'lo
R,
~
i
DEVICE
UNDER
TEST
Cl
f
~
R,
8228
-=- -=
231465-3
For Do-~; Rl = 4 KO. R2 = 000, CL = 25 pF.
23
For all other outputs: Rl. = 5000, R2 = 1 KO, CL = 100 pF.
INTA 0--------'
231465-4
16-57
8228
WAVEFORMS
.,
·2----
"ST"'A"'TU"'S"'S"'T";R"'OB""E
-"'pw-
~
_DATA BUS X X
I~I-= -Is.ri
OBIN \.
INTA, lOR, iiiiiii
\
-l'RRj=-
IDC_ I~
\
- ~
I_IHO
.I_lOS- _IO~ _____________
-------- --
SYSTEM BUS DURING READ
-------- I- ---~I~ ~~-------------
_ BUS DURING READ .-------- ~ - '~E -:P 1>- - - - - - - - - - - - - - -
\. J
lOW OR MEMW
'WR~ _1- -11-twR
'\ J
1010 BUS DURING WRITE --------- -
---------- -
SYSTEM BUS DURING WRITE
------~ -~ ,:1- t"IWOl
VOLTAGE MEASUREMENT POINTS: Do-D7 (when outputs) LogiC "0" = O.BV, Logic "1" = 3.0V. All other signals mea-
sured at 1.5V.
·16-58
intJ 8755A
16,384-BIT EPROM WITH 110
• 2048 Words x 8 Bits
• 2 General. Purpose 8-Bit I/O Ports
The Intel·8755A is an erasable and electrically reprogrammable ROM (EPROM) and I/O chip to be used in the
8085AH microprocessor systems. The EPROM portion is organized as 2048 words by 8 bits. It has a maximum
access time of 450 ns to permit use with. no wait states in an 8085AH CPU. .
The I/O portion consists of 2 general purpose I/O ports. Each I/O port has 8 port lines, and.each I/O port line
is individually programmable as input or output.
RESET PBs
voo PB4
ADo-7
READY PB J
101M PB 2
G
As- IO lOR PB I
AD PBo
CE2
2K x 8 PA 7
EPROM lOW
101M
ALE PA 6
ALE
ADo PA5
RD
iOW
RESET
G ADI
AD2
AD J
PA 4
PA J
PA 2
lOR A0 4 PAl
AD5 PAo
231735-1 vss As
Figure 1. Block Diagram 231735-2
Figure 2. Pin Configuration
November 1986
16·59 Order Number: 231735·002
8755A
16-60
inter 8755A
FUNCTIONAL DESCRIPTION A port can be read out when the latched Chip En-
ables are active and either RD goes low with 101M
high, or lOR goes low. Both input and output mode
PROM Section bits of a selected port will appear on lines ADo-7.
The 8755A contains an 8-bit address latch which To clarify the function of the 1/0 Ports and Data Di-
allows it to interface directly to MCS@-48 and rection Registers, the following diagram shows the
MCS@-85 processors without additional hardware. configuration of one bit of PORT A and DDR A. The
same logic applies to PORT Band DDR B.
The PROM section of the chip is addressed by the
11-bit address and the Chip Enables. The address,
CEl and CE2 are latched into the address latches on 8755A ONE BIT OF PORT A AND DDR A
the falling edge of ALE. If the latched Chip Enables
are active and 101M is low when RD goes low, the
contents of the. PROM location addressed by the
latched address are put out on the ADo-7 lines (pro-
vided that Voo is tied to Vecl.
16-61
inter 8755A
16-62
l
....,
...
. An ..... A" A .. A,.
"-
)
::!! AIDD-7
fa
...
C .-- - r'- r- -
CD "
~ .... AN
ALE
I-- - I-- I- -
AD
CO I- - l- e- -
...... Wii
(/I
(/I
I-- - I-- I- -
~
CLKI.21
I- - l- e- -
3' READY
- - I-- 1-- -
CO
«:I
101M
- - I-- I- -
.... CO
(/I co
~
0)
c.J
~
::E:
en
""
en
en
J>
1
CD
3
,
-...
Cil
I II
:;,
a.
III
";, 7' 7
I,-AIDO-'
10'
......
.755A
.0 elK
12K BYTES)
10""
AU iii READY fE,
II
";,
iiii AIDO-' A
.." AUiIliiDIelKREADY
.755A
12K BYTESI
10111tE,
";"
'11iiDii
7
AID..,
1755A
12K BYTES)
i'
AO-" AU:'0iiielKREADY10"tE,'11iiiiii
7
AID.,
7
8755A
12K BYTESI
l'
AO-" ALEiIlimweLKREADY.. IIICI,'11iiiii AID..,
" 7
A." AU.0illilelKREADY,alii,
8155A
12K BYTESI
CE,
I
a.
:::: 231735-6
.9 NOTE:
Use CEl for the first 8755A in the system, and CE2 for the other 8755.A's. Permits up to5-8755A's in a system without CE decoder.
8755A
ABSOLUTE MAXIMUM RATINGS* • Notice.' Stresses above those listed under "Abso-
lute Maximum Ratings" may cause permanent dam-
Temperature Under Bias ........ ,', , , O·C to + 70·C age to the device. This is a stress rating only and
Storage Temperature " " " " " - 65·C to + 150·C functional operaiion of the device at these or any
other conditions above those indicated in the opera-
Voltage on any Pin
tional sections of this specification is not implied Ex-
with Respect to Ground, , , , , , , , , , - O,5V to + 7V . ,
posure to absolute maximum rating conditions for
Power Dissipation, , , , , , , , , , , , , , , , , , , , , , , , , , 1,5W . extended periods may affect device reliability.
D.C. CHARACTERISTICS.
TA = o·c to 70·C, Vee = voo =5V ±5%
Symbol Parameter Min Max Unit ' Test Conditions
VIL Input Low Voltage -0,5 0,8 V Vee = 5,OV
VIH Input High Voltage 2,0 Vee + 0,5 V Vee = 5,OV
VOL Output Low Voltage 0.45 V IOL = 2mA
VOH Output High Voltage 2.4 V IOH = - 400 /LA
IlL Input Leakage 10 /LA Vss ::;: VIN ::;: Vee
ILO Output Leakage Current ±10 /LA O,45V::;: Vour::;: Vee
lee Vee Supply Current 180 rnA
100 Voo Supply Current, 30 rnA Voo = Vee
CIN Capacitance of Input Buffer 10 ...
pF fc = 1 /LHz
CliO Capacitance of 1/0 Buffer 15 pF fe = 1/LHz
D.C. CHARACTERISTICS-PROGRAMMING
T A = o·C to 70·C, Vee = 5V ± 5%, Vss = OV, Voo = 25V ± 1V
Symbol Parameter Min Typ Max Unit
Voo Programining Voltage (during Write to EPROM) , 24 25 26 V
100 Prog Supply Current 15 30 rnA
16-64
8755A
A.C. CHARACTERISTICS
TA = O·C to 70·C. vcc = 5V ±5%
8755A
Symbol Parameter Unit
Min Max
tCYC Clock Cycle Time 320 ns
T1 CLK Pulse Width 80 ns
T2 CLK Pulse Width 120 ns
tf. tr CLK Rise and Fall Time 30 ns
tAL Address to Latch Set Up Time 50 ns
tLA Address Hold Time after Latch 80 ·ns
tlC Latch to READ/WRITE Control 100 ns
tRD Valid Data Out Delay from READ Control' 170 ns
tAD Address Stable to Data Out Valid" 450 ns
tll Latch Enable Width 100 ns
tRDF Data Bus Float after READ 0 100 ns
tCl READ/WRITE Control to Latch Enahle 20 ns
tcc READ/WRITE Control Width 250 ns
tDW Data in Write Set Up Time 150 ns
tWD Data in Hold Time after WRITE 30 ns
twp WRITE to Port Output 400 ns
tpR Port Input Set Up Time 50 ns
tRP Port Input Hold Time to Control 50 ns
tRYH READY HOLD Time to Control 0 160 ns
tARY ADDRESS (CE) to READY 160 ns
tRV Recovery Time between Controls 300 ns
ti=lDE READ Control to Data Bus Enable 10 ns
NOTES:
CLOAD = 150 pF.
'Or TAD - (TAL + T Lcl, whichever is greater.
"Defines ALE to Data Out Valid in conjunction with TAL.
A.C. CHARACTERISTICS-PROGRAMMING
TA = O·C to 70·C, Vcc = 5V ±5%. Vss = OV. VDO = 25V ±1V
Symbol Parameter Min Typ Max Unit
tps Data Setup Time 10 ns
tpD Data Hold Time 0 ns
ts Prog Pulse Setup Time 2 fLs
tH Prog Pulse Hold Time 2 fLs
tpR Prog Pulse Rise Time 0.01 2 p.s
tPF Prog Pulse Fall Time 0.01 2 p.s
tpRG Prog Pulse Width 45 50 ·ms
16·65
8755A
"=X )C
DEVICE
.. >
0.45
2.0
0.'
.
TEST POINTS ~
2.0
0.'
UNDER
TEST
ICL.1SOP F
231735-7
A.C. Testing: Inpuls are driven a12.4V for a Logic "1" and 0.45V 231735-8
CL=150pF
for a Logic "0". Timing Measurements are made al 2.0V for a
CL Includes Jig Capacitance
Logic "1" and 0.8V for a Logic "0".
WAVEFORMS
231735-9
Aa·10 ADDRESS
101M
ADO·1
'------,....,}-
ALE
CE,
--t----·ow
231735-10
Please note that eEl must remain low for the entire cycle.
16-66
intJ 8755A
WAVEFORMS (Continued)
1/0 PORT
\ {
PORT
OUTPUT
--- - ----------'::~XO"""'
------------
GLITCH FREE
V
DATA" -
BUS
-
____ _
- - -
..A_________ X".____
..J
231735-12
B. Output' Mode .
231735-13
16-67
8755A
WAVEFORMS (Continued)
FUNCTION
ALE
DATA TO BE
A/DO·7
PROGRAMMED
IpO
A8·10
CEa
Ips
+25
VOO
+5------------------------(
231735-14
·Verify cycle is a regular Memory Read Cycle (with Voo = +5V for 8755A),
16-68
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
DOMESTIC SALES OFFICES
ALABAIIA GEORGIA NEW MEXICO TEXAS
~:~(3;W~~~~
CALIFORNIA
Intel Corp."
~C:~OW8n Street
300 Motor Parkway UTAH
l\n5'1'5 IOWA Haupcauge 11787
~J: ~~b~~~~3~
Suita116 Intel Corp.
i::(a:arrJ4~8~
intelCorp. 5201 Green Street
St. Andrews Building Suite 290
~e~~(~~~J:'8051
1930 St. Andrews Drive H.E. Intel Corp.
orp_ Cedar Rapids 52402 Suile 2B Hollowbrook Park
~mpe'ial Highway Tel: (319) 393-5510 15 Myers Corners Road
~
p 'nger Falls 12590 VIRGINIA
90245 KANSAS Tel: 914) 297·6161
Tet: 0·6040 : 510·248·0060 tlntelCorp.
llnJ8I~~~~Oth
1504 Santa Rosa Road
IntoIC':;f.- Street NORTH CAROLINA Suital08
~~~e~:;' 131,r
Tel: (916) 920·8096
uite 101 Suite 170
Overland Park 66210
Tel: (913) 345-2727
Intel Corp.
5700 Executive Center Drive
RiChmond 23288
Tel: (804) 282·5668
Suile213 WASHINGTON
~"Jg1
MARYLAND Charlotte 28212
t&c::fulive Drive Tel: (704) 568-8966
Suite 105 IntelCOIp:
~:r (~~4;~~~
7321 Par1l.way Drive South lIntel Corp.
SuiteC
Hanover 21 076 S~~ Wi" ff Road
~:l~~~9r7~~~8022
InleICorp.· Tel: (301) 796-7500
400 N. Tuslln Avenue TWX: 710-862·1944
Suite 450
Santa Ana 92705 Intel Corp. OHIO ~nJ:1 ,ro~lIan Road
~:1~~955~4
5th Roor Suite 102
7833 Walker Drive Intel Corp: Spokane 99206
Greenbelt 20770 3401 Park Center Drive Tel: (509) 928-S086
t~t6fg:fs'~
Tel:. (301) 441·1020 Suite 220
Da~on 45414 WISCONSIN
~~A~~5~~~
2700 San Tomas Expressway ,.ASSACHUSEns
Santa Clara, CA 95051 tlntelCorp.
~J~~~~~~5
tlntel Corp: 330 S. Executive Or.
Westford Corp. Center Intel Corp: Suite 102
3 Carlisle Road 25700 Science Park Dr .• Suile 100 Brookfield 53005
COLORADO Westford 01886 BeachwOOd 44122 Tel: (414) 784-8087
~J~A~b~~~~~~
Tel: (617) 692·3222 FAX; (4141796·2115
Intel Corp. TWX:"110·343-6333
4445 Noi'thpark DrIve
Suite 100' MICHIGAN OKLAHOMA CANADA
~= ~~~~.&k80907 BRInSH COWMBIA
~n~~ ~~G;oadway
tlntelCorp.
7071 Orchard Lake Road
Suife100 " Suite 115 Inlel Semiconductor of Canada, Ltd.
West Bloomfield 48033 Oklahoma City 73116 Suite 202
Tel: (313) 851-8096 Tel: (405) 848·8086
MINNESOTA OREGON
CONNEcnCUT Intel Corp.
3500 W. 80th St, SUite 360 t=~~: Greenbrier Parkway, Bldg. B
ONTARIO
~~~~~~~:7~i2,
Tel: (612 835-6722
Oanbu~Q6811 lWX: 91 576-2867
~:7,~~'l~ MISSOURI PENNSYLVANIA 14
FLORIDA Intel Corp.
1513 Cedar Ciiff Drive tlntel Semiconductor of Canada, Ltd.
190 Attweli Driva
'~~~::tmonte Or.
Suite 105
¥:I~G1~:1 ~:~-1k5 Sulle500
.DOMESTIC DISTRIBUTORS
Alliance Electronics Inc. Pioneer Electronics Pioneer Electronics Arrow Electronics Inc.
11 9801 A-Southern Pine Blvd. 259 Kappa Drive 1093 Meyerside Dr,
Charlotte 28217 Pittsburah 15238 Unit 2
~:tj,b?7~2S~'~2
Tel: (704) 527-8188 MlsslssauBa LST 1 M4
~~X~~',~~~:~=
TWX: 810-621-0366
FAX: 412-963-8255
Hamllton/Avnet Electronics OHIO
2524 Baylor Drive S.E.
~:~~~~:t~Jgg
Arrow Electronics, Inc.
FAX: 50~-243-1395
7620 McEwen Road
Centerville 45459
~~~~~~~~~6
Solon 44139
~~~~~\~-~:::~'Wa
tArrow Electronics, inc.
:)22D Commander Drive ~A'X}~'16J.:~~:~ .
r?'~ ~~2~~~~~~, c;:.~~p
carrollton 75006
~~~~',t~:~ra
FAX: 516-391-1401 HamUton/Avnet Electronics
. Bellevue 98005 3688 Nashua Dr.
~~xf~'~~~~
Units 9 and 10
tArrow Electronics, Inc. MisSlssa~a L4V 1 M5
10899 Klnghurst Dr.
Suitel0D WISCONSIN ~A~f~',~~~=
Houston 77099
l~6r~~p~~J~r:>~:::,ls1e.100
Tel: (713) 530-4700 tHamiiton/Avnet Electronics
FAX: 713-568-8518 19D Colonnade Road South
Brookfield 53005 N"/"ian K2E 7J5
~~~~\~-~~~:g~~g ~tct~',~~~n~
tArrow Electronics, Inc.
2227 W. Braker Lane
Austin 78758
~AIX~\',~_=~A~g
tHamilton/Avnet Electronics Hamilton/Avnet Electronics lZentronlcs
B~~~u~o~~13T4
Hamilton/Avnet Electronics 30325 Bainbridge Rd., Bldg. A 2975 Moorland Road
Solon 44139 New Berlin 53151
m (~'6) 451-9600
T ~~IX~~\~-~;:iA~· l~G;)!I~~~~~~r il:~:onics ~~f~\~-~::~~Jg FAX: ~1a-451-8320
FAX: 71 -475-91 Austin 78758
~~~~~\~.H~~il
tPioneer Electronics KierulH Electronics, Inc. tientronics
4433 Interpoin! Blvd. 2238-E W. Bluemound Rd. 155 Colonnade Road
t~:ir~~lfat~e~~~lronlcs Dayton 45424 Waukesha 53186 Unit 17
~~~f~\~-~:wgg
Syracuse 13200 Tef: (513) 236-9900 tHamliton/Avnet Electronics Nepean K2E 7K1
~111 W. Walnut Hill lane
~~~~',~_~~~~ ~~~~',~_~~~::g
FAX: 513-236-8133
Irving 75038
~~~~',t~~g::~g
tPioneer Electronics
4800 E. 131st Street CANADA SASKATCHEWAN
Cleveland 44105
ALBERTA
~l~fb~li~~~
tHamilton~Avnet Electronics
FAX: 216-587-3906
~~:go~r~7lr7oad, Ste.19D Hamilton/Avnet Electronics
2816 21st Street N.E.
OKLAHOMA ~~~~'t~~:g~~~~ Cal g ar6; T2E 6Z2
FRANCE
Abraham Uncaln StrasH 16-18
6200 Wiesbaden m~~,~~4071 SWITZ!RLAND
Intel l~!~~~~ 6050 NETHERLANDS Intel·
1, rue Edlton-BP 303 Talackel'$trasS8 17
78054 81 Quentin-en-Yvelines Cedex Intel Intel· 8065Zur/ch
l~~~~l7000 Bruckstrasse 61 Alexander Poort Building
tnc:~V9fs9 29 n
~1e~vM~:"7':
7012 Fellbach
s~.n
l~:(7~1'.a1~~ 00 82 . l~~~1~~21 2377 UMTED KINGDOM
Intel'
~~ri:;''''flt$hlre SN3 1~J
NORWAY
.
Intel
Hvamveien 4-P.O. Box 92 ~~,(~~60oo
2013S'3:".
t~~~801~ 420
DENMARK
Jermyn GmbH
1m Oachsstueck
8250 UmbU,%.,
9 ~~~~~~O 99 06
Jermyn
Vestry Estate
m~~~~~-o
NORWAY
80 Otford Road
Nordisk Elektronik AIS Sevenoaks
Metrologle GmbH P,O. Box 122 kent TNt. SEU
Smedsvingen ..
~j~:,::~:~~~9 1384 Hvalstad ~:(~~~J24S 0144
FINlAND
Tel: (089118 04 20
TLX: 5213189 ~~~ttrtO Rapid Silicon
RaPJd House
OYAntronlcAB Proelectron Vertflebs GmbH PORTUGAL DenmarlcSt.
Max Planck Sirasse 1-3
=~~~~
Melkonkatu 24A
00210 Helsmkl21 6072 Oreleich Ollram
~M)2~~:022 m~~V9~ 30 43 43 Av. M. Bombard., 133-1 0
1000 Usboa
Tel: (II 54 5313
m!m3f 2268
FIIANC! IRELAND TLX: 14182 Rapid,Systems
Rapid House
~:Oag=~" Park
SPAIN Denmark St.
.
A10 Electronica S.A. ~~:"~~~R
g:~~~I~ Plaza Cludad de Viana no. 6
mf~Ja~0244
~~:(y,~6288 28040 Madrid
~~~~2~~ 40 00 YUGOSLAVIA
ISRAt!L
ITT-SESA H.R. MICroelectronics Corp.
Eastronles Ltd. i~1oMr!fa,:~:ngel no. 21·3 2005 de II Cruz Blvd., Ste. 223 •
11 Rozenis Street Santa Clara, CA 95050
P.O. Box 39300
~~~~7~~ 09 51 U.S.A.
Te! Aviv 81392
~~~~~SI51
~~!~4~f0286
SWEDEN
INTERNATIONAL
DISTRIBUTORS/REPRESENTATIVES
ARGENnNA CHINA IConl'd) JAPAN ICont'd) NEW ZEALAND
DAFSYSS.R.L. Schmidt & Co. Ltd. Dia Semlcon Systems, Inc. Northrup Instruments & Systems Ltd.
Chacabuco, 90-4 PISO Wacore 64, 1·37-8 Sa~enjaya
~~g.~~~NRe':~arket
18/F Great Eagle Centre
t069-Buenos Aires 23 Harbour Road
~:a~a8~~~~kyo 1 Auckland 1
·~r~~~5~~~
Tel: 54-1-334-1871
54-1-34-7726 FAX: 03-487-8088 Tel: 64-9-501-219, 501-801
TLX: 25472 . TWX: 74766 SCHMC HX TLX: 21570 THERMAL
FAX: 852-5-891-8754 'Okaya Koki
2-4-18 Sakae
INDIA
~:I~~~~:2~~:I:;Shi 460
Micronic Devices FAX: 052-204-2901
~~"Jcr.t.&~Road Ryoyo EJecl:ro Corp.
Basavanagudl Konwa Bldg.
'::~~I:r2~~'
AUSTRAUA 1-12-22 Tsukiji SINGAPORE
=
FLORIDA MJSSOURI TEXAS
InteICcrp.
11225 N. 28th Dr., #0214 IntslCorp. Intel Corp.
Phoenix 85029 ~~ CJty Expressway 313 E. Anderlon Lane
Tel: (602) 869"980 Suite 314
~:"(3~~~'5
AusUn78762
~J~Jf~~C,
InlelC
6OOE.
~: ~~atmonte DrIve
SlerraVllt1 HEW JERSEY
Tel: (602)4
SUite 105
ARKANSAS
~($~rsr8=32714
~.~g:!206 GEORGIA
Ulm 72170
Tel: (501) 2414264
~,~ ~rrnte Parkway ~:ita~~iZalll
InltICorp.
CAUFORNIA Sulle200 Rarllan Centsr =~~n:t\4 Suite 225
Norcross 30092 Edison 08817 rei: (9'5) 75'.0'88
Tel: (404) 44H171 Tel: (20') 225-3000
YrRGINIA
fLUNQrs NORTH CAROLINA
Intel Corp.
m:8's~~~eadowvlew Road 1603 Sanla Rosa Rd .• #109
Richmond 23288
Tel: (804) 282-5668
=~perial Highway
Suite 206
Greensboro 27407
SUite 218 Tel: (9'9) 294-'54' WASHINGTON
~~:=a INOIANA Inlel Corp.
Intel Corp. Intel Corp. ~~~ ~~~d., Suite 102
~:o~:a~r5~'
8777 Purdue Rd., #'25 Tel: (B'9) 781-11022
Tel: (918) 351-8143 ~":.(a~W~~::\ OHIO
=~IhStreet
KANSAS WISCONSIN
te~~~'1Oth Street
SlIIte110 InlelCorp.
Santa Ana 92705 330 S. EXecutive Dr.
~J~~~~4~
Suite 170 SUI\e'02
Overland Park 66210 Brookfield 53005
Tel: (913) 345-2727 Tel: (414) 714-8087
Intel Corp.
'~':aS&'!r~or~pcpressway KENTUCKY Intel Corp.
8500 Poe CANADA
~:rr,:r:~
Tel: (408) 970-1740
~,=';a'P'
OREGON Rexdale
Canada
MARYLAND Tel: (41
COLORADO
Intel Corp.
5th Floor - :;:~orlein Blvd. .
7833 Walker Drive PoInte Qalre, Quebec
canada H9R 3K3
:mg1~/iiCherry Greenbeft 20nO
Tal: (301) 441-1020 Tel: (5'4) 894-9'30
Sulte91S
Denver 80222 IIASSACHUSErrB Intel Corp.
2850 0u88l'lsvtew DrIve. #250
~~~~~~';= Ottawa. Ontario,
==corp.Center
3 carlllle Road
canada K2B 8H8
Tel: (8'3) 929-9?'4
Westford 01886
Tel: (817) 692·1060