EEE527 Embedded Systems Lecture 10B:Chapter 11 Analogue to Digital Convertors (ADCs) (version 2: 25/11/13, see after slide 20 Ian McCrumRoom 5B18, Tel:

Slides:



Advertisements
Similar presentations
Encoders and Decoders.
Advertisements

Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.
Analog-to-Digital Converter (ADC) And
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
Data Acquisition Concepts Data Translation, Inc. Basics of Data Acquisition.
Chapter 11 It’s an Analog World Learning to use the Analog to Digital Converter.
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.
Lecture 5: PIC32 development board, Timers ADC and interrupts,
5-1 Analogue Input/Output Many sensors/transducers produce voltages representing physical data.  To process transducer data in a computer requires conversion.
PIC16F bit 8-channel Analog-to-Digital Converter.
Slides created by: Professor Ian G. Harris Inputs and Outputs PIC Vcc RA3 RA4 RA5  Make an LED toggle state when button is pressed  Need to read RA3,
Railway Foundation Electronic, Electrical and Processor Engineering.
Railway Foundation Electronic, Electrical and Processor Engineering.
PH4705/ET4305: A/D: Analogue to Digital Conversion
EEE305 Microcontroller Systems Lecture 5B: Simple I/O Embedded C using PIC microcontrollers Teaching resources on on
EEE527 Embedded Systems Lecture 8: Practical Interrupts Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring Web site:
EEE527 Embedded Systems Lecture 3: Chapter 1: Using MPLAB (X) + XC32 Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Digital to Analogue Converter
Lecture 13 A/D Converter & D/A Converter. Outline Basic Operation Single Scan Mode Continuous Scan Mode Group Scan Mode Interrupt Sources Registers D/A.
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Specview 32 Release 2.5 Enhancements
dsPIC DSC –Modul A/D Conversia A/D Registre programare
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.
Chapter 2 Introducing the PIC Mid-Range Family and the 16F84A The aims of this chapter are to introduce: The PIC mid-range family, in overview The overall.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
Alexei SemenovGeneric Digitizer Generic Digitizer 10MHZ 16 bit 6U VME Board.
EEE527 Embedded Systems Lecture 2: Chapter 2: C and Using more MPLAB (X) + XC32 Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring
EEE527 Embedded Systems Lecture 12: Mini-Project Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring Web site:
CS224 I/O. Timers Timer1 is 16-bit timer 2^16-1 or 65,535 SYSCLK = 40MHz, Prescalers – 1:1, 1:8, 1:64, and 1:256 – Use T1CONbits.TCKPS=3 for 1:256 scaling.
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
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
Chapter 5 - Interrupts.
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
Chapter 11 Data Acquisition and Manipulation The aims of this chapter are to introduce: the main features of a data acquisition system; the characteristics.
Lab 3: ADC.
Device Overview 1.  The advantages of all PIC18Fxxxx microcontrollers:  High computational performance  High-endurance  Enhanced Flash program memory.
Department of Electronic & Electrical Engineering Further work? Simple Voltmeter. ● Analogue to Digital converter (MCP3001 SPI ) ● Analogue → 10bit binary.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
Chapter 12 Some PIC Microcontroller Advances The aims of this chapter are to introduce: To introduce in overview two microcontrollers which show some enhanced.
EEE515J1_L4-1/12 EEE515J1 ASICs and DIGITAL DESIGN EGBCDCNT.pdf An example of a synchronous sequential machine.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
Prepared by: Careene McCallum-Rodney Multiplexor.
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.
Electronic instrumentation Digitization of Analog Signal in TD
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),
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
 Mini-Computer ◦ Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output)  Low-Cost.
UNIT – Microcontroller.
Prof. Chung-Ta King Department of Computer Science
Chapter 10 It’s an Analog World
PIC18F458 Analog-to-Digital
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz.
Lecture 13 A/D Converter & D/A Converter
CSCI1600: Embedded and Real Time Software
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
MSP432™ MCUs Training Part 6: Analog Peripherals
CSCI1600: Embedded and Real Time Software
PIC Analog Input Tom Igoe, NYU-ITP
PIC Microcontroller ADC interfacing Prof. Ashvini Kulkarni
The Programmable Peripheral Interface (8255A)
ECE 3567 Microcontroller Lab
Presentation transcript:

EEE527 Embedded Systems Lecture 10B:Chapter 11 Analogue to Digital Convertors (ADCs) (version 2: 25/11/13, see after slide 20 Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring Web site: "Adapted from the text “Programming 32-bit Microcontrollers in C – Exploring the PIC32, © 2008.” Lucio di Jasio

The DP32 board has AN9 wired to a Variable Resistor AN9 is RB15/RPB15, pin 26 on the 28 pin device

The DP32 board has AN9 wired to a Variable Resistor AN9 is RB15/RPB15, pin 26 on the 28 pin device Redo this code for AN9

The DP32 board has AN9 wired to a Variable Resistor AN9 is RB15/RPB15, pin 26 on the 28 pin device Redo this code for AN9

Bit 15 ON 1 = ADC is operating Bit 13 SIDL only relevant in idle mode Bit 10-8 FORM 000 = 16 bit Data out – bottom 10 bits are the reading Bit 7-5 SSRC 000 = clearing SAMP bit ends sampling and starts conversion Bit 4 CLRASAM 0 = normal, buffer get overwritten by next conversion sequence Bit 2 ASAM 1 = sampling begins as soon as last conversion complete 0 = Sampling begins when SAMP bit is set Bit 1 SAMP 1 = ADC sample and hold Amp is sampling 0 = ADC sample and hold Amp is holding When ASAM = 0, writing ‘1’ to this bit starts sampling When SSRC = 000, put ‘0’ in SAMP -ends sampling & starts conversion Bit 0 DONE 1 = ADC conversion is done

Bit VCFG 000 = Vrefh = AVDD and Vrefl = Avss (3.3V and 0V) Bit 12 OFFCAL 0 = disable input offset calibration Bit 10 CSNA 0 = do not scan inputs {1 = scan inputs} Bit 7 BUFS only valid if BUFM is ‘1’; 1 = ADC is filling buffer 8-F, you read = ADC is filling buffer 0-7, you read 8-F Bit 5-2 SMPI 0000 = Interrupt at completion of conversion for each sample Bit 1 BUFM 0 = Buffer configures as one 16 word buffer ADC1BUFF to ADC1BUF0 1 = Buffer configures as two 8 word buffers Bit 0 ALTS 0 = Use Sample A input multiplexor settings {1=>alternate sample A/B)

bit 15 ADRC: ADC Conversion Clock Source bit 1 = Clock derived from FRC 0 = Clock derived from Peripheral Bus Clock (PBCLK) bit 12-8 SAMC : Auto-Sample Time bits =31 T AD =1 TAD =0 TAD (Not allowed) bit 7-0 ADCS : ADC Conversion Clock Select bits =TPB 2 (ADCS + 1) = 512 TPB = TAD =TPB 2 (ADCS + 1) = 4 TPB = TAD =TPB 2 (ADCS + 1) = 2 TPB = TAD

bit 31 CH0NB1 = Channel 0 negative input is AN1 0 = Channel 0 negative input is VREFL bit CH0SB : Positive Input Select bits for Sample B 1111 = Channel 0 positive input is Open 1100 = Channel 0 positive input is AN = Channel 0 positive input is AN = Channel 0 positive input is AN0 bit 23 CH0NA: Negative Input Select bit for Sample A Multiplexer Setting 1 = Channel 0 negative input is AN1 0 = Channel 0 negative input is VREFL bit CH0SA : Positive Input Select bits for Sample A Mux Setting 1111 = Channel 0 positive input is Open 1110 = Channel 0 positive input is IVREF 1101 = Channel 0 positive input is CTMU temperature (CTMUT) 1100 = Channel 0 positive input is AN = Channel 0 positive input is AN = Channel 0 positive input is AN0

The 10-bit ADC can be split into two sections: Acquisition and Conversion.

Manual Mode Configuration In manual mode, the programmer must make an individual request every time the ADC starts a sample. In the version presented here, the acquisition is started manually by setting AD1CON1bits.SAMP HIGH. Conversion will then start automatically after an amount of time specified in the AD1CON3 SFR. When acquisition is finished, the SAMP bit will go LOW. When conversion is done, the AD1CON1bits.DONE bit will go HIGH. The result will be stored in one of the ADC1BUFx registers. Since we’re only requesting the analog value of one pin at a time in this manual mode, the result is always stored in the first buffer register or ADC1BUF0. The AD1CHS is the channel select SFR. Of importance to us is that AD1CHS control which pin is being input to the ADC. With this information, we can make a simple function that takes as input an analog pin number and returns the 10-bit analog voltage as an int from as follows.

To configure for this mode, we set the conversion to trigger automatically after acquisition is done by setting the SSRC bits found at AD1CON1. Choosing manual mode is also found in this register. In AD1CON3, we will set the source of the ADC clock, how long a period (TAD) is, and how many periods of this clock per acquisition. Conversion is always 12 TAD cycles long. We’ll set the analog clock period to be four times the peripheral bus clock period which will be equal to SYSCLK. TAD = 4*TPB. At FPB = 50MHz, TAD = 4*TPB = 80ns. To be on the safe side, we’ll configure the acquisition period as 15*TAD = 1.2us. Thus, the entire analog-to-digital conversion takes 27*TAD = 2.16us. The configuration is shown below.

Automatic Scan Configuration In the automatic scan mode we’ll be using, the ADC peripheral will be sampling and converting a specified number of analog pins as long as the ADC has power. Whenever the processor then requests the 10-bit voltage representation of some of these pins, the ADC peripheral will give the most recent completed conversion. With this method, ADC call latency is severely reduced! Once the ADC is configured and running, every additional pin request is as simple as a single assignment line. However, this method uses slightly more power as the ADC is constantly sampling and converting voltages. Also, while the ADC call time is very short, there is a minimum time between calls to make sure new analog voltages have been sampled. We’re only talking a few microseconds and even this can be reduced by careful planning of the ADC clock (TAD) and how many cycles are necessary for sampling in your particular application! Please read the link below if you wish to understand this further

Working ADC Code on the DP32; using AN9(RB15) and LEDs 3-0(RB0-3) Modified from

Modified from

Modified from

Exercises 1.Add a timedelay so that a reading is taken every 1/100 th second. 2.Add a buffer so that data is continually filling a 1024 ring buffer 3.Output on the LEDs how full the buffer is 4.Convert the ADC routine so that it fills the buffer under interrupts and the only code is main loops continually checking how full the buffer is, These exercises prepare you for the mini-project.