Example: bachelor of science

THE 8051/8052 MICROCONTROLLER - Official Site

THE 8051 /8052 MICROCONTROLLER Architecture, Assembly Language, and Hardware Interfacing Craig Steiner Universal Publishers Boca Raton, Florida USA 2005 The 8051 /8052 MicrocontrollerArchitecture, Assembly Language, and Hardware InterfacingISBN: 1-58112-459-7 Author: Craig SteinerCover Photo and Design: Erika Oliden Gonz lez ,storedina retrievalsystem,ortransmitted,inanyformo rbyanymeans,electronic,mechanical,photoc opying,recording, or otherwise, without the prior written permission of the ,brandnames,trademarks,servicemarks,logo s,orregisteredtrademarksusedinthisbook are the property of their respective owners and are hereby acknowledged. Universal PublishersBoca Raton, FL USA ErikaPrefaceDespiteitsrelativelyoldage,t heMCS-51(8052) andarecompatiblewith animportantskillforanyonethatplansto develop MICROCONTROLLER -based ,hobbyist, you'llbedevelopingyourprogramin'C',a workingknowledgeoftheunderlyingarchitect ureaswellasthemicrocontroller'sassemblyl anguageis extremelyimportantinwritingefficientcode thatwillseparatea typical'C'programmerfroma farmoreversatileembedded 8052 software book will explain the 8052 architecture step by st

THE 8051/8052 MICROCONTROLLER Architecture, Assembly Language, and Hardware Interfacing Craig Steiner Universal Publishers Boca Raton, Florida

Tags:

  Microcontrollers, 5820, The 8051 8052 microcontroller, 8051

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of THE 8051/8052 MICROCONTROLLER - Official Site

1 THE 8051 /8052 MICROCONTROLLER Architecture, Assembly Language, and Hardware Interfacing Craig Steiner Universal Publishers Boca Raton, Florida USA 2005 The 8051 /8052 MicrocontrollerArchitecture, Assembly Language, and Hardware InterfacingISBN: 1-58112-459-7 Author: Craig SteinerCover Photo and Design: Erika Oliden Gonz lez ,storedina retrievalsystem,ortransmitted,inanyformo rbyanymeans,electronic,mechanical,photoc opying,recording, or otherwise, without the prior written permission of the ,brandnames,trademarks,servicemarks,logo s,orregisteredtrademarksusedinthisbook are the property of their respective owners and are hereby acknowledged. Universal PublishersBoca Raton, FL USA ErikaPrefaceDespiteitsrelativelyoldage,t heMCS-51(8052) andarecompatiblewith animportantskillforanyonethatplansto develop MICROCONTROLLER -based ,hobbyist, you'llbedevelopingyourprogramin'C',a workingknowledgeoftheunderlyingarchitect ureaswellasthemicrocontroller'sassemblyl anguageis extremelyimportantinwritingefficientcode thatwillseparatea typical'C'programmerfroma farmoreversatileembedded 8052 software book will explain the 8052 architecture step by step so that someone just beginning to use the 8052 maygeta usefulreferencethatwillassistboththenovi ceprogrammer as well as the experienced developer long after the architecture has been specific knowledge of the 8052 is required but the book does assume the general and conceptual knowledge of understanding of decimal, hexadecimal, and binary number systems.

2 ,thoughnopriorknowledgeofthe8052 IC is microcontrolleris,thenfocusonthedetailso fthe8052microcontroller, 'llthenprovidea designfora workingsingle-boardcomputer(SBC) the SBC's hardware and describe a "monitor program" which can be used to control it. Thereissomeoverlap,however, ,thereferencestoassemblylanguageinstruct ionswillbebrief,well-commented,and,hopef ully,understandableinthecontextofthearch itecturethatis anassemblylanguageinstructionusedinthefi rstfewchaptersisn'tclear orifyou'reanxioustoreadmoreabouttheinstr uction 'tfeelthatyoumustreadtheentirebookina strictlysequential wouldcordiallyinviteyoutovisitmywebsite, , whereyouwillfindadditionalresources,exam plesourcecode,anda messageforumwitha usercommunityofover12,000peoplethatexcha ngeideas,comments,questions,andanswers on the 8052 ,I wouldinviteyoutosubmitanycomments,sugges tions, listoferrataandcorrections for the book will be found at ,ofcourse,I ,Iwouldliketospecificallythankthefollowi ngpeoplefortheirassistance.

3 GerardSteiner,SteveTaylor,AgustinDomingu ez,ErikMalund, MichaelKaras, wasproof-readingthemanuscript,providingf eedbackoncircuitdiagrams,orsimplytolerat ingthelonghoursI putinwriting this book, their help and support was of Contents8052 1: INTRODUCTION TO 8052 What is a MICROCONTROLLER ?.. MICROCONTROLLER Program Loading a MICROCONTROLLER What is an 8051 or 8052?.. Derivative Using Windows or 2: TYPES OF Code Memory External On-Chip Internal Special Function Register (SFR) 3: SPECIAL FUNCTION REGISTERS (SFRs).. Referencing Referencing Bits of Bit-Addressable SFR SFR Other SFRs for Derivative 4: BASIC "R" "B" Program Counter (PC).. Data Pointer (DPTR).. Stack Pointer (SP)..23 CHAPTER 5: ADDRESSING Immediate Direct Indirect External External Code 6: PROGRAM Conditional Direct Direct Returns from 7: INTERNAL iiiCHAPTER 8: How does a timer count?

4 Using Timers to Measure How long does a timer take to count?.. Timer Timer Mode (TMOD) Timer Control (TCON) Initializing a Reading the Timing the length of Using Timers as Event Using Timer Timer 2 Control (T2 CON) Timer 2 in Auto-Reload Timer 2 in Capture Timer 2 as a Baud Rate 9: SERIAL Serial Control SFR (SCON).. Serial Mode 0: 8-bit Shift Register, Oscillator-based Baud Serial Mode 1: 8-bit UART, Timer-based Baud Serial Mode 2: 9-bit UART, Oscillator-based Baud Serial Mode 3: 9-bit UART, Timer-based Baud Configuring the Serial Setting the Serial Port Baud Writing to the Serial Reading the Serial Using Timer 2 for Serial Port Baud Serial Communication Sample 10: Events that can Trigger Configuring Polling Interrupt Interrupt Exiting Specific Interrupt Timer 0 and Timer 1 External 0 and External 1 Serial Timer 2 Register Locating Large ISRs in Common Problems with Functional Interrupt 11: 8052 ASSEMBLY Number Operator Characters and Character Assembly Language Setting the Address of Program Assembly (ORG).

5 Establishing Symbol Equates (EQU).. Inserting 8-bit Data In Program (DB).. Inserting 16-bit Data In Program (DW).. Changing Program Flow (LJMP, SJMP, AJMP).. Subroutines (LCALL, ACALL, RET).. Register Assignment (MOV).. Incrementing and Decrementing Registers (INC/ DEC).. Program Loops (DJNZ).. DJNZ With More Than 256 Setting, Clearing, and Moving Bits (SETB/CLR/CPL/MOV).. Bit-Based Decisions & Branching (JB, JBC, JNB, JC, JNC).. Value Comparison (CJNE).. Less Than and Greater Than Comparison (CJNE).. Zero and Non-Zero Decisions (JZ/JNZ).. Performing Additions (ADD, ADDC).. Performing Subtractions (SUBB).. Performing Multiplication (MUL).. Performing Division (DIV).. Shifting Bits (RR, RRC, RL, RLC).. Bit-wise Logical Instructions (ANL, ORL, XRL).. Exchanging Register Values (XCH).

6 Swapping Accumulator Nibbles (SWAP).. Exchanging Nibbles Between Accumulator and Internal RAM (XCHD).. Adjusting Accumulator for BCD Addition (DA).. Using the Stack (PUSH/POP).. Setting the Data Pointer DPTR (MOV DPTR).. Reading External RAM/Data Memory (MOVX).. Reading Code Memory/Tables (MOVC).. Using Jump Tables (JMP 12: 16-BIT MATHEMATICS WITH THE How did we learn math in primary school?.. 16-bit 16-bit 16-bit 16-bit HARDWARE & SINGLE BOARD 13: 8052 MICROCONTROLLER PIN I/O Ports (P0, P1, P2, P3).. Port Port Port Port Oscillator Inputs (XTAL1, XTAL2).. Reset Line (RST).. Address Latch Enable (ALE).. Program Store Enable (-PSEN).. External Access (-EA)..117 CHAPTER 14: AN 8052 SINGLE BOARD COMPUTER (SBC).. Features of the SBC MICROCONTROLLER : Atmel AT89S8252, Dallas 89C420, or 8052 (U1).)

7 Latch: 74LS573 (U2).. Address Decoder: 74LS138 (U5).. EPROM Code Memory: 27C256 (U3).. Static RAM: 62256 (U4).. LCD: Memory-Mapped (J3) and Direct Connect (J4).. Keypad Connector (J5).. DS1307 Real Time Clock (U13).. AT25010A Serial EEPROM (U14).. Reset Circuit: RC Network, MN13811 Reset Supervisor, and Manual RS-232 Transceiver: Power Connector, Rectification, and Voltage In-System Programming (J2, J6, U11, U12).. Port Connections (J7 J10).. Power, Ground, and other Signal Connections (J11).. Latched Low Byte of Address Bus (J12).. Power Jumper (JP7).. Other 15: SOFTWARE DEVELOPMENT Introduction to Pinnacle 52 Integrated Development Pinnacle 52 Environment Creating, Loading, and Saving Editor Assembling a Loading a Program for Simulating a Program in Pinnacle Pinnacle's View of Registers and Execute Simulator Concept of Projects in Pinnacle Creating Editing Building Project Relocatable Code in Pinnacle The Problem of Absolute Code in Multiple Source Relocatable Initialization and Interrupt Vectors with Relocatable When to Use Relocatable Multiple Source Files in Pinnacle 16: HARDWARE DEVELOPMENT Device Programmers.

8 Using a Device In-System Using In-System In-Circuit Using ICE Within a INTERFACE AND SOFTWARE 17: SBCMON MONITOR Installing Configuring the PC Terminal Powering up SBCMON Main Command 'A': Command 'C': Read/Set Real Time Command 'E': Read/Write Serial Command 'I': Read/Write to Internal Command 'K': Keypad Command 'L': Load HEX File into SBC Command 'M': Set LCD Access Command 'Q': Quick HEX Load and Command 'R': Run (Execute) Code at Specific Command 'V': Verify External Command 'W': Write Text to Command 'w': Write Commands to Command 'X': Read/Write to External Writing Programs that Execute in Using SBCMON Library Routines in External Using Interrupts in External Programs with Using Timers in 18: INTERFACING TO 4x4 Direct Connection of Memory-Mapped Connection of Reading and Debouncing 19: INTERFACING TO LCD Electrical Direct 8-bit Connection to Controlling the LCD's EN Checking the LCD's Busy Initializing the Clearing the LCD Writing Text to the An LCD "Hello World" LCD Cursor Direct 4-bit Connection to Writing a byte to LCD in 4-bit Reading a byte from LCD in 4-bit Memory-Mapped Connection to Electrical Connection of Memory-Mapped Writing to the LCD in Memory-Mapped Reading from the LCD in Memory-Mapped Additional Notes about Memory-Mapped 20: INTERFACING TO SERIAL EEPROM (SPI).

9 General Information about Serial Peripheral Interface (SPI).. Coding for SPI Additional Information about SPI Software Communication with AT25010A Command: Write Byte (WR).. AT25010A Command: Read Byte (RD).. AT25010A Command: Set Write Enable Latch (WREN).. AT25010A Command: Read Status Register (RDSR)..266 CHAPTER 21: INTERFACING TO REAL TIME CLOCK (I2C).. General Information about Inter-IC (I2C) Coding for I2C I2C Communication with the Sending Data to Receiving Data from the DS1307 Software Communication with Setting the DS1307 Reading the DS1307 22: ADDITIONAL SOFTWARE Reading the Value of the Program Power Saving Idle Power-Down Software-Based Real-Time RTC Crystal Calculating Timer 0 Overflow Starting Timer Configure Timer 0 Writing the Timer 0 Interrupt Service Additional Comments about the & A: 8052 Instruction Set B: 8052 Instruction C: SFR Quick D: SFR Detailed Reference (Alphabetical).

10 Ix8052 ARCHITECTURECHAPTER 1: INTRODUCTION TO 8052 MICROCONTROLLERSM anydevelopersnewtomicrocontrollers,inclu dingthe8052,comefroma , ,specifically,the8052,we lladdresssomecommonstumbling What is a MICROCONTROLLER ?Amicrocontroller(oftenab breviatedMCU) isa singleintegratedcircuitthatexecutesa userprogram,normally for the purpose of controlling some device hence the name MICROCONTROLLER . Microcontrollersarenormallyfoundindevice ssuchasmicrowaveovens,automobiles,keyboa rds,CDplayers,cellphones,VCRs, securitysystems,time&attendanceclocks,el ectronictoys, 'trequiresomuchastojustifytheuseofamorec omplexandexpensive486orPentiumsystemwhic hgenerallyrequiresa largeamountofsupporting circuitry and memory. A microwave oven just doesn t need that much processing ,morereliable, is almostalwaysdesirabletoproducedesignstha tutilizethesmallestnumberofintegratedcir cuits,occupythesmallestamountofphysicals pace,requiretheleast amount of energy, and cost as little as MICROCONTROLLER Program StorageTheprogramfora microcontrollerisnormallystoredona memoryIC calledanEPROM orinthemicrocontroller IC (ElectricallyProgrammableReadOnlyMemory) isa specialtypeofICthatdoesnothingmorethanst oreprogramcodeorotherdatathatis notlostwhenpoweris ,softwarefora microcontrolleris assembledorcompiledona PCandis subsequentlyprogrammed(or burned )


Related search queries