DataSheet.es    


PDF AN546 Data sheet ( Hoja de datos )

Número de pieza AN546
Descripción Using the Analog to Digital Converter
Fabricantes Microchip Technology 
Logotipo Microchip Technology Logotipo



Hay una vista previa y un enlace de descarga de AN546 (archivo pdf) en la parte inferior de esta página.


Total 20 Páginas

No Preview Available ! AN546 Hoja de datos, Descripción, Manual

M
AN546
Using the Analog-to-Digital (A/D) Converter
Authors:
Sumit Mitra,
Stan D’Souza, and
Russ Cooper
Microchip Technology Inc.
www.DataSheet4U.com
INTRODUCTION
This application note is intended for PIC16C7X users with
some degree of familiarity with analog system design.The
various sections discuss the following topics:
• Commonly used A/D terminology
• How to configure and use the PIC16C71 A/D
• Various ways to generate external reference
voltage (VREF)
• Configuring the RA3:RA0 pins
COMMONLY USED A/D
TERMINOLOGY
The Ideal Transfer Function
In an A/D converter, an analog voltage is mapped into
an N-bit digital value. This mapping function is defined
as the transfer function. An ideal transfer is one in which
there are no errors or non-linearity. It describes the
“ideal” or intended behavior of the A/D. Figure 1 shows
the ideal transfer function for the PIC16C7X A/D.
FIGURE 1: PIC16C7X IDEAL TRANSFER
FUNCTION
FFh
FEh
Note that the digital output value is 00h for the analog
input voltage range of 0 to 1LSb. In some converters,
the first transition point is at 0.5LSb and not at 1LSb as
shown in Figure 2. Either way, by knowing the transfer
function the user can appropriately interpret the data.
Transition Point
The analog input voltage at which the digital output
switches from one code to the next is called the “Tran-
sition Point.” The transition point is typically not a single
threshold, but rather a small region of uncertainty
(Figure 3). The transition point is therefore defined as
the statistical average of many conversions. Stated dif-
ferently, it is the voltage input at which the uncertainty
of the conversion is 50%.
Code Width
The distance (voltage differential) between two
transition points is called the “Code Width.” Ideally the
Code Width should be 1LSb (Figure 1).
FIGURE 2: ALTERNATE TRANSFER
FUNCTION
FFh
FEh
Code Width
(CW)
04h
03h
02h
01h
00h
Analog input
voltage
04h
03h
02h
01h
00h
Analog input
voltage
© 1997 Microchip Technology Inc.
DS00546E-page 1

1 page




AN546 pdf
EXAMPLE 2: SEQUENTIAL CHANNEL CONVERSIONS
;
; InitializeAD, initializes and sets up the A/D hardware.
; Select ch0 to ch3 in a round robin fashion, internal RC OSC.
; Load results in 4 consecutive addresses starting at ADTABLE (10h)
;
InitializeAD
bsf
STATUS, RP0
; select Bank1
movlw
b'00000000'
; select RA3-RA0
movwf
ADCON1
; as analog inputs
bcf
STATUS, RP0
; select Bank0
movlw
b'11000001'
; select: RC osc, ch0...
movwf
ADCON0
; turn on A/D
movlw
ADTABLE
; point fsr to top of...
www.DataSheet4U.com
;
movwf
FSR
; table
new_ad call
sample_delay
; provide necessary sampling time
bsf ADCON0, GO ; start new A/D conversion
loop
btfsc
ADCON0, GO
; A/D over?
goto
loop
; no then loop
;
movf
adres, w
; yes then get A/D value
movwf
0
; load indirectly
movlw
4
; select next channel
addwf
ADCON0
;/
bcf
ADCON0, ADIF
; reset interrupt flag bit.
; increment pointer to correct table offset.
clrf
temp
; clear temp register
btfsc
ADCON0, CH50
; test lsb of channel select
bsf temp, 0
; set if ch1 selected
btfsc
ADCON0, CH51
; test msb of channel select
bsf temp, 1
;/
movlw
ADTABLE
; get table address
addwf
temp, w
; add with temp
movwf
FSR
; move into indirect
goto
new_ad
;
A detailed code listing is provided in Appendix B.
AN546
© 1997 Microchip Technology Inc.
DS00546E-page 5

5 Page





AN546 arduino
AN546
Please check the Microchip BBS for the latest version of the source code. Microchip’s Worldwide Web Address:
www.microchip.com; Bulletin Board Support: MCHIPBBS using CompuServe® (CompuServe membership not
required).
APPENDIX A: SINGLE CHANNEL A/D (SAD)
MPASM 01.40 Released
SAD.ASM 1-16-1997 15:22:04
PAGE 1
LOC OBJECT CODE
VALUE
www.DataSheet4U.com
00000010
00000001
00000002
0000
0000 2810
0004
0004 281E
0010
0010
0010 3000
0011 0086
0012 1683
0013 0086
0014 1283
0015 201F
0016
0016 0809
0017 0086
0018 2027
0019 1088
001A 1508
001B
001B 1888
001C 2816
LINE SOURCE TEXT
00001 ;TITLE "Single channel A/D (SAD)"
00002 ;This program is a simple implementation of the PIC16C71's
00003 ;A/D. 1 Channel is selected (CH0).
00004 ;The A/D is configured as follows:
00005 ;
Vref = +5V internal.
00006 ;
A/D Osc. = internal RC
00007 ;
A/D Channel = CH0
00008 ;Hardware for this program is the PICDEM1 board.
00009 ;
00010 ;
00011 ;
Program:
SAD.ASM
00012 ;
Revision Date:
00013 ;
1-14-97
Compatibility with MPASMWIN 1.40
00014 ;
00015 ;
00016
LIST P=16C71
00017
ERRORLEVEL -302
00018 ;
00019
include "p16c71.inc"
00001
LIST
00002 ;P16C71.INC Standard Header File, Version 1.00 Microchip Technology
00142
LIST
00020 ;
00021 TEMP EQU
10h
00022 adif equ
1
00023 adgo equ
2
00024 ;
00025
ORG 0x00
00026 ;
00027 ;
00028
goto start
00029 ;
00030
org 0x04
00031
goto service_int
;interrupt vector
00032 ;
00033 ;
00034
org 0x10
00035 start
00036
movlw B'00000000'
;set port b as
00037
movwf PORTB
;all outputs
00038 ;
tris PORTB
;/
00039
BSF STATUS, RP0 ; Bank1
00040
MOVWF TRISB
; PortB as outputs
00041
BCF STATUS, RP0 ; Bank0
00042 ;
00043
call InitializeAD
00044 update
00045
movf ADRES,W
;get a/d value
00046
movwf PORTB
;output to port b
00047
call SetupDelay
;setup time >= 10uS.
00048
bcf ADCON0,adif ;clear int flag
00049
bsf ADCON0,adgo ;start new conversion
00050 loop
00051
btfsc ADCON0,adif
;a/d done?
00052
goto update
;yes then update new value.
© 1997 Microchip Technology Inc.
DS00546E-page 11

11 Page







PáginasTotal 20 Páginas
PDF Descargar[ Datasheet AN546.PDF ]




Hoja de datos destacado

Número de piezaDescripciónFabricantes
AN540Implementing IIR Digital FiltersMicrochip Technology
Microchip Technology
AN541Using PIC16C5x as a Smart IIC PeripheralMicrochip Technology
Microchip Technology
AN5410(AN5410 / AN5411) Color TV Deflection Signal Processing CircuitsPanasonic
Panasonic
AN5411(AN5410 / AN5411) Color TV Deflection Signal Processing CircuitsPanasonic
Panasonic

Número de piezaDescripciónFabricantes
SLA6805M

High Voltage 3 phase Motor Driver IC.

Sanken
Sanken
SDC1742

12- and 14-Bit Hybrid Synchro / Resolver-to-Digital Converters.

Analog Devices
Analog Devices


DataSheet.es es una pagina web que funciona como un repositorio de manuales o hoja de datos de muchos de los productos más populares,
permitiéndote verlos en linea o descargarlos en PDF.


DataSheet.es    |   2020   |  Privacy Policy  |  Contacto  |  Buscar