P89LPC935 ADC/DAC Tutorial

Similar documents
AN10218 Philips LPC900 microcontrollers single cell power supply

MICROPROCESSORS A (17.383) Fall Lecture Outline

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #14: Using the ADC12 Analog-to-Digital Converter

Microcontroller: Timers, ADC

EE445L Fall 2011 Quiz 2A Page 1 of 6

Iowa State University Electrical and Computer Engineering. E E 452. Electric Machines and Power Electronic Drives

Interfacing to Analog World Sensor Interfacing

EIE/AN93017 Using the analog-to-digital converter of the 8XC552 microcontroller

MICROCONTROLLER TUTORIAL II TIMERS

The University of Texas at Arlington Lecture 10 ADC and DAC

Small Signal Pulse Detection

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester

EE 109 Midterm Review

Lecture 7: Analog Signals and Conversion

DASL 120 Introduction to Microcontrollers

ADC Parameters. ECE/CS 5780/6780: Embedded System Design. Common Encoding Schemes. Two-Bit Flash ADC. Sixteen-Bit Dual Slope ADC

PIC ADC to PWM and Mosfet Low-Side Driver

Notes on using the A/D Converter on the. FFMC8L/LC Microcontrollers. Fujitsu Mikroelektronik GmbH Vers. 1.0 by E. Bendels

Analog-to-Digital Converter. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

PIC Analog Voltage to PWM Duty Cycle

ELCT 912: Advanced Embedded Systems

Hello, and welcome to this presentation of the STM32L4 comparators. It covers the main features of the ultra-lowpower comparators and some

Analog to Digital Conversion

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

MICROPROCESSOR TECHNICS II

Module 13: Interfacing ADC. Introduction ADC Programming DAC Programming Sensor Interfacing

Embedded Test System. Design and Implementation of Digital to Analog Converter. TEAM BIG HERO 3 John Sopczynski Karim Shik-Khahil Yanzhe Zhao

Lab 10. Speed Control of a D.C. motor

Lecture 4: Basic Electronics. Lecture 4 Brief Introduction to Electronics and the Arduino

ADC Description. ECE/CS 5780/6780: Embedded System Design. External Input Pin Descriptions. ADC Block Diagram

F²MC-8L/16LX FAMILY MB90340 SPI COMMUNICATION TO EXTERNAL ADC. (for MAX1286) 8/16-BIT MICROCONTROLLER APPLICATION NOTE

Capstone Design Course

EE445L Fall 2012 Final Version B Page 1 of 7

Version Futek Instruments, LLC

dspic Analogue to Digital Converter

DNT24MCA DNT24MPA. Low Cost 2.4 GHz FHSS Transceiver Modules with I/O. DNT24MCA/MPA Absolute Maximum Ratings. DNT24MCA/MPA Electrical Characteristics

Charge Time Measurement Unit (CTMU) and CTMU Operation with Threshold Detect

Microprocessors A Lab 4 Fall Analog to Digital Conversion Using the PIC16F684 Microcontroller

Three-Stage Coil Gun

Engineer-to-Engineer Note

High Voltage Waveform Sensor

Using the M16C/62 Analog to Digital Converter in Repeat Sweep Mode 0

Lab 7 ADC Apr

ME 461 Laboratory #3 Analog-to-Digital Conversion

Using a PIC for Analog to Digital Conversion

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Analog Digital Converter

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

DNT90MCA DNT90MPA. Low Cost 900 MHz FHSS Transceiver Modules with I/O

STELLARIS ERRATA. Stellaris LM3S8962 RevA2 Errata

Hello, and welcome to this presentation of the STM32 Digital Filter for Sigma-Delta modulators interface. The features of this interface, which

GUJARAT TECHNOLOGICAL UNIVERSITY

Debouncing Switches. The non-ideal behavior of the contacts that creates multiple electrical transitions for a single user input.

Lecture 5 ECEN 4517/5517

10-Bit A/D Converter: Example of Settings for Conversion in Single Mode

Lesson 3: Arduino. Goals

Timer A (0 and 1) and PWM EE3376

EE445L Fall 2014 Quiz 2A Page 1 of 5

Microcontroller Systems. ELET 3232 Topic 21: ADC Basics

CSCI1600 Lab 4: Sound

AC Induction Motor (ACIM) Control using a Digital Signal Controller (DSC)

UM2068 User manual. Examples kit for STLUX and STNRG digital controllers. Introduction

Chapter 12: Analog-to-Digital Converter. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Peripheral Link Driver for ADSP In Embedded Control Application

XGATE Library: PWM Driver Generating flexible PWM signals on GPIO pins

GigaDevice Semiconductor Inc. GD32F10xxx ARM Cortex -M3 32-bit MCU. Application Note AN003

4 x 10 bit Free Run A/D 4 x Hi Comparator 4 x Low Comparator IRQ on Compare MX839. C-BUS Interface & Control Logic

AN3137 Application note

8-bit Atmel tinyavr Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny1634

AC : PERSONAL LAB HARDWARE: A SINE WAVE GENERATOR, LOGIC PULSE SIGNAL, AND PROGRAMMABLE SYNCHRONOUS SERIAL INTERFACE FOR ENHANCING EDUCATION

Monitoring of Intravenous Drip Rate

NuMicro N76E003 Brushless DC Motor Control User Manual

AN3252 Application note

High Performance, Low Power Atmel AVR 8-bit Microcontroller Advanced RISC Architecture. Non-volatile Program and Data Memories. Peripheral Features

Image Acquisition Method Based on TMS320DM642

Analog-to-Digital Converter (ADC) And Digital-to-Analog Converter (DAC)

1. R-2R ladder Digital-Analog Converters (DAC). Connect the DAC boards (2 channels) and Nexys 4 board according to Fig. 1.

Embedded Systems and Software. Analog to Digital Conversion

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

Successive approximation (capacitive coupling amplifier)

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny1634

Graphical Control Panel User Manual

DNT90MC DNT90MP. Low Cost 900 MHz FHSS Transceiver Modules with I/O

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss

USB4. Encoder Data Acquisition USB Device Page 1 of 8. Description. Features

ECE2049: Embedded Systems in Engineering Design Lab Exercise #4 C Term 2018

Serial Communication AS5132 Rotary Magnetic Position Sensor

Hello, and welcome to this presentation of the STM32G0 digital-to-analog converter. This block is used to convert digital signals to analog voltages

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

NJU26206 Application Note

Lab Exercise 6: Digital/Analog conversion

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10

MAXREFDES39#: POWER AMPLIFIER BIASING THROUGH MAX11300 PIXI

Using the M16C/62 Analog to Digital Converter in One-Shot Mode

Multi-axis motion control

Roland Kammerer. 13. October 2010

EITF40 Digital and Analogue Projects - GNSS Tracker 2.4

UM1763 User manual. Description of STLUX385A examples kit. Introduction. Reference documents

LM4: The timer unit of the MC9S12DP256B/C

Section bit A/D Converter

Transcription:

P89LPC935 ADC/DAC Tutorial The P89LPC935 microcontroller has 2 on-board analog to digital modules Each module contains a 4-channel 8-bit successive approximation ADC 89LPC935 ADC/DAC Tutorial 1

ADC Module Features 2 8-bit 4-channel multiplexed input A/D converters Separate result registers for each channel Six operating modes Single or continuous conversion Scan mode 4 conversion start modes Conversion time of 13 ADC clocks (3.9usec for a 3.3MHz clock) May be polled or interrupt driven Each ADC module may be configured in DAC mode to produce a single analog output 89LPC935 ADC/DAC Tutorial 2

ADC Input/Output Pins ADC Input Channel Port Pin Result Register DAC Output Channel AD00 P1.7 ADODAT0 AD01 P0.0 ADODAT1 AD02 P2.1 ADODAT2 AD03 P2.0 ADODAT3 DAC0 AD10 P0.1 AD1DAT0 AD11 P0.2 AD1DAT1 AD12 P0.3 AD1DAT2 AD13 P0.4 AD1DAT3 DAC1 89LPC935 ADC/DAC Tutorial 3

DAC Operation 2 DACs are available for use on the LPC935 The DAC0 output pin is P2.0 The DAC0 input register is AD0DAT3 Writing to this register will update the DAC analog output The DAC1 output pin is P0.4 The DAC1 input register is AD1DAT3 Writing to this register will update the DAC analog output DAC Channel 0 DAC Channel 1 AD0DAT3 DAC0 P2.0 AD1DAT3 DAC1 P0.4 Write data to register Write data to register 89LPC935 ADC/DAC Tutorial 4

Configuring a DAC Ensure that the DAC output is configured as an output Configure for quasi-bidirectional mode Enable the ADC module in the ADCON0 or the ADCCON1 register ENADC0 = 1 in ADCON0 register ENADC1 = 1 in ADCON1 register Enable the DAC in the ADMODB register ENDAC0 = 1 for DAC0 ENDAC1 = 1 for DAC1 Program Example Write a C program to generate a sawtooth waveform using DAC0. 89LPC935 ADC/DAC Tutorial 5

Generating a sawtooth wave using DAC1 #include <REG935.H> void main() { unsigned char data x ; //configure Port 2 as quasi-bidirectional P2M1 = 0x00; P2M2 = 0x00; //Configure the DAC ADCON1 = 0x04; ADMODB = 0x08; //AD1 enabled //DAC mode for ADC1 } //Sawtooth wave generation while(1) { for(x=0; x<256; x++) { AD1DAT3 = x; } } //write to conversion register 89LPC935 ADC/DAC Tutorial 6

A/D Control Register 89LPC935 ADC/DAC Tutorial 7

A/D Mode Register B 89LPC935 ADC/DAC Tutorial 8

ADC Operation The 89LPC935 micro ADC operation can be quite complex with 6 conversion modes and 4 trigger modes This tutorial will demonstrate the use of the ADC in it s simplest format Single channel conversion with immediate start Refer to the LPC935 user guide for multi-channel conversions with different trigger modes We will write a program to measure the voltage on ADC1 channel 2 (pin P0.3) and to display the digital value on the LEDs connected to Port 2 3.3V LPC935 P0.3 P2 89LPC935 ADC/DAC Tutorial 9

Configuring the ADC Configure the ADINS register to enable the relevant ADC channel For ADC1 channel 2, ADINS = 40H Configure the ADC conversion mode in the ADMODA register SCAN bit = 1 for fixed channel single conversion mode ADMODA = 10H Enable ADC channel 1 ADCON1 = 04H Configure the ADC clock in the ADMODB register Max ADC clock is 3.3MHz The ADCON1 control register is used to start a conversion and contains an end of conversion flag To start a conversion set the ENADC1 bit (bit 0) ADCON1 = 0x01; The ADCI1 bit (bit 3) goes high when a conversion is complete The ADCI1 bit must be cleared by software 89LPC935 ADC/DAC Tutorial 10

#include <REG935.H> void main() { //configure Port 2 as quasi-bidirectional P2M1 = 0x00; P2M2 = 0x00; C Program //Configure the ADC ADINS = 0x40; ADMODA = 0x10; ADCON1 = 0x04; ADMODB = 0xE0; //select AD12 as ADC input (pin P0.3) //AD1 in fixed channel single conversion mode //ADC channel 1 enabled //divide by 8 ADC clock } while(1) { ADCON1 = 0x01; while((adcon1 & 0x08) == 0); ADCON1 &= 0xF7; P2 = AD1DAT2; } //start conversion immediately //wait for end of conversion //clear EOC flag //display result on port 2 LEDs 89LPC935 ADC/DAC Tutorial 11

ADC Simulation After starting the debugger, select the A/D Converter channel 1 from the Peripherals pull-down menu An analog input voltage may be simulated by changing the AD12 field in the bottom right-hand corner of the peripheral window 89LPC935 ADC/DAC Tutorial 12

ADINS Register 89LPC935 ADC/DAC Tutorial 13

ADMODA Register 89LPC935 ADC/DAC Tutorial 14

ADCON1 Register 89LPC935 ADC/DAC Tutorial 15

ADMODB Register 89LPC935 ADC/DAC Tutorial 16