Microcontroller

Telechargé par Ali BENMOUSSA
Introduction to Microcontrollers
Courses 182.064 & 182.074
Vienna University of Technology
Institute of Computer Engineering
Embedded Computing Systems Group
February 26, 2007
Version 1.4
G¨
unther Gridling, Bettina Weiss
Contents
1 Microcontroller Basics 1
1.1 Introduction ....................................... 1
1.2 Frequently Used Terms ................................. 6
1.3 Notation ......................................... 7
1.4 Exercises ........................................ 8
2 Microcontroller Components 11
2.1 Processor Core ..................................... 11
2.1.1 Architecture ................................... 11
2.1.2 Instruction Set ................................. 15
2.1.3 Exercises .................................... 21
2.2 Memory ......................................... 22
2.2.1 Volatile Memory ................................ 23
2.2.2 Non-volatile Memory .............................. 27
2.2.3 Accessing Memory ............................... 29
2.2.4 Exercises .................................... 31
2.3 Digital I/O ........................................ 33
2.3.1 Digital Input .................................. 34
2.3.2 Digital Output ................................. 38
2.3.3 Exercises .................................... 39
2.4 Analog I/O ....................................... 40
2.4.1 Digital/Analog Conversion ........................... 40
2.4.2 Analog Comparator ............................... 41
2.4.3 Analog/Digital Conversion ........................... 42
2.4.4 Exercises .................................... 51
2.5 Interrupts ........................................ 52
2.5.1 Interrupt Control ................................ 52
2.5.2 Interrupt Handling ............................... 55
2.5.3 Interrupt Service Routine ............................ 57
2.5.4 Exercises .................................... 59
2.6 Timer .......................................... 60
2.6.1 Counter ..................................... 60
2.6.2 Input Capture .................................. 62
2.6.3 Output Compare ................................ 65
2.6.4 Pulse Width Modulation ............................ 65
2.6.5 Exercises .................................... 66
2.7 Other Features ...................................... 68
2.7.1 Watchdog Timer ................................ 68
i
2.7.2 Power Consumption and Sleep ......................... 69
2.7.3 Reset ...................................... 70
2.7.4 Exercises .................................... 71
3 Communication Interfaces 73
3.1 SCI (UART) ....................................... 75
3.2 SPI ............................................ 82
3.3 IIC (I2C) ........................................ 83
3.3.1 Data Transmission ............................... 84
3.3.2 Speed Control Through Slave ......................... 87
3.3.3 Multi-Master Mode ............................... 87
3.3.4 Extended Addresses .............................. 88
3.4 Exercises ........................................ 88
4 Software Development 89
4.1 Development Cycle ................................... 91
4.1.1 Design Phase .................................. 91
4.1.2 Implementation ................................. 92
4.1.3 Testing & Debugging .............................. 94
4.2 Programming ...................................... 97
4.2.1 Assembly Language Programming ....................... 97
4.3 Download ........................................ 117
4.3.1 Programming Interfaces ............................ 117
4.3.2 Bootloader ................................... 118
4.3.3 File Formats .................................. 118
4.4 Debugging ........................................ 121
4.4.1 No Debugger .................................. 121
4.4.2 ROM Monitor ................................. 124
4.4.3 Instruction Set Simulator ............................ 124
4.4.4 In-Circuit Emulator ............................... 125
4.4.5 Debugging Interfaces .............................. 125
4.5 Exercises ........................................ 127
5 Hardware 129
5.1 Switch/Button ...................................... 129
5.2 Matrix Keypad ..................................... 130
5.3 Potentiometer ...................................... 132
5.4 Phototransistor ..................................... 132
5.5 Position Encoder .................................... 133
5.6 LED ........................................... 134
5.7 Numeric Display .................................... 135
5.8 Multiplexed Display .................................. 136
5.9 Switching Loads .................................... 138
5.10 Motors .......................................... 140
5.10.1 Basic Principles of Operation ......................... 140
5.10.2 DC Motor .................................... 142
5.10.3 Stepper Motor ................................. 146
5.11 Exercises ........................................ 153
ii
A Table of Acronyms 155
Index 159
iii
iv
1 / 175 100%

Microcontroller

Telechargé par Ali BENMOUSSA
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !