Contents
[align=left:6cc54d47e4]
1 Resources ofMicrocontrollers ...................................1
1.1InthisChapter .............................................1
1.2MicrocontrollerArchitectures................... .............1
1.3TheMemoryMap................................... .......3
1.4CPURegisters .............................................5
1.4.1TheCPURegistersofHC11........................ ...5
1.4.2TheCPURegistersofAVR......................... ...6
1.4.3TheCPURegistersof8051........................ ....7
1.5ThePeripheralInterfaces ....................................8
1.6TheInterruptSystem............................. ...........9
1.6.1GeneralDescriptionoftheInterruptSystem ..............9
1.6.2DistinctiveFeaturesoftheInterruptSystemofHC11 ......11
1.6.3DistinctiveFeaturesoftheInterruptSystemofAVR .......12
1.6.4DistinctiveFeaturesoftheInterruptSystemof8051 .......12
1.7ExpandingtheResaurcesofMicrocontrollers ...................12
1.7.1HC11OperatingwithExternalBus................. ....13
1.7.2AT90S8515OperatingwithExternalBus............ ....14
1.7.38051OperatingwithExternalBus................. .....14
1.8Exercises...................................... ...........15
2 UsingtheDigitalI/OLines ......................................19
2.1InthisChapter .............................................19
2.2OverviewoftheParallelI/OSystem...........................19
2.3ElectricalCharacteristicsoftheI/OLines......................21
2.4ControllingtheI/OLinesbySoftware .........................23
2.5Exercises...................................... ...........24
3 UsingtheAsynchronousSerial Interface..........................27
3.1InthisChapter .............................................27
3.2Synchronousvs.AsynchronousCommunication........ .........27
3.3ErrorDetectioninAsynchronousCommunication ...............29
3.4TheGeneralStructureoftheAsynchronousSerialCommu nication
Interface......................................... .........30
3.5TheSerialCommunicationInterfaceof68HC11F1 ..............30
3.6TheAsynchronousSerialCommunicationInterfaceofAV R
Microcontrollers.................................. .........35
3.7TheAsynchronousSerialInterfaceof8051........... ..........36
3.8ProgrammingtheAsynchronousSerialInterface...... ..........37
3.8.1ProgrammingtheSCIofHC11...................... ...38
3.8.2ProgrammingtheUARTofAT90S8535................ .40
3.8.3ProgrammingtheUARTof8051 .......................41
3.9HardwareInterfacesforSerialCommunication....... ...........42
3.9.1TheRS232Interface............................ .....42
3.9.2DifferentialCommunication.TheInterfacesRS422a nd
RS485............................................. 43
3.9.3TheCurrentLoopInterface...................... ......44
3.10BasicPrinciplesofNetworkingwithMicrocontroller s,Usingthe
AsynchronousSerialInterface....................... .........45
3.11Exercises..................................... ............46
4 UsingtheSynchronousSerial InterfaceSPI .......................49
4.1InthisChapter .............................................49
4.2GeneralDescriptionoftheSPI..................... ..........49
4.3TheSPIofHC11Microcontrollers................... .........50
4.4TheSPIoftheAVRMicrocontrollers................. .........53
4.5ExamplesofUsingTheSPI ..................................55
4.5.1UsingtheSPIToConnectTwoMicrocontrollers...... ....55
4.5.2ExpandingtheI/OSpaceUsingtheSPI..................56
4.6Exercises...................................... ...........59
5 UsingTheI2CBus .............................................61
5.1InthisChapter .............................................61
5.2ThePrinciplesofImplementationoftheI2CBus....... .........61
5.2.1TheStartTransferCondition.................... .......62
5.2.2TheDataTransferontheI2CBuS................... ...62
5.2.3TheACKBit.................................... ....62
5.2.4TheSTOPCondition............................. ....63
5.3ASoftwareImplementationoftheI2CProtocol........ .........63
5.4Accessing24C256MemoryDevices................... .......64
5.5Exercises...................................... ...........66
6 UsingtheMCUTimers .........................................67
6.1InthisChapter .............................................67
6.2TheGeneralStructureandFunctionsoftheTimerSystem ........67
6.3DistinctiveFeaturesoftheGeneral-PurposeTimerofHC11 .......69
6.3.1TheControlandStatusRegistersoftheHC11Timer... ...69
6.3.2ExercisesRegardingtheUseoftheGeneral-PurposeTimer
ofHC11............................................ 73
6.4DistinctiveFeatureoftheTimeroftheAVRMicrocontro llers.....75
6.4.1The8-BitTimer/CounterTimer0 .......................76
6.4.2The16-BitTimer/CounterTimer1......................76
6.4.3SynopsisoftheTimerI/ORegistersofAT90S8115........78
6.4.4SummaryoftheUniqueFeaturesoftheAVRTimer .......79
6.4.5ExercisesRegardingtheUseofAVRTimers .............79
6.5DistinctiveFeaturesoftheTimerSystemofthe8051Mic rocontrollers81
6.5.1TheControlandStatusRegistersoftheTimer ............82
6.5.2DescriptionoftheTimerOperatingMode0 ..............83
6.5.3DescriptionoftheTimerOperatingMode1 ..............83
6.5.4DescriptionoftheTimerOperatingMode2 ..............84
6.5.5DescriptionoftheTimerOperatingMode3 ..............84
6.5.6UsingTimer1asaBaudRateGenerator.............. ...85
6.5.7ExercisesforProgrammingthe8051Timer ..............85
6.6PWMTimers.PrinciplesofOperation .........................87
6.7WatchdogTimers................................. ..........89
6.7.1TheWatchdogofHC11............................ ...89
6.7.2TheWatchdogofAT90S8515....................... ...90
7 Interfacing toAnalogSignals ....................................93
7.1InThisChapter.................................. ..........93
7.2TheAnalogComparator............................ .........93
7.3TheGeneralStructureoftheA/DConverterSubsystem...........95
7.4TheA/DConverteroftheHC11FamilyofMicrocontrollers....... 96
7.5ExercisesonProgrammingtheA/DConverterofHC11...........98
7.6TheA/DConverteroftheAVRMicrocontrollers................ 100
7.7ExercisesonProgrammingtheA/DConverterAT90S8535........101
7.8Digital-to-AnalogConverters.................................1 02
7.8.1ThePrinciplesoftheD/AConversion ...................102
7.8.2ExerciseonUsingMX7224........................ ...104
8 UsingtheInternalEEPROMMemory...................... ......107
8.1InthisChapter .............................................107
8.2OverwiewoftheEEPROMSubsystem................... ......107
8.3TheEEPROMMemoryandtheCONFIGRegisterofHC11...... .107
8.3.1TheRegistersControllingtheEEPROMofHC11....... ..108
8.3.2SoftwareRoutinestoEraseandWritetheEEPROM .......109
8.3.3TheCONFIGRegister............................ ....110
8.4TheEEPROMMemoryoftheAVRMicrocontrollers ............111
8.4.1TheRegistersoftheInterfacewiththeEEPROMMemory ..111
8.4.2SoftwareRoutinestoReadandWriteEEPROM......... .112
9 HC11 DevelopmentBoard ......................................115
9.1InthisChapter .............................................115
9.2DescriptionoftheHardwareModule................. .........115
9.3AssemblingandTestingtheModule.................. .........117
9.4DescriptionoftheSoftwareComponents............. ..........119
9.5Exercises...................................... ...........129
10AVRDevelopmentBoard .......................................131
10.1InthisChapter .............................................131
10.2TheHardware................................... ..........131
10.3TestingtheCircuit............................. .............134
10.4TheSoftware................................... ...........134
10.5Exercises..................................... ............144
118051DevelopmentBoard .......................................145
11.1InthisChapter .............................................145
11.2Hardware...................................... ...........145
11.3TheSoftware................................... ...........148
11.3.1InstallingtheCross-Assembler .........................148
11.3.2WritingandTestingSimple8051Programs ..............149
11.3.3LoadingandExecutingProgramsintheExternalRam
Memory............................................ 152
11.4Exercises..................................... ............154
12DigitalVoltmeterwithRS232Interface ...........................157
12.1InthisChapter .............................................157
12.2TheHardware................................... ..........157
12.3TheSoftware................................... ...........157
12.4Exercises..................................... ............162
13SimpleRS485NetworkwithMicrocontrollers .....................163
13.1InthisChapter .............................................163
13.2TheHardware................................... ..........163
13.2.1TheRS232-to-RS485Converter........................164
13.2.2TheDigitalInputModule .............................165
13.2.3TheAnalogInputModule .............................166
13.2.4UsingtheAVRDevelopmentBoardtoEmulateThelSLD
andSLAModules....................................1 66
13.3TheSoftware................................... ...........167
13.3.1DescriptionoftheCommunicationProtocol ..............167
13.3.2TheSoftwarefortheSLDModule.................. ....169
13.3.3TheSoftwarefortheMASTERDevice............... ...171
13.4Exercises..................................... ............172
14PITemperatureController ......................................173
14.1InthisChapter .............................................173
14.2BasicConcepts................................. ...........173
14.3HardwareImplementationofaMicrocontroller-BasedTemperature
Controller........................................ .........177
14.4SoftwareImplementationofaPITemperatureControll er.........179
15FuzzyLogicTemperatureController .............................185
15.1InthisChapter .............................................185
15.2ThePrinciplesofFuzzyControl ..............................185
15.3AMicrocontrollerImplementationofaFuzzyControll er.........189
16RemoteRelayControlleroverTelephoneLines ....................193
16.1InthisChapter .............................................193
16.2DescriptionoftheHardwareSolution.............. ............193
16.3DescriptionoftheSoftware ..................................197
A.1GlossaryofTerms................................ ..........203
Appendix.......................................... ................202
A.2DescriptionoftheRegistersof68HC11F1............ ..........213
A.3HC11InstructionSet............................. ..........215
A.4AnExampleofExpandedStructurewithHC11........... ......219
A.5UsingHC11inBootstrapMode ..............................221
A.6TheRegistersofAT90S8535........................ .........224
A.7AVRInstructionSet ........................................225
A.8AT90S8515OperatingwithExternalRAM.............. .......228
A.9In-systemProgrammingtheAVRAT90S8535 ..................229
A.10TheSpecialFunctionRegistersof8051 ........................232
A.118051InstructionSet ........................................233
A.12AnExampleof8051OperatingwithExternalBus....... ........237
A.13ProgrammingtheInternalMemoryof8051............ .........238
A.14SPISeven-SegmentDisplayUnits............................240
A.15DescriptionoftheSoftwareUtilityASMEDIT ..................243
B.1ContentsoftheAccompanyingCD.................... ........245
B.2RecommendedReadingsandWebReferences............ .......247
Index .................................................. ...........249
[/align:6cc54d47e4]