Page 4 - Programming Microcontrollers in C
P. 4
1 Introduction to C ............................................................... 1
Some Simple Programs ...................................................................... 1
Names................................................................................................. 8
Types and Type Declarations ............................................................. 9
Storage Classes, Linkage, and Scope ................................................ 12
Character Constants ........................................................................... 15
Arrays.................................................................................................. 18
Other types.......................................................................................... 20
Operators and Expressions................................................................. 24
Increment and Decrement Operators.................................................. 30
Precedence and Associativity ............................................................. 34
Program Flow and Control .................................................................. 36
Functions............................................................................................. 51
Recursion ............................................................................................ 61
Summary............................................................................................. 63
2 Advanced C Topics ........................................................... 65
Pointers............................................................................................... 65
Multidimensional Arrays ...................................................................... 80
Structures ............................................................................................ 87
More Structures................................................................................... 107
Input and Output ................................................................................. 110
Memory Management ......................................................................... 114
Miscellaneous Functions ..................................................................... 116
Summary............................................................................................. 121
3 What Are Microcontrollers? ............................................. 123
Microcontroller Memory....................................................................... 127
Input/ Output ....................................................................................... 129
Programming Microcontrollers ............................................................ 134
Coding Tips for Microcontrollers ......................................................... 137
4 Small 8- Bit Systems ......................................................... 149
Microcontroller Memory....................................................................... 153
Timers ................................................................................................. 166
Analog- to- Digital Converter Operation .............................................. 195
Pulse Width Modulator System........................................................... 201
Other Program Items........................................................................... 207
Summary............................................................................................. 209
5 Programming Large 8- Bit Systems ................................ 211
Header File.......................................................................................... 211
Sorting Programs ................................................................................ 230
Data Compression .............................................................................. 237
Timer Operations ................................................................................ 245
Summary............................................................................................. 285