Data acquisition and manipulation - PowerPoint PPT Presentation

About This Presentation
Title:

Data acquisition and manipulation

Description:

Data acquisition and manipulation Chapter Eleven 11.1 - 11.3 Dr. Gheith Abandah * Outline Introduction The main features of a data acquisition system The ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 31
Provided by: abandahCo
Category:

less

Transcript and Presenter's Notes

Title: Data acquisition and manipulation


1
Data acquisition and manipulation
  • Chapter Eleven
  • 11.1 - 11.3

2
Outline
  • Introduction
  • The main features of a data acquisition system
  • The characteristics of an analog-to-digital
    converter
  • The characteristics of the 16F873A
    analog-to-digital converter
  • Summary

3
Analog vs. Digital
4
Analog to Digital Conversion
  • Most physical signals are analog.
  • Analog signals are captured by sensors or
    transducers.
  • Examples temperature, sound, pressure,
  • Need to convert to digital signals to facilitate
    processing by the microcontroller.
  • The device that does this is analog-to-digital
    converter (ADC).

5
ADC Types
  • Dual ramp (slow with very high accuracy, for
    precision measurements)
  • Flash converter (fast, lesser accuracy, for video
    or radar)
  • Successive approximation (medium speed and
    accuracy, for general-purpose industrial
    applications, commonly found in embedded systems)

6
Conversion characteristic
  • Voltage Range
  • Vr Vmax 0
  • Resolution
  • Vr / 2n
  • Quantization error
  • Resolution / 2
  • Vr / 2n1

7
Conversion Steps
  • Get Sample
  • Start conversion
  • Wait
  • Read digital value (in parallel or serially)
  • Usually need a voltage reference

8
Elements of a data acquisition system
  • Transducers physical to electrical
  • Amplify and offset circuits
  • The input voltage should traverse as much of its
    input range as possible
  • Voltage level shifting may also be required
  • Filter get rid of unwanted signal components
  • Multiplexer select one of multiple inputs
  • Sampler the conversion rate must be at least
    twice the highest signal frequency (Nyquist
    sampling criterion)
  • ADC

9
Elements of a data acquisition system
10
Sample and hold, and acquisition time
11
Sample and hold, and acquisition time
12
Example
  • What should be the acquisition time for a 10-bit
    ADC?
  • The voltage should rise to
  • Vs quantization error Vs - Vs / 2n1
  • Vs(2047/2048) 0.9995 Vs
  • VC Vs 1 - exp(-t/RC)
  • 0.9995Vs Vs 1 - exp(-t/RC)
  • exp(-t/RC) 1 - 0.9995
  • -t RC ln(0.0005)
  • t 7.6RC

13
Typical timing requirement of one A-to-D
conversion
14
Data acquisition in the microcontroller
environment
  • To operate to a good level of accuracy, an ADC
    needs a clean power supply and ground and no
    electromagnetic interference.
  • When an ADC is integrated inside a
    microcontroller, it will be affected by the noisy
    internal power sources.
  • So, integrated ADCs are not very accurate,
    typically 8- or 10-bit.

15
The PIC 16 Series
16
The PIC 16F87XA ADC module
17
Controlling the ADC
  • The ADC is controlled by two SFRs
  • ADCON0 (1Fh)
  • ADCON1 (9Fh)
  • The result of the conversion is placed in
  • ADRESH (1Eh)
  • ADRESL (9Eh)

18
ADCON0 A/D Control Register 0 (address 1Fh)
  • ADCS10 conversion clock select
  • CHS20 analog channel select
  • GO/DONE conversion status
  • The ADC interrupt flag ADIF and interrupt
  • enable ADIE bits can also be used
  • U unimplemented
  • ADON A/D On

19
A/D Conversion Clock Select bits
  • A full 10-bit conversion takes around 12 TAD
    cycles
  • TAD should be equal to or just greater than 1.6
    µs
  • Minimum 2TAD between two successive conversions
  • Maximum conversion rate is 30 kHz, higher rate by
    switching to higher TAD after starting the
    conversion

20
ADCON1 A/D Control Register 1 (address 9Fh)
  • ADFM result format select
  • 1 Right justified
  • 0 Left justified
  • ADCS2 conversion clock select
  • U unimplemented
  • PCFG30 port configuration control

21
A/D result format
22
A/D Port Configuration Control
23
The analog input model
24
Calculating acquisition time
  • tac Amplifier settling time
  • Hold capacitor charging time
  • Temperature coefficient
  • tac 2 µs
  • 7.6RC for 10-bit accuracy
  • (Temperature - 25?C)(0.05 µs/?C)

25
Calculating acquisition time - Example
  • RSS 7kO, RIC 1kO (VDD 5V), RS 0,
  • Temp 35 ?C, TAD 1.6 µs
  • tac 2 µs
  • 7.6(7kO 1kO 0)(120pF)
  • (35 - 25)(0.05 µs/?C)
  • 2 7.3 0.5 9.8 µs
  • Total time tac 12TAD 9.8 19.2 µs 29 µs

26
A/D Example Page 1
  • ...
  • bsf status,rp0
  • movlw B'00001011' set port A bits,
  • movwf trisa ADC set as inputs
  • movlw B'10000100' bits 0,1,3 analog input
  • movwf adcon1 right justify result
  • ...

27
A/D Example Page 2
  • ...
  • bcf status,rp0
  • movlw B'01000001' set up ADC clock Fosc/8,
  • switch ADC on but not converting,
  • channel selection now is irrelevant
  • movwf adcon0

28
A/D Example Page 3
  • main_loop
  • movlw B'01000001' select channel 0
  • movwf adcon0
  • call delay20u acquisition time
  • bsf adcon0,go start conversion
  • btfsc adcon0,go_done conversion ended?
  • goto -1
  • movf adresh,0 read ADC output data high
  • movwf ldr_left_hi
  • bsf status,rp0
  • movf adresl,0 read ADC output data low
  • bcf status,rp0
  • movwf ldr_left_lo

29
Summary - 1
  • Most signals produced by transducers are analog
    in nature, while all processing done by a
    microcontroller is digital.
  • Analog signals can be converted to digital form
    using an analog-to-digital converter (ADC). The
    ADC generally forms just one part of a larger
    data acquisition system.
  • Considerable care needs to be taken in applying
    ADCs and data acquisition systems, using
    knowledge among other things of timing
    requirements, signal conditioning, grounding and
    the use of voltage references.

30
Summary - 2
  • The 16F873A has a 10-bit ADC module that contains
    the features of a data acquisition system.
  • Data values, once acquired, are likely to need
    further processing, including offsetting, scaling
    and code conversion. Standard algorithms exist
    for all of these, and Assembler libraries are
    published.
  • A simple interface between the analog and digital
    world is the comparator, which is commonly used
    to classify an analog signal into one of two
    states.
Write a Comment
User Comments (0)
About PowerShow.com