1 Lecture 1: Embedded Systems Overview, AVR Hardware/Software Introduction.

Slides:



Advertisements
Similar presentations
More fun with Timer/Counters
Advertisements

Today’s Lecture What is the embedded system?
Robotics Club, Snt Council2 The 3 Schools of Robotics: Mechanical Design – Types of motors – Material selection –
Introduction of Holtek HT-46 series MCU
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Introduction to embedded Systems.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Introduction to Microprocessors Number Systems and Conversions No /6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
The 8051 Microcontroller Architecture
ASPPRATECH.
WELCOME M.TECH- BIOMEDICAL SIGNAL PROCESSING & INSTRUMENTATION Murigendrayya M Hiremath Lecturer –ML DSCE.
Microcontroller: Introduction
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Embedded Systems Overview
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
1 © Unitec New Zealand Overview Of Embedded Hardware ETEC 6416 Date: - 03 Aug, 2011.
Embedded System Design Laboratory September 27, 2002Stanford University - EE281 Lecture #1 Lecture #1 Outline Welcome Back AVR Hardware –Pins and Ports.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
 Chasis / System cabinet  A plastic enclosure that contains most of the components of a computer (usually excluding the display, keyboard and mouse)
Microcontroller Systems: Motivation
Embedded Systems Design 1. 2 Embedded Systems Overview Computing systems are everywhere Most of us think of “desktop” computers –PC’s –Laptops –Mainframes.
Embedded Systems. 2 A “short list” of embedded systems And the list goes on and on Anti-lock brakes Auto-focus cameras Automatic teller machines Automatic.
AVR Microcontrollers.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Computing Systems Computer abstractions and technology.
ARM Timers.
System Clocks.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
A Few Words From Dilbert
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
The Components of a System Unit
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
CS-280 Dr. Mark L. Hornick 1 Atmel Timer/Counter System Most microcontrollers include some type of timer system Facilitates real-time monitoring and control.
Technology discontinuities drive new computing paradigms and applications 1960 Mainframe ComputerIBM 1970 Mini-Computer DEC 1980 WorkstationSun, HP 1990PCIntel,
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
1 Lecture 1: Embedded Systems Overview, AVR Hardware/Software Introduction.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
Chapter Microcontroller
Embedded Systems Introduction. Microprocessor building blocks 1. ALU (Arithmetic Logic Unit): The ALU is a sequential logic circuitry that is intended.
Embedded Systems Overview Prepared by Nisha Sinsinbar Subject: Microcontoller & Interfacing Sub code: EC Department.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
Networked Embedded Systems Pengyu Zhang & Sachin Katti EE107 Spring 2016 Lecture 4 Timers and Interrupts.
Chapter 1: Embedded Computing Embedded System Design.
KAASHIV INFOTECH – A SOFTWARE CUM RESEARCH COMPANY IN ELECTRONICS, ELECTRICAL, CIVIL AND MECHANICAL AREAS
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Case Study #1 Microcontroller System. What is a microcontroller? A microcontroller can be considered a self-contained system with a processor, memory.
Introduction to Microcontroller Technology
Popular Microcontrollers and their Selection by Lachit Dutta
UNIT – Microcontroller.
BITS EDU. CAMPUS , VARNAMA
Overview of AVR Hardware/Software Introduction
AVR Addressing Modes Subject: Microcontoller & Interfacing
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
EmbedDed Systems – MECT190
Timer/Counter Modified from Dr. Lam Phung’s Slides.
Why microcontrollers in embedded systems?
Introduction to Microprocessors and Microcontrollers
EmbedDed Systems – MECT190
Journey: Introduction to Embedded Systems
Introduction to Embedded Systems
Wireless Embedded Systems
SNS COLLEGE OF TECHNOLOGY
Introduction to Embedded Systems
Embedded Systems By : Simran Amaandeep Singh
Presentation transcript:

1 Lecture 1: Embedded Systems Overview, AVR Hardware/Software Introduction

2 Embedded Systems Overview Computing systems are everywhere Most of us think of “desktop” computers –PC’s –Laptops –Mainframes –Servers But there’s another type of computing system –Far more common...

3 Embedded Systems Overview Embedded computing systems –Computing systems embedded within electronic devices –Hard to define. Nearly any computing system other than a desktop computer –Billions of units produced yearly, versus millions of desktop units –Perhaps 50 per household and per automobile Computers are in here... and here... and even here... Lots more of these, though they cost a lot less each.

4 A “short list” of embedded systems And the list goes on and on Anti-lock brakes Auto-focus cameras Automatic teller machines Automatic toll systems Automatic transmission Avionic systems Battery chargers Camcorders Cell phones Cell-phone base stations Cordless phones Cruise control Curbside check-in systems Digital cameras Disk drives Electronic card readers Electronic instruments Electronic toys/games Factory control Fax machines Fingerprint identifiers Home security systems Life-support systems Medical testing systems Modems MPEG decoders Network cards Network switches/routers On-board navigation Pagers Photocopiers Point-of-sale systems Portable video games Printers Satellite phones Scanners Smart ovens/dishwashers Speech recognizers Stereo systems Teleconferencing systems Televisions Temperature controllers Theft tracking systems TV set-top boxes VCR’s, DVD players Video game consoles Video phones Washers and dryers

5 What is an embedded system? What makes a microcontroller: – Self Contained CPU Memory I/O – Application or Task Specific Not a general-purpose computer Appropriately scaled for the job

6 What is an embedded system? Embedded PCs? “Soft” Processors on PLDs? Systems On A Chip?

7 Designing Embedded Systems Microcontrollers – Don’t have keyboard and monitor jacks – Must use ports to perform I/O Inputs – to sense things Outputs – to control things Related Component Topics – Common Interfaces – Part Packages

8 What you will do: Labs –Lab 1: Introduction to AVR STK500 Hardware/Software, a couple of simple c programs –Lab 2: A/D converter –Lab 3: Optical Sensors –Lab 4: 4 bits D/A converter –Lab 5: Controls and Feedback –Lab 6: Motor Control - open loop –Lab 7: Motor Control - simple feedback control –Lab 8: Motor Control - proportional feedback control

9 What you will do: Final Project – your proposed project Final Project –Hardware –Software –Presentation –Report

10 Introduction to AVR CodeVision AVR C Compiler Professional version –Installed in 20 PCs in room EN229 –Compile programs with more than a thousand instructions. –Provides many useful assembly programs used by your C programs. You write your programs in C completely. AVR C compiler will integrate all required programs together –More about AVR C compiler when presenting Lab 1

11 The Atmel AVRTM is a family of 8-bit RISC microcontrollers produced by Atmel.microcontrollersAtmel The AVR architecture was conceived by two students at the Norwegian Institute of Technology (NTH) and further refined and developed at Atmel Norway, the Atmel daughter company founded by the two chip architects. History of AVR

12 Introduction to AVR

13

14

15

16 Used in Lab

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44 PB2 PB3 also used as Analog Input 0 (AIN0) and Analog Input 1 (AIN1)

45 The Analog Comparator compares the input values on the positive pin AIN0 and negative pin AIN1. When the voltage on the positive pin AIN0 is higher than the voltage on the negative pin AIN1, the Analog Comparator Output, ACO, is set. ACO is kept in bit 5 of Analog Comparator Control and Status Register The comparator’s output can be set to trigger the Timer/Counter1 Input Capture function. In addition, the comparator can trigger a separate interrupt, exclusive to the Analog Comparator. The user can select Interrupt triggering on comparator output rise, fall or toggle

46 Interesting Instruction Examples: NOP – Do nothing for 1 cycle SLEEP – Sleep until reset or interrupted WDR – Watch Dog Reset AVR Instruction set manual available in the course website

47 Timers: Why we need them Provide accurately timed delays or actions independent of code execution time How are Timers used? – Accurate delay Read the timer, store value as K. Loop until timer reaches K+100. – Schedule important events Setup an Output Compare to trigger an interrupt at a precise time When the value in the Output Compare Register matches the value in timer/counter register --  triggers an interrupt -- Measure time between events When event#1 happens, store timer value as K When event#2 happens, read timer value and subtract K The difference is the time elapsed between the two events

48 AVR Timer/Counter 0 8 Bit Wrap-Around Up Counter Interrupt on overflow

49 AVR Timer/Counter 0 8 Bit Up Counter – counts from 0 to 255 (0xFF), then loops to 0 – Internal or External Clock source Prescaler Output compare match output through OC0 for timer/counter 0 compare match, i.e. PB3, pin 4 Interrupt on Overflow – Transition from 255 to 0 can trigger interrupt if desired

50 OC0, Output Compare Match output: Whenever TCNT0 equals OCR0 (Output Compare Register 0), the comparator signals a match The PB3 pin can serve as an external output for the Timer/Counter0 Compare Match. The PB3 pin has to be configured as an output AVR Timer/Counter 0

51 AVR Timer/Counter 1 – 16 Bit – Dual Comparators A,B (output captures) – Up Counter – Interrupt on: Overflow Compare A/B Input Capture of external event on ICP pin. – Can also act as an 8, 9 or 10 bit PWM Up- Down Counter.

52 The Input Capture unit of Timer/Counter captures external events and gives them a time-stamp indicating time of occurrence. The external signal indicating an event, or multiple events, can be applied via the ICP1 pin or alternatively, via the Analog Comparator unit. The time-stamps can then be used to calculate frequency, duty-cycle, and other features of the signal applied. Alternatively the time-stamps can be used for creating a log of the events. AVR Timer/Counter 1

53 Timer 1 and Output Compare The AVR has two output compares (OCR1A/B) – OCR1A/B are 16-bit registers – When the value of OCR1A/OCR1B matches that of Timer1: A user-defined action can take place on the OC1A/OC1B pin (set/clear/inv) i.e.,(OC1A )PD5 / (OC1B) PD4 need to set as output An interrupt can be triggered Timer1 can be cleared to zero – Once set up, output compares operate continuously without software intervention – Great for: Precise recurring timing Frequency/Tone generation (maybe sound effects) All kinds of digital signal generation – Infrared communications – Software-driven serial ports

54 Timer 1 and PWM Pulse-Width Modulation – Useful for using digital circuits to achieve analog- like control of motors, LEDs, etc – Timer 1 has two channels of PWM output on OCR1A and OCR1B

55 Timer Control: I/O space Timer 0: – Control Register (TCCR0) for clock selection, external clock or internal clock, prescaler etc. – Timer/Counter0 (TCNT0) holding counter value Timer 1: – Control Register A & B (TCCR1A/B) – Input Capture Register (ICR1) – Timer/Counter1 Output Compare Register A and B (OCR1A/B) – Timer/Counter1 (TCNT1) Timer Interrupt Registers (Mask and Flag Registers) are Common to Both Timers

56 AVR Timer/Counter Sources Shut Off CPU frequency divided by 1,8,64,256,1024 At 8MHz that’s: 1/8us, 1us, 8us, 32us, 128us External Input (rising or falling).

57 Interrupts Interrupts halt normal code execution in order to go do something more important or time sensitive Interrupt “Handlers” – Using the Interrupt Vectors Interrupts are used for: – RESET – Timers and Time-Critical Code – Hardware signaling “I’m done” “Something’s happened that you want to know about” “I have something for you”

58

59 Watchdog Timer: reset the MCU The Watchdog Timer is clocked from a separate On-chip Oscillator which runs at 1 MHz

60 Reading Assignment: Chapter 1 of Embedded C Programming and the Atmel AVR