3/317
Table of Contents
1INTRODUCTION........................................................12
1.1 WHOISTHISBOOKWRITTENFOR? .................................12
1.2 ABOUTTHEAUTHORS.............................................12
1.3 HOWISTHISBOOKORGANIZED? ...................................12
1.4 WHYAMICROCONTROLLER?.......................................13
1.4.1 Electroniccircuitry......................................................15
1.4.2 Choiceofmicrocontrollermodel ...........................................17
1.4.3 Choiceofdevelopmenttools .............................................17
2HOWDOESATYPICALMICROCONTROLLERWORK? .......................19
2.1 THE CENTRAL PROCESSING UNIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2 HOW THE CPU AND ITS PERIPHERALS MAKE UP A SYSTEM . . . . . . . . . . . . 21
2.2.1 CPU ................................................................21
2.2.2 Memory..............................................................21
2.2.3 Input-Outputs . . . ......................................................23
2.2.4 InterruptController .....................................................24
2.2.5 Bus .................................................................25
2.2.6 ClockGenerator .......................................................25
2.2.7 ResetGenerator .......................................................25
2.3 CORE ...........................................................25
2.3.1 ArithmeticandLogicUnit(ALU) ...........................................25
2.3.2 Program Counter ......................................................26
2.3.3 InstructionDecoder.....................................................26
2.3.4 StackPointer .........................................................26
2.4 PERIPHERALS ....................................................27
2.4.1 Parallel Input-Outputs ...................................................27
2.4.2 AnalogtoDigitalConverter...............................................28
2.4.3 ProgrammableTimer ...................................................28
2.4.4 SerialPeripheralInterface ...............................................28
2.4.5 Watchdog Timer . ......................................................28
2.5 THEINTERRUPTMECHANISMANDHOWTOUSEIT ....................29
2.5.1 Interrupthandling ......................................................29
2.5.1.1 Hardware mechanism . .............................................31
2.5.1.2 Hardwaresourcesofinterrupt ........................................31
2.5.1.3 Global interrupt enable bit ...........................................32
1