ebook img

The AVR Microcontroller and Embedded System by Muhammad Ali Mazidi PDF

781 Pages·2012·42.76 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview The AVR Microcontroller and Embedded System by Muhammad Ali Mazidi

the avr microcontroller and embedded system using assembly and c MUHAMMAD ALI MAZIDI SARMAD NAIMI SEPEHR NAIMI the avr microcontroller and embedded systems using assembly and c MUHAMMAD ALI MAZIDI, SARMAD NAIMI, AND SEPEHR NAIM! meiner CHAPTERS train Atme! is one of the 0, Introduction to Computing Bic tesstcchi uses sbi 1: The AVR Microcontroller: distory and merecontles inthe aes ‘world, In this book the et ee ener. 2: AVReArcitecure and Assembly Language tel tematic approach 10 Programming show the orogrmming of 3; Branch, Call and Time Dilay Loop Snes, are 4: AVRO For Programmi both Assombly language 5: Arthmatic, Logic Instructions, Se eee aes Anon many of the AVR lestutes, such as temas, serial communication, ADC, SPI 120, ane PIM. The text 6 AVR Advanced Assembly Language Programming organized ito two paris 7 ANR Proaramming in C 8: AVRHarcware Connection, Hox Hl, ard + The fist seven chapters use Assembly language Flesh Loaders Brogramming to examine the intemal rcitecture of AVR Tner Programing in Assembly anc'C the ave gait y = Chopters 7-18 use both Assembly and C to show the oe Ave Kareena ere AVR peripherals and W/O interfacing to real-world ad eee a lel coors sccinere 11: AVR Sera Por Programming in Assembly Ihe AVE Microcentoler anc Embeds Systoms 12 LED ard Keyboard interfacing latest wound in the sores of textbooks by Marc et 13: ADC, DAC, and Sensor Interiscing This sevies of texts i widely used around the world by 1 pa See aera ctor beth cy rd cade as beer vareted nonmunatees inte many languages. The otha tls in she series ae oo The 386 Poth e) 15 eee eee The A051 Misrocontroer and Embedded Systems 16: PWM Programming and GC Mator Qrded) Control in AVR The PIC Merocontroller and Embedded Systems 17: SPL Protocol and MAX721 Display The HCSI2 Merocontrollr anc Embed Systems rterfae ng 18: |2C Protocol and DS1307 RTC Interfacing Tiles te come include The ARM Microcontrllar and Embedded Systems Save *o3do0asr 8 EARSON a Waorsetoogs! a vem pearsonhighered.com THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS Using Assembly and C Muhammad Ali Mazidi Sarmad Naimi Sepehr Naimi Prentice Hall aston Cokimbos tnaiunapotis New York San Panchen Amite Thal Mai 3y Sie Paulo SsUaxy Hoop Kong Sosa) Singspor Talpsl Tokyo Edltor in Chlef: Vornan Anchony Project Manigers Rex Davidun ‘Acquisitions Balter: Wyatc Boris ‘Seninr Operations Supervisor: Pat Tonnemun atari Assistant: Chris Reed Operations Spectalist: Laws Wesver Director ef Marketing: Duvid Gesell ‘Art Diseetor: Dinane Erasberger Barketbng Manager: Kora Clarke Cover Designer: Felt Vanik Senior Managing Coordinator: Alicia Cover Art: Antonis Papantoniau, Fotali.on Womnink Paluter/Binder: CowsieKendallvile Marketing Assistant: Les Raberts ‘Cover Printer: Densand Production Center Senior Managing Kigitor: Jobllan Gabe Text Fo: Times Ronan Copyright #201 Pearson Udavatun, Ine, publishing os Prentice Hall, | Lake Steet, Upper Saidle Rive, Naw Jersey, 17458. All ight eserved. Manutuctured ip the Uniled States of America. This publivuloa is protected by Copyright, and permission should be obtained fic the publisher priur to any prahibitedreprouuctiou, forage ia a ¢Cuievalsystom, or rancmisiem in any frm ar hy ary ‘means, slecwoniv. mechanical, phulocupsing, exurdiag, oF Hkewis, To bain periisson(s) nse ‘material fom chis work, please submit wile requea 1 Pesesoo Edveation, Ine, Peumissions Departueat, 1 tke Sess, Lipper Salle River, New Tersey, O7458 Library of Congyess Cataloging in Fa Mazidi, Mubammad AB, ‘hy AVR microouoleoller abl embades system: using Assembly and € Muhammad Al Musidi, Sunol Nex, Sepeba Sait yer ISBN. (3; 978-0-13.800831-9 (afk. paper) AS16510: 0-13-8000 (ak. paper) {. Atmel AVR mictocumteolle. 2. Embedded comes systems, 3, Assembler language {sComporer program Innguags) 4, ¢: (Computer program language) I. Nai, Samad. 1, Nalni, Spel MU. Tie ‘TRS PISMIzELG 2008 6122 2009439700 w9eTes4a2 Prentice Hall is an imprint of see: pentsoubighered som ISBN 10: 0-13-800381-9 ISBN 13: 9790-13-08 This book ix dedicated 1 she memory of Dr: Kamat Bakboavar for ult his sacrifices = Muhammad Al Madi his book is dedicated ho tha means of Dr. P Savi Jor his inspiring ecumple of dedication to the education of young peopie. Sarma Saini This book is dediated to Fara = Sopelr Naini Regard man as a mine rich in gems of inestimable value. Education can, alone, cause it to reveal its treasures, and enable mankind to benefit therefrom. Baha'u'llah BRIEF CONTENTS CHAPTERS. reduction to Computing, The AVR Microcontroller Cistary snd Fences AVR Arshncenure and Assembly Language Prugrumming, Brauch, Call, and Time Delay Loop AVR VO Port Programing ‘Acithentic, Logic Tnstrueluns, and Progeans AVE Advanced Assembly Language Programming AVR Programming in © AVR Tlardwvare Connection, Hex File, ara lash Lauds AVE Timer Programming in Assembly and C AVE Interapt Pragracanig ia Assembly and C AN Serial Por Programming in Aaserably and C TCD and Keyboard fterfacng ADC, DAC, and Sensor Imcefacing Relay, Opteigoltor, aad Stepper Motor Interfacing with AVR Input Capture und Wve Generlivn in AVR PWM Programming and DC Motor Contol in. AVR SPL Protocol and MANT221 Dasplay Interfacing, TRC Protocol sed DSI307 RTC Imcracing APPENDICES TOnmeee AVR Insurvctions Explained lunes of Wine Wrapping Ic: lnerfing and System Desiga Tasues Flowchars and Pasadccode AVE Princ for MIST Progearnaers ‘ASCH Cos Assemblers, Development Resonnces. and Suppliers Data Sheets CONTENTS CHATTER 0: INTRODUCTION 19. COMPUTLY! 1 SECTION 0.1; NUIBFRING AND CODING SYSTEMS 2 SECLION 0.2: DIGITAL PRIMER. 6 SECTION U3: SEMICONDUCIOR MEMORY ry SFETION Oot: CPL’ ARCHITEC URL 2B CUAPTER 1: THE AVR MICROCONTROLTER: HISTORY AND, FEATURES. » SHCITON 1.1: MICROCONTROLLERS AND EMBEDDED PROCESSORS a SECTION 1.2: OVERVIEW OF THE AVR FAMILY “4 (CHAPTER 2: AVR ARCHATHCTURE AND ASSEMMLY LANCCAGE PROGRAMMING 55 SECTION 2.1: TIE GENERAL PURPOSE REGISTERS INTHE AVR 56 SECTION 2.2: THE AVE DATA MEMORY 5 SECLION 23: USING INSTRUCTIONS RITIETHE DATA MEMORY — GL SECTION 24: AVR SUSI US KRGISTER SECTION 2.8; AVR DATA FORMAT AND DIRECTIVES SUCLIOS 26 INTRODUCTION 70 AVI. ASSEMBLY PROGRAMING SECTION 27: ASSEMBLING AN AVR TROCRAM fe SFCTION 24: THE PROGRAM COUNTER AND PROGRAM ROM, SPACE IN THE AVE 85 SECTION 29: RISC ARCHITECTURE IN THE AVE 8 SECTIDN 2.10: VIEWING REGISTERS AND MEMORY WTTH AVE ‘STUDIO IDE o CHAPTER 3: BRANCH, CALL, AND TIME DELAY LOOP wr SECTION 3.1: BRANCH INSTRUCTIONS AND LOOPING We SECTION 3.2: CALL INSLRLCLIONS AND STACK ue SECTION 3.3: AVR [IME DELAY AND INSIRUCIIOS PIPELINE 128 CHAPTER 4: AVK VO PORT PROGRAMMING. 8 SUCHION 4.1: FO BORY PROGRAMMING IN AVI. ho SECTION 42: EO DIT MANIPULATION PROGRAMMING re CTIAPTER 5: ARITITMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS 161 SECTION 5.1: ARITHMETIC INSTRUCTIONS 162 SECTION 52; SIGNED M1. MEEK CONCLBTS AND ARITIIMETIE OPERATIONS m0 SECTION 5.3: LOGIC AND COMPARE INSTRUCTIONS 16 SECTION $4: ROTATE AND SIT INSTRUCTIONS AND DATA SERIALIZALION 1 SECTION 5.5; BCD AND ASCU CONVERSION 190 (CHAPTER 6: AVR ADVANCED ASSEMBLY TANGUAGE PROGRAMMING 197 SECTION 6.1: INTRODUCING SOMb MORE ASSEMBLER DIRECTIVES 18 SECTION 6.2: REGISTER AND DIRECT ADDROSSING MODES 202, SECTION 6.3: REGISTER TSDIRECT ADDRESSING MODE. 208 SRCTION 6.4: LOOK-UP LABLE AND TABLE PROCESSING 26 SECTION 43: BIT-ADDRESNABILILY 226 SECTION 6: ACCFSSING EPROM IN AVR 23 SCELION 6.2: CHECKSUM AND ASCIC SUBROUTINES me SEETION 6.8: MACROS 2d CUAPTER 7: AVR PROGHAMMING INC SECTION 7.1: DATA TYPES AND TIME DELAYS INC SEA:TIOS 72: FO PROGRAMMING INC SECTION 73: LOCIC OPERATIONS INC SECTION 7.4 DAA COS VERSION PROGRAMS INC SECTIOS 7.5. DATA SBRIALIZALION INC MEMORY ALLOCAIION INC CHAPTER #: AVR HARDWARE CONNECTION, HRN FILE, AND FLASH LOADERS, SECTION §.[: ATVEGA32 PIN CONNECTION SECTION $2: AVR FUSE BITS SECTION §.3: EXPLASNING THE BEX FTLF FOR AVR 300 SECTION ft: SVR PROGRAMMING AND TRAINER BOARD 30s CTIAPTER 9: AVR TIMER PROGHAM WING IN ASSEMBLY AND C SECTION 9.1: PROGRAMBIING TIMERS 0, , AND2 SECTION 9.2: COUNTER PROGRAMMING: SECTION 9.3: PROGRAMMING TIMERS B.C (CHAPTER 10: AVR ENTERRUPT PROGRAMMING IN ASSEMBLY ANDC 363 SECTION 10.1: AVA INTERRUPTS 364 SFCTION 1.2: PROGRAMMING ITMER. INTERRUPTS 368 SECTION 1.3: PROGRAMMING LXTERNAL HARDWARE IWTERRUPTS 3% SUCTION 1IL4: (\ FERREPT PRIORITY 1 THE AVR 381 SECTION 1115: [NTERRLPT PROGRAMMING INC 38S CTTAPTER 11: AVR SERIAL FORT PROGRAMMING IN ASSEMBLY AOC 395 NECHION 11.1: BASICS OF SERIAL COMMUNICSIION, 396 SECTION 11.2: I MEGA22 CONNECTION TO R522 oa SECTION 10.3; AVR SERIAL, PORT PROGRAMMING IN ASSEMBLY 405 SECTION 114: AVR SERIAL PORT PROGRAMMING INC a9 SECTION ILS: AVR SERIAL PORT PROGRAMMING IN ASSEMBLY AND C USING INJERRUPTS a (CHAPTER 12: 1.CD AND KEYROARD INTEREACING aa SBCLIOS 12.1: LCD INTERFACING 430 SBCTIOS 122: KEYROARD INTERFACING 432 CHAPTER 13: ADC, DAC, AND SENSOR INTERFACING 43 SECTION 13.1 ADC CHARACTERISTICS on SUCTION 132; ADC PROGRAM MING IN FHE AVL 469 SECTION 13.3: SENSOR INTERFACING AND SIGNAL’ ‘CONDITIONING SUCTION 13.4: DAC INTEREACING (CHAPTER I; RELAY, OPTOISOLATOR, AND STEPPER MOTOR INTERFACING WITH AVR SUCTION 14.1: RELAYS AND OPTOISOLATORS. SECTION 14.2: STEPPER MOTOR INTERTACING (CHAPTER 15: INPUT CAPTURE AND WAVE GENERAL SECTION 1S: WAVE GENERATION USING 8-BIT TIMERS SUCTION (5.2: WAVE GENERATION USING TIMER SECTION 18.3: INPUT CAPTURE PROGRAMMING SECTION 154: C PROGRAMMING. (CHAPTER 16: PWM YROGRAMMING AND DC MOTOR CONTROM. INAV SECTION (6.1: DE MOTOR INIERFACING AND PWM. SECTION 46.2: PWM MODES IN §-BIT TIMERS SECTION 16.3. PWM MODES IN TIMERI SECTION t6.4: DC MOTOR CONTROL USING PWM. (CHAPTER 17; SPI PROTOCOL AND MAX7221 DISPLAY INTERFACING SECTION (71: $PI BUS PROTOCOL. SECTION (7.2: SPI FROGRAMMING INAVR, SECTION (7.3: MAX7221 INTERTACING AND PROGRAMMING (CHAPTER 14; 13¢ PROTOCOL AND DSL307 KIC EXTERPACING SECTION 18.1: 2¢ BUS PROTOCOL SECTION (8.2: TWI 120) INTHE AVR SECTION 8.3: AV TWI PROGRAMMING IN ASSEMBLY AND C SECTION 18.4: DS1307 RTC INTERFACING AND PROGRAMME SECTION IR 5: THT PROGRAMMING WITH CHECKING STATUS REGISTER APPENDIX A: AVR INSTRUCTIONS EXPLAINED SECTION A.L: INSTRUCTION S”MMARY SECTION A 2: AVR INSTRUCTIONS FORMAT SECTION A.3: AVR REGISTER SUMMARY APPENDIX Bt BASICS OW WIE WRAPPING. APPENDIX C: IC [XTERFACING AND SYSTEM DESIGN ISSUES SECTION Cl: OVERVIEW OF IC TECHNOLOGY’ SECTION €.2: AVR UO PORT STRUCTURE AND INTERFACING SECTION ©. SYSTEM DESIGN ISSLES. APPENDIX D: FLOWCHARTS AND PSFUBOCODE. APPENDIX E: AVR PRIMER FOR 6051 PROGRAMMERS.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.