Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)

Slides:



Advertisements
Similar presentations
Analog to digital converter
Advertisements

Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.
More fun with Timer/Counters
Chung-Ta King National Tsing Hua University
Sistemi Elettronici Programmabili13-1 MULTI OSC + CLOCK FILTER LVD POWER SUPPLY CONTROL 8 BIT CORE ALU PROGRAM MEMORY RAM I2CI2C PORT A SPI PORT B 16-BIT.
555 Timer ©Paul Godin Updated February Oscillators ◊We have looked at simple oscillator designs using an inverter, and had a brief look at crystal.
Analog to Digital Conversion
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Analog/Digital Subsystem
Analog to Digital Convertor MTT48 V1.0 ADC - 1 ANALOG TO DIGITAL CONVERTOR (ADC)
Analog Comparator Positive input chooses bet. PB2 and Bandgap Reference. Negative input chooses bet. PB3 and the 8 inputs of the A/D. ACME= Analog Comparator.
Analog to Digital Converter
Lecture 12 Analog to Digital Converters. 2  What is an ADC?  Output vs. input  Input range  Single-ended vs. differential inputs  Output coding:
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
Kuliah Mikrokontroler AVR ADC AVR Eru©September 2009 PENS.
Microprocessor based Design for Biomedical Applications MBE 3 – MDBA IV : The ATmega8 Basic Features (3)
ECE 371 – Unit 15 Data Acquisition Systems A/Ds in MC9S12DPS56B Microcontroller.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
ATMEL AVR 8 bit RISC MICROCONTROLLERS
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.
Data Converters ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 Clock Generator.
ARM Timers.
System Clocks.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
Embedded System Design Laboratory October 11, 2002Stanford University - EE281 Lecture #4#1 Lecture #4 Outline Announcements Project Proposal AVR Processor.
Digital to Analogue Converter
ELE2MIC Lecture 21 The AVR Sleep Modes ATMEGA128’s Analog to Digital Converter –Features –Block Diagram –Clock Source –Input Sources –Interrupts –BandGap.
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Advanced uC Session Speaker : Chiraag Juvekar Jan 13, 2011 Speaker : Chiraag Juvekar Jan 13, 2011.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
The Silicon Laboratories C8051F020
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.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
Analog to Digital Converter (ADC)
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
ADC 1 Analog to Digital Converter. ADC 2 ADC Features n General Features -Supports 8 or 10-bit resolution Modes, -Track period fully programmable up to.
Sensing Algorithm using IR Sensor and ADC Soong-sil University. Robotics 기 정 두 원.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
By: Shivanshi pandya(30) Ayushi chourasia (3) Pranavi chhikniwala(6)
Application Case Study Christmas Lights Controller
Why are Timer Functions Important?
Servos Elementary Robotics with Servos
ECE 3430 – Intro to Microcomputer Systems
Government Engg College Bhuj E. C. Engg. Department
ATMEL AVR 8 bit RISC MICROCONTROLLERS
Power Management and Sleep Modes
555 Timer EEE DEPARTMENT KUMPAVAT HARPAL( )
Microcontroller Applications
Refer to Chapter 5 in the reference book
Power Management and Sleep Modes
ADC,DAC and sensor interface
BITS EDU. CAMPUS , VARNAMA
AVR Addressing Modes Subject: Microcontoller & Interfacing
Reset Sources and Watchdog Timer
ADC, DAC, and Sensor Interfacing
8086/8088 Hardware Specifications
Timer/Counter Modified from Dr. Lam Phung’s Slides.
Digital Acquisition of Analog Signals – A Practical Guide
ADC and DAC Programming in AVR
MSP432™ MCUs Training Part 6: Analog Peripherals
AVR – ATmega103(ATMEL) Architecture & Summary
Wave Generation and Input Capturing
ANALOG TO DIGITAL CONVERTER (ATD).
Device Drivers – Digital Voltmeter
Presentation transcript:

Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-) input, output goes logic “1” The comparator's output change can: -trigger the input capture register (ICR1) on TCNT1 -cause an interrupt triggered on rising AND/OR falling edges (1.26V) PE2 PE3

Analog Comparator Analog comparator controlled with two registers SFIOR and ACSR analog comparator mux enable: If ADC is off, it allows the comparator to use the ADC input mux. This would allow selecting among many inputs instead of one. (1.26V) PE2 PE3

Analog Comparator Analog Comparator Control and Status Register (ACSR) analog comparator interrupt mode select: 00 : interrupt on output toggle 01 : reserved 10 : interrupt on falling edge 11 : interrupt on rising edge analog comparator disable: If set, comparator is off analog comparator bandgap select: If set, bandgap voltage is applied to non-inverting comparator input analog comparator output: analog comparator interrupt flag: Set when comparator triggers an interrupt event. Cleared by ISR or writing a logic one to the bit. analog comparator interrupt enable: If global interrupt enable is set, when comparator can trigger an interrupt. analog comparator input capture enable: When set, allows comparator to trigger input capture register

Bandgap Voltage Reference An internal bandgap voltage reference is available on the Atmega128. Output is typically 1.23 Volts. (quite accurate, see datasheet) The 2.56 volt internal reference is generated from this reference. It's used by the brownout detection circuitry and optionally by ADC or comparator. It is only enabled when one of the below is true: -brownout detection is enabled -bandgap reference is connected to the analog comparator -when the ADC is enabled Bandgap reference takes 70uS max to startup. -can be a power consumption issue

Analog to Digital Converter (ADC) -10-bit successive approximation ADC -13-260uS conversion time -8 multiplexed single ended input channels -7 differential input channels -2 differential input channels with optional gain of 10x or 200x -Ground to Vcc input voltage range -Reference voltage of 2.56V or external AVcc -Interrupt on conversion complete

ADC Analog to Digital Converter PF7 PF6 PF5 PF4 PF3 PF2 PF1 PF0

ADC ADC Power Connections Circuit on mega128 board Atmel suggested circuit To keep the digital noise out of the ADC circuitry, it is given its own power supply pin. This pin has extra decoupling circuitry. AVCC can also be used as the reference voltage to the ADC.

ADC ADC operation Setup involves: -choose a reference voltage (usually AVCC) -select input channel via the input multiplexer -enable interrupts if necessary -enable ADC The reference voltage determines -the maximum input voltage that should be applied to the ADC input -the smallest voltage that can be resolved by the ADC We use AVCC (5V) for the ADC reference. -maximum input should not exceed 5V (electrical and s/w reasons!) -input voltage resolution is (5/1024) = 0.00488 volts -0 volts gives ADC output of 0x0000 -5 volts gives ADC output of 0x03FF

ADC ADC operation Starting a conversion: -Single conversion mode: -Write logic one to Start Conversion bit (ADSC) in ADCSRA -Bit stays one while doing conversion , clears when done -Free Running mode: -Set free running bit (ADFR) in ADCSRA -First conversion started by writing logic one to ADSC bit -Conversions continue regardless of state of ADC interrupt bit (ADIF) is cleared or not.

ADC ADC operation (cont.) ADC completion: -When ADIF bit in ADCSRA goes logic one -ADIF is cleared by ISR or by writing a one to it. Getting the results: -ADLAR bit in ADCSRA controls presentation of data -If ADLAR=0 data is right justified in the ADC data registers -If ADLAR=1 data is left justified Data registers -ADCH and ADCL -Accessed together as ADCW (16-bit access) -Only need 8-bits?..., -left justify, read ADCH, and throw away 2 bits of precision

ADC ADC clock input Successive approximation conversion requires an input clock. Clock is derived from internal CPU clock -7-bit prescaler provides outputs at -clk/2, clk/4, clk/8, clk/16, clk/32, clk/64, clk/128 Required clock speed is between 50khz to 200khz depending on resolution. Normal conversion takes 13 clock cycles. First conversion takes 25 clock cycles for analog circuitry initialization. To stay under 200khz, must divide 16Mhz clock by 128, giving 125khz ADC clock. For a 13 cycle conversion, 13 * (1/125000) = 104uS per conversion

ADC ADC registers -ADC Multiplexer Selection Register (ADMUX) reference selection: Selects ADC reference ADC left adjust result: If set, result is left adjusted analog channel and gain selection: For our project, use AVCC (5V) as the reference, REFS1,0 = 01

ADC ADC registers -ADC Multiplexer Selection Register (ADCSRA) ADC Enable: Enables ADC operation ADC Start Conversion: Set to one to start conversions ADC Free Running Select: When set, operate free running ADC Interrupt Flag: Set, when conversion complete ADC Interrupt Enable: When set, interrupts are enabled ADC Prescaler Select: select clock division ratio

ADC ADC registers -ADC Data Registers (ADCL) and (ADCH) ADLAR=0 (right justified) ADLAR=1 (left justified)

ADC ADC Noise Canceler -Power-down mode to reduce CPU core digital noise -MCU Control Register (MCUCR) controls power management -MCUCR sleep mode bits will cause CPU to enter noise reduction mode -Stops CPU, I/O clocks, and memory clocks To use: -ADC enabled, single conversion mode, interrupts on -Enter noise reduction mode via MCUCR register (SM2-0 = 001) -When conversion is done, interrupt wakes up CPU and ISR(ADC_vect) is executed Note: Other interrupts can wake up CPU from noise reduction mode before the ADC conversion is completed.