Programming and Interfacing

Similar documents
Unit level 5 Credit value 15. Introduction. Learning Outcomes

3.3V regulator. JA H-bridge. Doc: page 1 of 7

Embedded Robotics. Software Development & Education Center

Implementation of Multiquadrant D.C. Drive Using Microcontroller

Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

DASL 120 Introduction to Microcontrollers

Training Schedule. Robotic System Design using Arduino Platform

GSM BASED PATIENT MONITORING SYSTEM

Standard single-purpose processors: Peripherals

ELCT 912: Advanced Embedded Systems

Designing with STM32F3x

TMS320F241 DSP Boards for Power-electronics Applications

Introduction to the Arduino Kit

Fixed Wings UAV Direction Control Hardware Design

Embedded & Robotics Training

Roland Kammerer. 13. October 2010

Ocean Controls KT-5221 Modbus IO Module

MSP430 Family Mixed-Signal Microcontroller Application Reports

Index. n A. n B. n C. Base biasing transistor driver circuit, BCD-to-Decode IC, 44 46

Fixed Wings Uav Direction Control Hardware Design

ECE 477 Digital Systems Senior Design Project Rev 8/09. Homework 5: Theory of Operation and Hardware Design Narrative

EE 308 Lab Spring 2009

EMI DUE AND ALCOHOL DETECTION BASED AUTOMATIC VEHICLE LOCKING SYSTEM

Introduction. Theory of Operation

Embedded & Robotics Training

ZKit-51-RD2, 8051 Development Kit

EE 314 Spring 2003 Microprocessor Systems

International Journal of Advance Engineering and Research Development

SMART SENSOR SYSTEMS. WILEY A John Wiley and Sons, Ltd, Publication. Edited by. Gerard CM. Meijer

Preliminary Design Report. Project Title: Search and Destroy

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

JEPPIAAR SRR Engineering College Padur, Ch

Using Z8 Encore! XP MCU for RMS Calculation

MICROCONTROLLER BASED SPEED SYNCHRONIZATION OF MULTIPLE DC MOTORS IN TEXTILE APPLICATIONS

Project Final Report: Directional Remote Control

WSPR VCXO Controller

ADVANCED EMBEDDED MONITORING SYSTEM FOR ELECTROMAGNETIC RADIATION

By Md. Faysal Chowdhury, Sayeedul Mursalin, Mohammad Jubair Hossain & Omor Ahmed Dhali American International University, Bangladesh

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

Modeling, Simulation and Implementation of Speed Control of DC Motor Using PIC 16F877A

Timer/Counter with PWM

LINE MAZE SOLVING ROBOT

GSM based Patient monitoring system

CR 33 SENSOR NETWORK INTEGRATION OF GPS

DIGITAL ELECTRONICS ANALOG ELECTRONICS

Houngninou 2. Abstract

AUTOPILOT CONTROL SYSTEM - IV

CHAPTER 2 VSI FED INDUCTION MOTOR DRIVE

REACTIVE POWER COMPENSATION IN DISTRIBUTION SYSTEM

M.Sinduja,S.Ranjitha. Department of Electrical & Electronics Engineering, Bharathiyar Institute of Engineering For Women, Deviyakurichi.

Data Logger Subsystems Mark Buccini February 2012

Project Name Here CSEE 4840 Project Design Document. Thomas Chau Ben Sack Peter Tsonev

Robotics & Embedded Systems (Summer Training Program) 4 Weeks/30 Days

Activity 4: Due before the lab during the week of Feb

Copyright by Syed Ashad Mustufa Younus Copyright by Syed Ashad Mustufa Younus

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim

Serial Servo Controller

Robotic Navigation Distance Control Platform

Integrated Power Electronic Converters and Digital Control

Active Suspension System. Josh Rose, Xander Serrurier, Rhydon Vassay, Chase Ramseyer Advisor: Steven Gutschlag 4/27/2017

I. INTRODUCTION II. LITERATURE REVIEW

ARDUINO / GENUINO. start as professional. short course in a book. faculty of engineering technology

Microcontroller: Timers, ADC

Design of Joint Controller Circuit for PA10 Robot Arm

Figure 1.1 Mechatronic system components (p. 3)

32-bit ARM Cortex-M0, Cortex-M3 and Cortex-M4F microcontrollers

Imaging serial interface ROM

Index Terms IR communication; MSP430; TFDU4101; Pre setter

XC800 Peripheral Highlights

Generating DTMF Tones Using Z8 Encore! MCU

Logistics. Kinetic Art. Embedded Systems. Embedded Systems and Kinetic Art. Jim Campbell s Algorithm

Embedded Systems and Kinetic Art. CS5968: Erik Brunvand School of Computing. Art4455: Paul Stout Department of Art and Art History.

Electronic Components

Index Terms-Emergency vehicle clearance, Higher density, IR sensor, Micro controller, RFID Technology.

SPI Slave to PWM Generation

At the end of this course, students should be able to: 1 explain experimental results with theoretical expected outcome

Design and Implementation of AT Mega 328 microcontroller based firing control for a tri-phase thyristor control rectifier

Open Loop Speed Control of Brushless DC Motor

Human-Robot Interaction Class Koosy Human-Robot Interaction Class

The Mote Revolution: Low Power Wireless Sensor Network Devices

III. MATERIAL AND COMPONENTS USED

To Measure Dielectric Constant of Liquid By Using PIC Microcontroller

Peripheral Link Driver for ADSP In Embedded Control Application

UM0791 User manual. Demonstration firmware for the DMX-512 communication protocol receiver based on the STM32F103Zx. Introduction

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

Industrial Automation Training Academy. Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours)

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its

Motor Control using NXP s LPC2900

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

ZNEO Z16F Series. High Performance Microcontrollers. Product Specification PS PRELIMINARY

Aqua Script Technology using AVR microcontroller

CATALOG. ANALOG COMMUNICATION SYSTEMS DIGITAL COMMUNICATION SYSTEMS Microcontroller kits Arm controller kits PLC Trainer KITS Regulated Power supplies

B.Sc. ELECTRONICS (OPTIONAL) Second Year DR. BABASAHEB AMBEDKAR MARATHWADA UNIVERSITY, AURANGABAD

Castle Creations, INC.

Jaguar Motor Controller (Stellaris Brushed DC Motor Control Module with CAN)

Automatic Gas Cooking Control System based on Microcontroller

The Development and Application of High Compression Ratio Methanol Engine ECU

TKT-3500 Microcontroller systems

ME 4447 / ME 6405 MICROPROCESSOR CONTROL OF MANUFACTURING SYSTEMS / INTRODUCTION TO MECHATRONICS

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs.

Transcription:

AtmelAVR Microcontroller Primer: Programming and Interfacing Second Edition

f^r**t>*-**n*c contents Preface xv AtmelAVRArchitecture Overview 1 1.1 ATmegal64 Architecture Overview 1 1.1.1 Reduced Instruction Set Computer 1 1.1.2 Assembly Language Instruction Set 2 1.1.3 ATmegal 64 Architecture Overview 3 1.2 Nonvolatile and Data Memories 4 1.2.1 In-System Programmable Flash EEPROM 4 1.2.2 Byte-Addressable EEPROM 4 1.2.3 Static Random Access Memory 5 1.2.4 Programmable Lock Bits 5 1.3 Port System 1.4 Peripheral Features Internal Subsystems 7 1.4.1 Time Base 7 1.4.2 Timing Subsystem 8 1.4.3 Pulse Width Modulation Channels 8 1.4.4 Serial Communications 8 1.4.5 Analog-to-Digital Converter 9 1.4.6 Interrupts 1.5 Physical and Operating Parameters 10 1.5.1 Packaging 10 1.5.2 Power Consumption 1.5.3 Speed Grades 11 1.6 Application: ATmegal64Testbench 1.6.1 Hardware Configuration 11 1.6.2 Software Configuration 12 1.7 Programming the ATmegal64 16 1.7.1 Programming Procedure 16 1.8 Software 18 Portability 1.9 Summary 5 10 10 11 18

1.10 References and Further Reading 18 1.11 Chapter Problems 18 2 Serial Communication Subsystem 23 2.1 Serial Communications 23 2.2 Serial Communication Terminology 23 2.2.1 Asynchronous versus Synchronous Serial Transmission 24 2.2.2 Baud Rate 24 2.2.3 Full Duplex 24 2.2.4 Nonreturn to Zero Coding Format 24 2.2.5 The RS-232 Communication Protocol 24 2.2.6 Parity 25 2.2.7 American Standard Code for Information Interchange 26 2.3 Serial USART 26 2.3.1 System Overview 26 2.3.2 System Operation and Programming 30 2.3.3 Example: Global Positioning System 32 2.3.4 Serial Peripheral Interface 32 2.4 Two-Wire Serial Interface 36 2.5 Summary 36 2.6 References and Further Reading 36 2.7 Chapter Problems 36 3 Analog-to-Digital Conversion 39 3.1 Background Theory 39 3.1.1 Analog versus Digital Signals 40 3.1.2 Sampling, Quantization, and Encoding 42 3.1.3 Resolution and Data Rate 46 3.2 Analog-To-Digital Conversion Process 47 3.2.1 Operational Amplifiers 50 3.3 ADC Conversion Technologies 52 3.3.1 Successive Approximation 55 3.3.2 Integration 55 3.3.3 Counter-Based Conversion 55 3.3.4 Parallel Conversion 56 3.4 The AtmelATmegal64 ADC System 56 3.4.1 Block Diagram 58

xi 3.4.2 Registers 59 3.4.3 Programming the ADC 60 3.4.4 Digital-to-Analog Conversion 62 3.5 Summary 63 3.6 References and Further Reading 63 3.7 Chapter Problems 64 4 Interrupt Subsystem 67 4.1 Interrupt Theory 67 4.2 ATmegal64 Interrupt System 67 4.3 Programming An Interrupt 68 4.4 Application 69 4.4.1 External Interrupts 70 4.4.2 Internal Interrupt 72 4.5 Summary 75 4.6 References and Further Reading 75 4.7 Chapter Problems 75 5 Timing Subsystem 77 5.1 Overview 77 5.2 Timing related terminology 78 5.2.1 Frequency 78 5.2.2 Period 78 5.2.3 Duty Cycle 78 5.3 Timing System Overview 78 5.4 Applications 82 5.4.1 Input Capture Measuring External Timing Event 82 5.4.2 Counting Events 83 5.4.3 Output Compare Generating Timing Signals to Interface External Devices 84 5.4.4 Industrial Implementation Case Study (PWM) 84 5.5 Overview of the Atmel Timers 86 5.6 Timer 0 System 87 5.6.1 Modes of Operation 87 5.6.2 Timer 0 Registers 90 5.7 Timer 1 91

5.7.1 Timer 1 Registers 93 5.8 Timer 2 97 5.9 Programming the Timer System 100 5.9.1 Precision Delay 100 5.9.2 Pulse Width Modulation 102 5.9.3 Input Capture Mode 103 5.10 Servo Motor Control with the PWM system 105 5.11 Summary 110 5.12 References 110 5.13 Chapter Problems Ill 6 AtmelAVR Operating Parameters and Interfacing 113 6.1 Operating Parameters 114 6.2 Input Devices 115 6.2.1 Switches 117 6.2.2 Switch Debouncing 118 6.2.3 Keypads 120 6.2.4 Sensors 120 6.3 Output Devices 123 6.3.1 Light-Emitting Diodes 123 6.3.2 Seven-Segment LED Displays 127 6.3.3 Tristate LED Indicator 127 6.3.4 Dot Matrix Display 127 6.3.5 Liquid Crystal Display 130 6.3.6 High-Power DC Devices 133 6.4 DC Motor Speed and Direction Control 134 6.4.1 H-bridge direction control 135 6.4.2 Servo motor interface 136 6.4.3 Stepper motor control 136 6.4.4 AC Devices 144 6.5 Summary 144 6.6 References and Further Reading 144 6.7 Chapter Problems 145 7 Embedded Systems Design 147 7.1 What is an embedded system? 147

xiii 7.2 Embedded system design process 148 7.2.1 Project Description 148 7.2.2 Background Research 148 7.2.3 Pre-Design 148 7.2.4 Design 150 7.2.5 Implement Prototype 152 7.2.6 Preliminary Testing 152 7.2.7 Complete and Accurate Documentation 153 7.3 Application: Flight Simulator Panel 153 7.4 Autonomous Maze Navigating Robots 180 7.5 Blinky602Arobot 183 7.5.1 Requirements 183 7.5.2 Circuit diagram 183 7.5.3 Structure chart 183 7.5.4 UML activity diagrams 183 7.5.5 Microcontroller code 186 7.6 Mountain. Maze Navigating Robot 194 7.6.1 Description 194 7.6.2 Requirements 194 7.6.3 Circuit diagram 194 7.6.4 Structure chart 194 7.6.5 UTvtL activity diagrams 198 7.6.6 Microcontroller code 198 7.6.7 Mountain Maze 202 7.6.8 Project extensions 202 7.7 Summary 204 7.8 References and Further Reading 204 7.9 Chapter Problems 205 A ATmegal64 Register Set 207 B ATmegal64 Header File 211 Authors'Biographies 223 Index 225