Вы находитесь на странице: 1из 448
Contents— Overview SECTION 1 BEGINNINGS Section I covers C and assembly, for the 8051 family. It will help to have some previous experience programming. To keep the examples simple, this section uses only parallel ports. Chapter 1 introduces the 8051 microcontroller and sets it in the context of other micros. Chapter 2 describes computer architecture in general and that of the 8051 family specifically. It describes kinds of memory and explains how in- formation travels over a bus, The way the central processing unit (CPU) does math and logical operations is described here. Chapter 3 goes through af! the machine instructions of the 8051 fam- ily. While brief examples are given, the following chapters are the place to learn programming. Chapter 4 introduces assembly language and C. The different kinds of variables and the different types of memory space in the 8051 are described. The chapter covers the logical and arithmetic operations that are important to embedded applications. The precedence of operators is shown in a table. Chapter 5 covers the branching and looping constructs, which are es- sential to any structured programming approach. The idea of structured pro- gramming is explained as well as the ditference between a loop test at the start or end of a loop. vi Contents—-Overviow Chapter 6 gets ito arrays, pointers, and based variables, which are fundancntal to functions (and usually come at the end of a programming course). This chapter also goes into structures, SECTION If FUNCTIONS, MODULES, AND DEVELOPMENT Chapter 7 covers functions and subroutines—the pieces that contribute to modular, understandable programs. This chapter also goes into passing val- ves tw and trum routines. ‘Chapter 8 goes into scope of variables, using multiple files in develop- ing sofware and the mixing of Tanyuages. The modular approach is: no Jonger just a technique for switching to ussembly when a high-level tan- guage becumes tov slow—it is the key 10 well-organized. easily maintained programs, Chapter 9 introduces the “integrated development environment” and software tools from Keil that come with the book. jt shows the development process und then how to sel up the environment so you can type in progeams and have then compiled (or assembled) (0 the final form, There is muteriad ‘on the two monitor programs thet come with the available development boards as well SECTION Sl MULTITASKING TE you ane going to write efficient embedded applications code. you must ure forth on new way of thiaking in which your controller does iwultipte she same time,” This should be the heart of any real-time contcol projects. Chapter 10 imenduces the task and related terms of mubitasking. Chapter 11 introduces the Ger sind inrervupe hardware of the 8051 funily that are the Key to real-time interrupts and most multitasking, Chapter 12 develops a form of multitasking sysiem—the scheduler, I shows how the real-time interrupt makes programming of wuftic Kights sat other cyclic controlfers quite straightforward. Chapter 13 categorizes and describes real-time operating, systems as commnunication between tasks on the same contruler, In addition to the sim- plest methous using flugs aud shared variables, this chapler describes signal- ing, message passing and resource management in the Various multitasking operating systems. Contents—Overview Chapter 14 goes through a specific example showing the plan hardware choives, and the software development. It shows how timers and interrupts allow a sort of mullitasking. SECTION IV APPENDICES AL gives both numeric and alphabetic-order lists of assembly language structions for the 8051. This ix useful if you are hund-disussembling. chine code, A2 covers developiacnt ander DOS as well as deseribing some of the batch files for developing sofware for use with « monitor. AS gives language-switching hints—8085 to 8051 assembly ay well as ANSE-standard C tw C with 8051 extensions, ‘Ad describes hank switching as well us covering the design and use a the two featured development bourds. AS fists all the known vendors of 805 -refated products with current addresses und phone numbers. Contents PREFACE xix 1 BEGINNINGS 1 1 Introduction 3. What is an “80SI") 3 Microcontrollers 4 Programming Embedded Controllers in 5 Programming Languages 5 Efficiency 5 Review and Beyond 6 2 Computer Basics 7 Overview 7 Dissceting C: Back to Basics 8 Cor Assembly? 11 Computer Architecture 11 Binary Numbers 13 Address Decoding 14 Single-address Decoder 4 Multidevice Address Decuder 15 PLDs \7 ix x Contents Memory \7 ROM aud RAM 18 8051 Code Storage 20 8054 Internal RAM 21 8051 Offchip Memory 21 Japut/Output (70 2 Moving Data—Busses 24 BOSH Instruction Execution Sequences 26 ‘Timing and Signal Details 28 Control Bus Signals 28 ALE 28 PSEN 29 RD and WR 3 The Oscillator 31 Clocks and Timing 34 Clock Cycles, Machine Cycles, and Instruction Timing 32 33 Special Function Registers 33 Arithmetic Logic Unit (ALU) 34 Stand-alone Microconuollers 38 Memory Expansion for the 803139 Off-chip Cole 39 Offechip Code, Data, and Parts AL Off-chip Code, Data, Ports, and A-D 45 Port-driven Peripherals (LCD) 43 3 Machine Instructions 49 Data Moving Instructions 59 AccumutatorRegistee 62 Accamulato/Direct 62 Accumutator/Duta 62 Register/Dara 62 Accunarorftudirect 62 RegisterMirect 62 Divecr/Direct 62 Direct/tndirect 62 DirecDaa 63 Indirect(Data 63 Data Poiner/Data 63 MOV 63 Contents xi MOVX 64 XCH 64 Accumulator/Register 64 Accumulator{Direct 64 Accumulator/indivect 64 Stack Insuuctions 65 PUSH 65 POP 66 Branching Instructions 66 Unconditional IMP 66 Conditional IMP 67 Comparisons 67 CINE 67 DINZ 68 Calts 68 ACALL 69 LCALL 69 RET 70 RET 70 No Operation—NOP 70 Logic instructions 70 ANL 70 ORL 71 XRL 71 ceL 7 cLR 71 Rotating 71 RR, RL, RRC, RLC 72 Boolean (Bit) Instructions 72 Flags and Their Uses 72 CLR (Bit) 74 SETB 74 CPL (Bit) 74 ANL (Bit) 74 ORL (Bit) 74 MOV (Bi) 75 Math lastructions 75 Addition 75 Subtraction 16 Other Math 76 Decimal instructions 77 xi Contents, Wrapping Up the Instruction Set 78 Writing Assembly Language 78 Exercises in Assembly tanguage 79 Accumulator/Register BA Accumulator/Direct 84 Accumulator/Data 84 Register/Data 84 Accunulaoritadirect 84 Register/Direct 84 DireetDirect 84 Direct/indirect 84 4 Two Languages 84 Why these two? 84 Variables 86 Shorthand: #define or EQU 88 Memory Spaces 89 Ponts 92 Example: Switches to Lights 92 Bitwise Logical Operators 98 Rotate and Shift 100 Assignment Operators 01 Identifying Bit Changes 102 Arithaetic Operuions 106 Logical Operators. 13 Precedence 14 Review and Beyond 115, § Looping and Branching 117 Decisions 117 Flowcharts 117 Structured Language 118 Branching Constructs 120 iielse 110 Conditional Operator 122 Switch 122 Breaking Ou: The Goto 124 Looping Constructs 124 While Loop 124 Rerative Loop 126 Contents. 128 129 Example: Time delay Review and beyond Arrays and Pointers 130 Arrays 130 Lookup tables Suuctures 134 New Data Types: typedet Array of Stuctures 136 Arrays within Structures 133 136 137 Choosing Memory Spaces for Variables Pointers 139 Universal Poimers 141 Amay Pointers 142 Arrays of Array Pointers 142 Structure Pointers 144 Unions 145 Review and Beyond 146 xi 138, Il FUNCTIONS, MODULES, AND DEVELOPMENT 149 Functions 151 Subroatines, Procedures, and Functions 154 Functions Ease Understanding Drivers 156 Nested Functions 156 Passing parameters 157 Example: Write to LCD Module Writing to LCD From Ports Writing to LCD as Memory Rewrning Values 163 Example: Seana Keybourd 164 Example: Read an A-D Converter In-line Code Alternatives 170 Scope of Variables and Functions Review and Beyond 173 Modular Programming 174 ‘Why Modular Programming? isl 158 158 158 lo7 170 (74 xl Contents Terms and Nemes 174 Sharing variables 178 C Variable Scape Conventions \78 C Function Scope Conventions 179 Assembly Scope Conventions 180 Singie-Language Modules 180 Modular ASMS1 Example: Stepper Driver 180 Mixing Languages 190 Paraneter-Passing Cowentions 191 Compatibiity by Test (92 Mixed Language Example: Stepper Driver 198 Mixed Language Example: Math 203 Libvaries 208 The Standard C Libraries 208 Your Own Librury 209 Functions for a Library 240 Keep Variables Private 210 Function Prototypes in u Header File 210) Marking the Library 211 Shaweuts 244 Code Efficiency 214 Headers for Register aad UO Definitians 216 Offchip Variables 217 Overtaying 217 More abaud Linking 207 Review and Beyond 218 Development and Debugging 219 ‘The Overall Develupment Sequence 220 Developing Software with Vision 221 Defining a Project 224 Insualling Vision 228 Setting Parameters 229 Development Tools 240 Simulatows: DSS1 241 Monitors 246 EET MONITOR PROGRAM V1.8 (ELT Monitor) for 8051 Fumily Microcontrotters 249 Commands to Display and Change Memory. Registers and YO 281 Conteris, Po 10 Running and Debugging Programs 252 NOTES 254 EET Monitor Subrowines 254 Use of C Programs with the EET Monitor 225 Emulators 260 PROM Programmers 261 Debugging Strategies 262 Test Hardware First 263 Test the Processur 263 Test the Ports 263 Growing Software 264 Start Sauall 264 Avoid “Burn and Try” (Develop Fust Ona Higher Powered Relatives 265 Use Breakpoints 265 Use 10 Pins as Scope Trigger Points 266 Review and Beyond 267 IV MULTITASKING 269 Concepts and Terms 271 Beyond Single-Progrum Thinking 271 What Is "Realtime"? 271 Joo 273 Task 274 Privrity. 278 Preemption 274 Multitasking 275, Cooperative Mubtitasking—Rownd Robi 275 Time-stice Multitasking 276 Muttitasking with a Scheduler 276 Priority-based, Preemptive Multinasking 277 Events 277 ime Hardware Requirements 277 immer 277 Juerrupt 278 Real-time Clock 278 Programming Habits For ALL Muitasking 278 Never Wait 278 Real Xvi Contents, Ser Flags 279 Be Sure Variaittes we Glubai an Avoid Sofware Loops 279 Review and Beyond 279 11 Timers, interrupts, and Seriat Ports 281 Countersimers 281 Internal Timer Detaits 283 Example: A Jusee Timer 285 Other Mades 286 Tiner2 286 Ancervupts 288 How an interrupt Works 28% Masking and Inecruye Enables 290 External tntecrupt Hardware 291 Expunding tmerrupts 291 Interrupt Priorities and Latency 293 Comest Switching 295 Real-time Clock 296 Fast Events and High Frequencies 298 infrequent Events and Low Frequencies 299 Ju-beoween Frequeaciey 301 Broad Range Frequencies 301 Serial Ports: The 8051's UART 302 Exuuple: Seriat Buffering 304 Shift Register Mode M0 Ninth-bit Mode 310 Review and Beyond 311 12 Build Your Own Scheduler 312 Example: Traffic Light (Basic Cycle) 312 Example: Traffic Light (With Walk Buttons) 316 More Elaborate Communication 318 Break-out Functions 318 Communication: Shared Variables 320 Nothing w Bo 320 Example: Solenoid Cyclere 321 Exuimplc: Pulse Generator 322 Example: Envelope Detector 324 Contents ali Delayed Tick Due to Overload 326 Catching All Ticks 327 Review and beyond 327 13. Real-time Operating Systems 328 Why an Operating System for Multitasking? 329 How do Operating Systems Really Work? 329 Context Switching 330 Setting Priurity 332 Other Interrupts and interrupt Handlers 333 Resumes, Regions, Pools, and Lists 334 Communication und synchronization 334 Shared Variables for Coumunication 335 Drawbacks of Shared Variables 335 Counting Semaphore 336 Messages with Operating System 337 Coinmercial operating systems 337 DCXSI 337 RIXSIARTXtiny 339 Two Basie Groups of RTOS 339 USX 339 cCMxX 340 Byte-BOS 341 Observations on USX, CMX, and Byte-BOS 344 Benefits of RTOS 342 Casts of RTOS 343 Review and beyond 343 14 Putting It All Together: An Example 344 Circulating Hot Water Pump Controller 345 The Problem: Delayed Hot Water 345 Buckground: Hot Water Systems 345 ‘The Solution: Automatic Purnp Controller 346 Specifications 346 User's instructions 348 iples of Operation 349 Flow Sensor 349 Temperature Sensor 349 Sensor huerface 330 Microcomirotter 351 xvii Contents Multitasking Features 354 Pump Drive 358 Power Supply 358 Status indicatar 359 Mode Switch 359 IV APPENDICES 361 Al AS Ad 363 Numeric Order 363 Instructions Sorted Alphabetically 370 Development with DOS = 377 Source Code Eniry 377 Locating Code and Variables 377 Compiting 378 Assembling 379 Linking 380 Hex conversion 380 Batch Files 381 Space-Reserving Files 382 Libraries 384 Language-Switching Hints 387 Other Assembly to 8051 Assembly 387 PLM taC 388 Standard (ANSI) Cw C51 389 Boards 390 Bank-switening Code 391 PUSS2 Microcontroller Board 393 Hook-up/Connections 396 Operation 399 MCR520 Evaluation Board 400 Switch Settings for the MCBS20 Board 401 Writing Programs far the MCB520 Board 402 imernal Port Avaitability 403 Schematic 403 Other Commercial Boards 405 index 427 Preface 1 you are developing microcontroller-based elec tronics, this book is for you. The objectives of this book ture Wo start you programming embedded applications and to help you develop the mindset of modules and multitasking. Programming examples in this book mostly use iarernat peripheral devices found within the 8051 family of mi- erocontrollers as well as a few common external devices. ‘a companion book, C and the 8051: Building Efficient Ap- plications," 1 apply microcon- tollers to a large variety of peripheral hardware and use more advanced multitasking, mt book assumes you can pro- gram and concentrates on application detaits. Throughout both bouks | em- phasize efficiency and good project development procedures. Despite the contempt of technophiles because they nun slowly. a much less memory, und seldont have elaborate math capability built in, em- bedded microcontrollers continue to be much less expensive than the faster, bigger processors! Insteud of costing the hundreds of dollars of a Pentium- class processor, an 87C750, a complete computer in a 24-pin socket, costs perhaps $4 plus the cost of a crystal’ [ do not want to detract from the im- ress ‘Despite my initial aunbitions, the conspanion book és still very cough. Pre the gout is 1v have the book released before the end of 1998, Hor an example see the final chapler (Chapter 14) where an embedded contuller und dhree other chips make up an entive control system. ice Moll agrees, xix x Preface portance of the high-power areas; rather, | illustrate the ideas and techniques that set the embedded controller field apant from the large-computer-system emphas EMBEDDED MICROCONTROLLERS What js an embedded microcontroller? Like a sliver embedded im your finger, an embedded microcontroller is not visible trom the outside, but it too has a significant effect, Embedded devices are just the opposite of a PC'—no one programs them after they arrive. In a microwave oven, for ex- ample, the embedded controller comes programmed knowing which output tusns on the oven, which input comes from the door interlock, and so on. Day after day the controller runs the same program—the chip in the mi crowave will never control automobile ignition or play a video game be- cause it is pre-programmed. You could program the same nype of chip for those other jobs, but the embedded one in the microwave is not a general- purpose computer. ‘An embedded reat-time controller probably runs only one program for its entire lite. It must be always reudy 10 handle any number of inputs and outpucs at the “same” time, Unlike a PC, the hardware is more likely to be switches and solenoids than disk drives and keyboar The software examples in this book relate 10 rather than to general-purpose computers for data tna nbedded conte: lation ur graphics. There is still a comer of the programming field where the efficient ap- proaches developed with sinall, dedicated microcontrollers are best. You do ot need aw elaborate set of print functions in a system where the only aut- put isa few LEDs and a motor! ‘a PC oF personal computer iy aol conceptualty diferent fivmt an embedded conn While ifs now much more complen, it fas the same architecture as a anicrocootnfes, suns programs jn the same way (but faster), and has input and ouipos, ‘The difference is Ua you use a PC to do vifferent things at different times. You would have a problem if your cat en- zine controller instead chose to plot graphics far a while, Typiest inputs and outpuns are dif- event tos. With u PC you usually supply iupat from a keyboard or mause and output goes a display or printer. You also involve large amounts of storige—Boppy and hurd disks, demanding ‘appticatioas and might even be the same processors, but the fiwelamental dtterence is the dedicuied wature OF the system. AS evidence oF their equivalence, there is oceasionsh tk of Duiting telephone switching systems (embedded processors or sure) 10 use in the off hours dog business computing. backup tapes, and CD-ROMs. Embedded contvollers cae do all of these th Preface xxi FOR MORE THAN THE 8051 FAMILY? This book concentrates on the 8051 family. Trying to cover all the different miceacontroliers (68HCH, PIC, 8096, 68HC16, etc.) would make the exam- ples very confusing since the assembly languages and the hardware specifics differ. However, concentrating on only one processor limits the number of people that cun use the book. By discussing the principles in- volved with floweharts and pseudo-code before the specifics of the exam- ples, [ keep the examples us broad as possible. If you can find an appropriate C compiler, you can easily transfer the C examples, despite the 8051 lan- guage extensions, to other microcontroller families. Since most microcontrollers have similar internal timer and port few tures, the examples using internal features can often be adapted. While dit- ferent commands set up the timers, and interrupts may behave somewhat difterently, the basic principles remain the same. IS THIS BOOK FOR YOU? Students—Classes You can use this book in both begining and advanced micrucumtrotlye classes. The first section introduces you (o the busies of computer hardware and programming. Chapter 3 covers assembly tanguage and Chapters 4 10 6 cover basic programming constructs. It helps to ttave prior programming ex- perience (ao matter what the language) but you can use this book to first learn programming in either assembly language or C. An assembler and linker as well as a full-teatured but code-size limited version of a C com: piler comes with this book. 'The circuit boards used in the examples are easy 1 obtain for lab, classroom, or home use. Students—Design Projects Ina design course, this book can get you started putting a micro to in- telligent use in your project. Blegant design is far different from relying on raw computing power and speed. The software and, the available boards supply all you need to get going with embedded controller development.* If "W you atready knaw programming, the companion book, Canal the SUS4- Buibling kficicat plications, is probably 9 more useti reference. Jt is rich in application examples, ci ieas and schematics. Ifyou are going to kip to the curnpanion book, yeu shoud be familiar with ether C or assembly programming for the BOS1 Family. xxi Preface you ure guing lo build ur adapt the elvetronie applications, you should have some knowledge of cieuit breadboxtding and assembly techniques. Know!- edge of digital and analog etectronics would help too! Engineers/Developers Engineers or system designers producing small embedded applications should find this book and the companion immediately applicable. Lf you are the sort of person who prefers to learn through the practical hardware- oriented examples and who may be looking for new ways to replace existing hardware with a micro, this is the book to bave.> if you are already developing 8051 embedded systems, you may still benefit from the sections on modular programming and multitasking. Also knowing the Keil/Frunklin tools (Chapter 9) might be wsetul—things have changed signiticamly fiom the DOS-bused ols of a few years Self-Taught Home Experimenter Sf you are an “experimenterfhobbyist,” you want to see interesting ap- plications running right away—aot read about fine points of design. Despite some reviews of the previous edition, this book is not really just a “de- signer's book.” Unlike most engineering fields, advanced math and college training are not very important with microcomoller applications. You might want (0 start by getting or wiring up the example board and trying the pro gramming examples. Since the software comes with the book, once you have the board, a serial cable, and a PC, you have all you need to get started. Unlike most magazine-urticle projects, with the software and infor- nation from this book, you will not have to buy a pre-programmed EPROM for your projects—you will be writing your own! No matter which group you put yourself in, you need a book of ideus along with enough specifi is my goal. s to gei going without a lot of wasted effort. That Especially in the companion bock # deseribe dew approaches you eat stare away tr future projects Axa home experimenter you ute probably already experienced with eleeumnic eomssuetion, 80 you can alake good Use ofthe companion book Fall of applications and some are to g0 tern. Hieface xxiii THE INCLUDED SOFTWARE Yue disk included with this book kas Keil’s assembler, C compiler, linker. The C compiler is full-featured but the supplied linker only allows °K of code, Companies such as Keil still hope to make their living selling the software to industrial developers. You can compile larger programs 1 check code size, but for the final code produetion, you will have to make an culditional purchase.” If you wai copies of the software examples from the hook, Keil has indicated a willingness to make them available for down- Joading over the Internet. THE AVAILABLE HARDWARE Of the examples in the book fit the Iwo microcontroller boards de- seribed in Appendix A4. You may purchase the two boards only in popu- latedested form. 1 was hoping to include a blank board with every book, hut economie and marketing realities reduced that to schematics. * WHAT THIS BOOK IS NOT This book is not a general book on computing. A begianet’s tutorial ot pro- imming is different from this book covering computer hardware, machine instructions, and the C language. There may be books that de a more thorough job with the details of as- sembly language programming. While F have included numerous assembly tly digger version is available from Keit Soliwive fur a few hundred Uollars. The compiler is urmong the best on the market for the 8051 funnily, but the full professional ver- soit (as well as all the competing professional products) sells for beiween $1,000 and $2,000. There are sone less expensive compilers, but they tack features or behave much less eifi- cicutly withthe (rather unusual) architecture ofthe 8051. You may also centuct the author by ielephone a: (765}494-7724 or by e-mail at twschult-@tech,purdue edu “You have « schematic in the appendix if you feel quatified to wite your own bound, but tr ‘Meshooting (if something doesn’t work cight away) requires equipment you might not have. “The original plan was to supply the copper pattern and offer bare boards x0 you could build sxpilicas of the pre-buill board. Keil has indicated a wilfingness to offer bundled packuges uf mruliple (assembled) boards and software tools for schol use and | expect Rostek would Jo the same, SECTION | Beginnings ‘Stunt here if you nved « foundation in computer architecture andl machine in- as. This section starts with the basic 8051 hardware and ihe instructions. Knowing the instructions is not the sume as knowing how tw program any more thay kaowing the wiphaber means you can read a lun guage, but it is a good place 10 start. Chapter | introduces the area of embedded contollers and their pro- gramming. Chapter 2 works backward from a © program to the computer architec- lure and digital fogic showing how: 1) machine (assembly) instructions arise from a © program you might write: 2) machine instructions arise out of computer architecture; 3) computer architecture comes from arrangements digital gates. it you have had no expesure to computer hardware, I suggest you skim (Chapters 2 and 3 before going on (o Chapter 4. Although Chapter 3 discusses assembly language instructions, Ldo not do much with them there—not much putting them together to make programs. Understanding Chapters 2 and 3 is not absolutely necessary to write C programs tor the 8USt. However, while peopte speak of writing “platform-indepencient” (ANSI stataland) C. the 8051 eurd wae is too nonstandard o get efficient programs that way. Chaplers 4 uirowgh 7 cover the (wo tunguages Featured C und assenn- bly fanguuge. Alier the inost basic constructs, they describe looping. and branching (Chapter 5) sind urays (Chapter 6). Here is where | 20 over pro- gia constructs-—the things you da regardiens of the language involved, 1 show all the examples in Cand usually in assembly as well, 1 Introduction WHAT IS AN “8051”? The 8051 number applies generically to a family of microcontrollers that was the successor to the 8048—the first single-chip microcontroller. The original version of the 8051 developed by Intel has been on the market for over fifteen years.' The architecture and instruction set of the 8051 live on in what is now a large family of derivative microcontrollers having more code space, more timers, more interrupts, and more peripherals. Dallas Semiconductor has developed versions that take the same instructions but run in fewer clock cycles and have additional architectural features. Both Intel and Phillips have developed 16-bit “relatives” that are direct migration paths in that they are either code or assembly-language compatible.” Going the other direction, Philips has developed derivatives that are smaller and less expensive. The wide base of development tools and experience with the 8051 family has made it the most common choice for middle-of-the-road projects needing embedded control. "Because of growing expectations, many commercial applications no longer fit in the original 4K on-chip code space. Some applications no longer even fit in the 64K total addressable code space and have gone to switching between banks of memory, discussed in Appendix AA, “Intel's 80C251 family and Philips’ 8051XA. 4 Section | Beginnings MICROCONTROLLERS The distinction between a microcontroller and a general purpose computer or microprocessor is not a sharp one. They all have a processor as part of the system to run the program—looking at each instruction to decide what to do, doing it, and going to the next instruction. To be useful, the processor must have memory and input/output (I/O) capability as well. If this is mostly on one chip, it is called a microcontroller. If, along with the micro- processor chip, you need several other chips for bus interface, memory, and V/O, the entire system is a microcomputer’ Most programs can run on any of the 8051 family. While the book’s title mentions the 8051, the examples, particularly in the companion book, show many other members of the continually growing family of related devices. The basic “core” remains the same—the differences relate to the built-in pe- ripherals. This book works almost totally with the basic 8051 features.’ Most examples are applicable to the entire family because they rely on the 8051 core.’ +A chip is another term for an integrated circuit (IC). The name comes from the fact that a thin, round slice of silicon (a wafer) is optically, chemically, or electronically treated to get a lot of repeated circuits. Then the wafer is cut apart into lots of individual, rectangular circuits somewhat like the chips of wood that come from chopping down a tree. These chips are mounted in plastic or ceramic chip holders with wires leading out to the legs for the conven- tional dual inline (DIP} packages, or in much smaller configurations for the newer surface- mount devices. “A minicomputer was a higher performance computer made up of even more, faster chips, but the term has died as microcomputers have increased in performance. ‘In the companion book some applications, where small size and low cost are important, use the 87C750. Other applications there use additional features of the 517, 552, or 558. Still other applications illustrate the memory features of the DS5000 series with on-chip “off- chip” code and data RAM. Where the attention is on analog interfacing, some examples use the on-chip AD and DA found in some of the devices. I supplement these with examples using traditional add-on devices. The part on timers now includes examples of more ad- vanced timer modes available. One section in the companion book deals specifically with the PC Bus devices. “Other microcontroller families: Today, most embedded applications use 8-bit controllers— they give a high level of flexibility without the high cost. The leaders in this area are proba- bly the 8051 family and Motorola's 68HC11. Some of these processor cores are so common in low-to-medium performance applications that they come in an ASIC (application specific integrated circuit) design library much the same way as you could add a flip-flop or counter design to a custom-integrated circuit, The 8051 really has become a standard in the micro- controller world, If you need high-end (high-speed) capability, there seem to be new 16- and 32-bit con- trollers coming out ycarly with no clear “winner” as of-yet. Interestingly enough, Intel has re- cently developed the 16-bit 80C251 microcontroller that retains code compatibility with the

Вам также может понравиться