Device Drivers – Digital Voltmeter

Slides:



Advertisements
Similar presentations
Analog to digital converter
Advertisements

Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.
Digital Thermostat and Data Logger Brandon Wagner and David Southwick.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Analog to Digital Conversion
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
Analog/Digital Subsystem
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.
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.
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.
By James Cockrell and Justin Loveless
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)
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
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.
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)
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Application Case Study Christmas Lights Controller
Servos Elementary Robotics with Servos
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
ADC,DAC and sensor interface
DIGITAL CALCULATOR USING 8051
COMP2121: Microprocessors and Interfacing
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
8086/8088 Hardware Specifications
Keyboard/Display Controller INTEL 8279
An Introduction to Microprocessors
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
ATmega103 Timer0 and Interrupts
Digital to Analog Converters
ECE 354 Computer Systems Lab II
Serial versus Parallel Data Transfers
CSE 171 Lab 11 Digital Voltmeter.
Tim Sumner, Imperial College, Rm: 1009, x47552
Analog-to-Digital Converters
PIC18F458 Analog-to-Digital
Tim Sumner, Imperial College, Rm: 1009, x47552
Keyboard/Display Controller (8279)
ADC and DAC Programming in AVR
ADC and DAC Data Converter
A register design with parallel load input
Decoding and Using a 4x4 Keyboard
8051 Micro Controller.
ADC and DAC Data Converter
PIC Microcontroller ADC interfacing Prof. Ashvini Kulkarni
Costas Foudas, Imperial College, Rm: 508, x47590
The Programmable Peripheral Interface (8255A)
Decoding and Using a 4x4 Keyboard
Presentation transcript:

Device Drivers – Digital Voltmeter 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Analog to Digital Converters The ANALOG to DIGITAL CONVERTER (ADC) is a device that measures analog signals and convert them to digital (binary) numbers: Higher Voltage Ref. D9    10-bit ADC output 10-bit Number sequence Input Pulse Input Lower Voltage Ref. D0 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

The ATmega103 ADC The Atmega103 has one 10-Bit ADC (on-chip) connected to an 8 to1 analog multiplexer: EN_ADCH Higher Voltage Ref. Potentiometer Adjustable 0-4.5 Volts (PORT F) ADCH D9 10-bit ADC D8 8-1 Multiplexer Input D7 ADCL 3-bit MUX Control D0 INPUT PORTF EN_ADCL Lower Voltage Ref. Fixed at 0 Volts CLK 8-bit ATmega103 Bus 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 The ADC Registers I 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 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 The ADC Registers II The ADC Status Register DCSR : D7 D6 D5 D4 D3 D2 D1 D0 ADEN ADSC ADIF ADIE ADPS2 ADPS1 ADPS0 ADEN : It turns on the ADC clock (You must do it first) ADSC : Start conversion 0 : The data book says it should always be zero 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 I have not used interrupts so I have kept it ‘0’) ADPS0-2 : Three bits that determine the ADC clock prescale (e.q. 3 = 1/8) 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 The ADC Registers III The ADC Multiplexer Register ADMUX is used to select a channel to digitise (3 bits for Channel 0-7) : D7 D6 D5 D4 D3 D2 D1 D0 MUX2 MUX1 MUX0 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 The ADC Registers IV The ADC Data Register ADCL is used for the 8 lower data bits (D7 - D0) : D7 D6 D5 D4 D3 D2 D1 D0 The ADC Data Register ADCH is used for the two highest data bits (D9,D8) : D7 D6 D5 D4 D3 D2 D1 D0 D9 D8 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 Task Plan 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 !!!! 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 Conceptual Design Voltage to be measured We want to construct : Connector ATmega103 Board LCD INTERFACE +5 Volts LCD DISPLAY HITACHI LM032XMBL 10K Use ADC0 Analog 10K PORTD Buttons 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Some Important points : 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 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Software Design of the Voltmeter Start First ? Yes Initialize LCD Initialize the ADC No Display the voltage on to the LCD 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) Yes Decode the Input and if it is ‘YES’ then digitise a Voltage No Read in Input from PORTD or the Keyboard 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 Getting Started Use the user interface you created with the LCD display and the keyboard or the PORTD switches. (2) Read about using the on-board ADC in the ATmeag103 manual. (3) Use the routines you will find in the ADC1.inc program in the web page. (4) ADC1.inc is a standalone program that works you may want to start from that. 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552

Tim Sumner, Imperial College, Rm: 1009, x47552 ADC Driver routines .def TempReg =r16 ADCInit: ; ******* ADC Setup Code **** ldi TempReg, $83 ; ADC Interrupt Disabled, ADC Enabled out ADCSR, TempReg ; ADC Free Run Mode, Prescaler:CK/8 ret ADCsel: out ADMUX, ADCChannel ; Channel Selection 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 4/28/2019 Tim Sumner, Imperial College, Rm: 1009, x47552