Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.

Slides:



Advertisements
Similar presentations
Analog to digital converter
Advertisements

ARRANGEMENTS FOR ‘PRODUCT’ TIME Mark Neil - Microprocessor Course 1 Microprocessor Laboratory.
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
Digital Thermostat and Data Logger Brandon Wagner and David Southwick.
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC)  Read.  Homework #13 and Lab #13 due next week. 
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Analog to Digital Conversion
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
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.
Robotics Research Laboratory Louisiana State University.
-Done By Haresh Miriyala
Mark Neil - Microprocessor Course 1 Digital to Analog Converters.
Analog to Digital Converter
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.
Explain the introduction to ADC, ADC characteristics, Programming ADC using PIC18, Introduction to DAC and DAC interfacing with PIC18.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
Robotics Research Laboratory Louisiana State University.
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
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.
Robotics Research Laboratory Louisiana State University.
Advanced uC Session Speaker : Chiraag Juvekar Jan 13, 2011 Speaker : Chiraag Juvekar Jan 13, 2011.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
ATMEL AVR 8 bit RISC MICROCONTROLLERS a general comparison.
Renesas Electronics Corporation © 2010 Renesas Electronics America Inc. All rights reserved. RX 12 Bit Analog-to-Digital Converter A Rev /1/10.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
By James Cockrell and Justin Loveless
Timers and Interrupts Mark Neil - Microprocessor Course.
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
ECE 353 Introduction to Microprocessor Systems Michael J. Schulte Week 9.
Analog to Digital Converter (ADC)
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
Mark Neil - Microprocessor Course 1 Timers and Interrupts.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
Mark Neil - Microprocessor Course 1 Decoding and Using a 4x4 Keyboard.
Mark Neil - Microprocessor Course 1 Digital to Analog Converters.
0808/0809 ADC. Block Diagram ADC ADC0808/ADC Bit μP Compatible A/D Converters with 8-Channel Multiplexer The 8-bit A/D converter uses successive.
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.
EKT 314/4 WEEK 9 : CHAPTER 4 DATA ACQUISITION AND CONVERSION ELECTRONIC INSTRUMENTATION.
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)
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
Input/Output Ports and Interfacing
Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)
Microcontroller Applications
UNIT – Microcontroller.
ADC,DAC and sensor interface
COMP2121: Microprocessors and Interfacing
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
Digital to Analog Converters
Digital Control Systems Waseem Gulsher
PIC18F458 Analog-to-Digital
ADC and DAC Programming in AVR
ADC and DAC Data Converter
Device Drivers – Digital Voltmeter
ADC and DAC Data Converter
PIC Microcontroller ADC interfacing Prof. Ashvini Kulkarni
Presentation transcript:

Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter

Analog to Digital Converters Mark Neil - Microprocessor Course 2 An ANALOG to DIGITAL CONVERTER (ADC) is a device that measures analog signals and convert them to digital (binary) numbers: 10-bit ADC output 10-bit Number sequence output 10-bit Number sequence Higher Voltage Ref. Lower Voltage Ref. Input Pulse Input Pulse Input D9 D0

ADC on the ATMega128 Mark Neil - Microprocessor Course 3 The ATMega128 has a built in Analog to Digital Converter  10 bits of data for each sample Signals can be digitized from up to 8 inputs  1 input can be digitized at a time  There is a multiplexer to select which input should be converted

The ADC Registers I Mark Neil - Microprocessor Course 4 The 10-bit ADC on Atmega103 receives its inputs from PORTF. The Reference voltage is controlled by a potentiometer. The device can be controlled by 4 on board registers:  ADCSR : ADC Status Register  ADMUX : Multiplexer Control  ADCH : Data Register for D9,D8  ADCL : Data Register for D0-D7

Mark Neil - Microprocessor Course 5 ADCCSR – ADC Control and Status Register ADCMUX –Register Select Channel ADCMUX –Register Select Channel Multiplexer to select which channel to digitize 8 ADC Input Channels ADCL – Bits 0-7 ADCH – Bits 8-9 ADCL – Bits 0-7 ADCH – Bits 8-9 ADC: 10 bit Analog to Digital Conversion

The ADCCSR Mark Neil - Microprocessor Course 6 ADEN : ADC Enable - turns on the ADC clock ADSC : Start conversion ADIF : Interrupt flag (gets set during a conversion and gets cleared if you write ‘ 1 ’ to it AFTER you have read BOTH data registers) ADIE : Interrupt enable (in the software we do not used interrupts yet so keep it ‘ 0 ’ ) ADPS0-2 : Three bits that determine the ADC clock prescale (e.q. 3 = 1/8)

The ADMUX Register Mark Neil - Microprocessor Course 7 The ADC Multiplexer Register ADMUX is used to select a channel to digitise (3 bits for Channel 0-7) :

The ADCH/ADCL Registers Mark Neil - Microprocessor Course 8 The ADC Data Register ADCL is used for the 8 lower data bits (D7 - D0) : The ADC Data Register ADCH is used for the two highest data bits (D9,D8) : ADCL ADCH

Task Plan Mark Neil - Microprocessor Course 9 Design and construct a Digital Voltmeter: The Atmega103 on-chip ADCs should be used to digitise the input analog voltages. The LCD should be used to display the voltmeter readings. Switches or a keyboard can be used to tell the Voltmeter to capture data Connect your Voltmeter to the potentiometer and measure the voltage. Calibrate it against a Voltmeter in the Lab. Demonstrate that your device works !!!! Connect your Voltmeter to the potentiometer and measure the voltage. Calibrate it against a Voltmeter in the Lab. Demonstrate that your device works !!!!

Conceptual Design Mark Neil - Microprocessor Course 10 We want to construct : ATmega103 Board ATmega103 Board Voltage to be measured Voltage to be measured Connector LCD DISPLAY HITACHI LM032XMBL LCD DISPLAY HITACHI LM032XMBL LCD INTERFACE PORTD Buttons Analog Use ADC0 +5 Volts 10K

Some Important points : Mark Neil - Microprocessor Course 11 The Voltage you are trying to measure must be between 0 – 2.5 Volts The reference voltage of the ADC should not be lower than the voltage you are trying to measure! First you should set the reference voltage at its highest value (4.5 V) using the potentiometer and by measuring it at the Ref. pin of PORTF

Software Design of the Voltmeter Mark Neil - Microprocessor Course 12 First ? Display a message on the LCD saying that the Voltmeter is ready to make a Measurement and ask the user if he wants to measure a voltage (capture data) Display a message on the LCD saying that the Voltmeter is ready to make a Measurement and ask the user if he wants to measure a voltage (capture data) Read in Input from PORTD or the Keyboard Read in Input from PORTD or the Keyboard Yes No Start Display the voltage on to the LCD Display the voltage on to the LCD Initialize LCD Initialize the ADC Initialize LCD Initialize the ADC Decode the Input and if it is ‘ YES ’ then digitise a Voltage Decode the Input and if it is ‘ YES ’ then digitise a Voltage

Getting Started Mark Neil - Microprocessor Course 13 Use the user interface you created with the LCD display and the keyboard or the PORTD switches. Read about using the on-board ADC in the ATmega128 manual. Use the routines in the ADC1.inc program on the web page as a starting point, adding the relevant parts to your own code

ADC Driver routines Mark Neil - Microprocessor Course 14.def TempReg = r16.def ADCChannel = r18.def ADCDL = r19.def ADCDH = r20 ADCInit:; ******* ADC Setup Code **** ldi TempReg, $83; ADC Interrupt Disabled, ADC Enable out ADCSR, TempReg; ADC Free Run Mode, Prescaler:CK/8 ret ADCsel: out ADMUX, ADCChannel; Channel Selection ret DCATrig:SBI ADCSR, 6; Cause a Conversion rcall DEL600mus IN ADCDL, ADCL; Read in Low Byte IN ADCDH, ADCH; Read in High Byte ADCCLR:SBI ADCSR, 4; Reset ADIF IN TempReg,ADCSR; Read in Status SBIC ADCSR, 4; Wait till the Interrupt flag RJMP ADCCLR; is cleared RET