Embedded Systems Design with the Atmel AVR MicrocontrollerThis textbook provides practicing scientists and engineers an advanced treatment of the Atmel AVR microcontroller. This book is intended as a follow-on to a previously published book, titled Atmel AVR Microcontroller Primer: Programming and Interfacing. Some of the content from this earlier text is retained for completeness. This book will emphasize advanced programming and interfacing skills. We focus on system level design consisting of several interacting microcontroller subsystems. The first chapter discusses the system design process. Our approach is to provide the skills to quickly get up to speed to operate the internationally popular Atmel AVR microcontroller line by developing systems level design skills. We use the Atmel ATmega164 as a representative sample of the AVR line. The knowledge you gain on this microcontroller can be easily translated to every other microcontroller in the AVR line. In succeeding chapters, we cover the main subsystems aboard the microcontroller, providing a short theory section followed by a description of the related microcontroller subsystem with accompanying software for the subsystem. We then provide advanced examples exercising some of the features discussed. In all examples, we use the C programming language. The code provided can be readily adapted to the wide variety of compilers available for the Atmel AVR microcontroller line. We also include a chapter describing how to interface the microcontroller to a wide variety of input and output devices. The book concludes with several detailed system level design examples employing the Atmel AVR microcontroller. |
Contents
3 | |
5 | |
7 | |
8 | |
9 | |
14 SUMMARY | 16 |
Atmel AVR Architecture Overview | 17 |
212 ASSEMBLY LANGUAGE INSTRUCTION SET | 18 |
562 INTERRUPT DRIVEN USART | 121 |
57 SUMMARY | 136 |
REFERENCES | 137 |
Part II | 139 |
Timing Subsystem | 141 |
622 PERIOD | 142 |
64 APPLICATIONS | 145 |
641 INPUT CAPTUREMEASURING EXTERNALTIMING EVENT | 146 |
213 C OPERATOR SIZE | 19 |
215 ATMEGA164 ARCHITECTURE OVERVIEW | 20 |
22 NONVOLATILE AND DATA MEMORIES | 21 |
222 BYTEADDRESSABLE EEPROM | 22 |
224 STATIC RANDOM ACCESS MEMORY SRAM | 23 |
23 PORT SYSTEM | 24 |
24 PERIPHERAL FEATURESINTERNAL SUBSYSTEMS | 26 |
243 PULSE WIDTH MODULATION CHANNELS | 27 |
245 ANALOG TO DIGITAL CONVERTERADC | 28 |
25 PHYSICAL AND OPERATING PARAMETERS | 30 |
ATMEGA164TESTBENCH | 32 |
272 SOFTWARE CONFIGURATION | 34 |
28 PROGRAMMING THE ATMEGA164 | 38 |
29 INSYSTEM PROGRAMMING ISP | 41 |
REFERENCES | 43 |
Serial Communication Subsystem | 45 |
311 ASCII | 46 |
32 SERIAL USART | 47 |
322 SYSTEM OPERATION AND PROGRAMMING | 50 |
323 FULL DUPLEXUSARTBASED MICROCONTROLLER LINK | 53 |
324 USARTBASED RADIO FREQUENCY MICROCONTROLLER LINK | 60 |
327 SERIAL PERIPHERAL INTERFACESPI | 63 |
328 EXTENDING THE ATMELAVR FEATURES VIA THE SPI | 67 |
33 NETWORKED MICROCONTROLLERS | 69 |
332 CONTROLLER AREA NETWORK CAN | 71 |
REFERENCES | 72 |
Analogto Digital Conversion ADC | 73 |
41 SAMPLINGQUANTIZATION AND ENCODING | 74 |
411 RESOLUTION AND DATA RATE | 76 |
42 ANALOGTODIGITAL CONVERSION ADC PROCESS | 77 |
421 TRANSDUCER INTERFACEDESIGN TID CIRCUIT | 78 |
422 OPERATIONAL AMPLIFIERS | 79 |
43 ADC CONVERSIONTECHNOLOGIES | 82 |
431 SUCCESSIVEAPPROXIMATION | 83 |
44 THE ATMELATMEGA164 ADC SYSTEM | 84 |
441 BLOCK DIAGRAM | 85 |
443 PROGRAMMING THE ADC | 88 |
45 EXAMPLES | 89 |
452 ADC RAIN GAGE INDICATOR WITH SPI | 96 |
453 TRANSMITTING ADC VALUES VIA THE USART OR SPI | 98 |
454 ONEBIT ADC THRESHOLD DETECTOR | 102 |
461 OCTAL CHANNEL8BIT DAC VIATHE SPI | 104 |
47 SUMMARY | 106 |
REFERENCES | 107 |
Interrupt Subsystem | 109 |
53 PROGRAMMING AN INTERRUPT SYSTEM | 110 |
54 APPLICATION | 112 |
542 INTERNAL INTERRUPT | 114 |
55 FOREGROUND AND BACKGROUND PROCESSING | 117 |
561 REAL TIME CLOCK | 118 |
642 COUNTING EVENTS | 147 |
644 INDUSTRIAL IMPLEMENTATION CASE STUDY PWM | 148 |
65 OVERVIEW OF THE ATMEL TIMERS | 149 |
66 TIMER 0 SYSTEM | 150 |
661 MODES OF OPERATION | 152 |
662 TIMER 0 REGISTERS | 153 |
67 TIMER 1 | 156 |
68 TIMER 2 | 160 |
69 PROGRAMMING THE TIMER SYSTEM | 162 |
692 PULSE WIDTH MODULATION | 165 |
693 INPUT CAPTURE MODE | 167 |
610 SERVO MOTOR CONTROL WITH THE PWM SYSTEM | 169 |
AUTOMATED FAN COOLING SYSTEM | 174 |
612 SUMMARY | 182 |
613 CHAPTER PROBLEMS | 183 |
REFERENCES | 184 |
Atmel AVR Operating Parameters and Interfacing | 185 |
71 OPERATING PARAMETERS | 186 |
72 BATTERY OPERATION | 189 |
732 PULL UP RESISTORS IN SWITCH INTERFACE CIRCUITRY | 191 |
734 KEYPADS | 193 |
735 SENSORS | 198 |
736 LM34TEMPERATURESENSOR EXAMPLE | 200 |
74 OUTPUT DEVICES | 201 |
743 CODE EXAMPLE | 202 |
744 TRISTATE LED INDICATOR | 205 |
746 LIQUID CRYSTAL CHARACTER DISPLAY LCD | 208 |
747 GRAPHIC LIQUID CRYSTAL DISPLAY GLCD | 211 |
748 HIGH POWER DC DEVICES | 220 |
76 DC MOTOR SPEED AND DIRECTION CONTROL | 222 |
761 DC MOTOR OPERATING PARAMETERS | 223 |
763 SERVOMOTOR INTERFACE | 224 |
765 AC DEVICES | 233 |
78 SUMMARY | 235 |
REFERENCES | 237 |
System Level Design | 239 |
82 WEATHER STATION | 240 |
824 UML ACTIVITY DIAGRAMS | 241 |
83 MOTOR SPEED CONTROL | 255 |
841 REQUIREMENTS | 258 |
843 UML ACTIVITY DIAGRAMS | 259 |
85 AUTONOMOUS MAZE NAVIGATING ROBOT | 267 |
853 CIRCUIT DIAGRAM | 269 |
855 UML ACTIVITY DIAGRAMS | 270 |
ATmega164 Register Set | 273 |
ATmega164 Header File | 277 |
Authors Biography | 297 |
299 | |
Other editions - View all
Embedded System Design with the Atmel AVR Microcontroller: Part II Steven F. Barrett Limited preview - 2009 |
Common terms and phrases
9 VDC activity analog application Atmel Atmel AVR base break byte channel chapter circuit Clear clock communication compare match complete configured connected converter count counter define delay Describe determine developed device diagram direction discussed display duty cycle EEPROM embedded system enable encoder equipped event example external flag free running frequency function hardware implementation initialize input interface interrupt load logic microcontroller Mode module motor Normal operation output overflow parameters period port PORTB PORTC PORTD pulse range receiver reference Register reset result sample Select sensor serial shift shown in Figure signal specific speed status step subsystem supply switch temperature timer Timer/Counter transmit turn unsigned int USART variables void volatile unsigned char voltage