Chapter 4. A/D Demo – PIC16C71
The Update routine reads the A/D result register, writes the value it got to the
LEDs connected to PORTB, calls SetupDelay , clears the interrupt flag and
enables the next conversion.
Update
movf
movwf
call
bcf
bsf
ADRES,W
PORTB
SetupDelay
ADCON0,ADIF
ADCON0,ADGO
;get a/d value
;output to port b
;setup time >= 20uS.
;clear int flag
;start new conversion
The SetupDelay routine provides a software delay so that the sample and
hold circuit has enough time to settle before the A/D conversion is started.
The SD loop takes 2 μ s when TEMP is not equal to zero, so a value of nine
loaded into TEMP would provide a delay of 18 μ s. With the 2 μ s execution
time of the two moves before the SD loop and the call and return execution
times, a delay of greater than 20 μ s is provided for settling.
SetupDelay
SD
movlw
movwf
decfsz
goto
.3
TEMP
TEMP, F
SD
return
The Loop routine tests the A/D interrupt flag, and loops until it indicates that
the conversion has finished (ADIF = 0). When the conversion has finished, it
jumps back to Loop so that the A/D value can be read and output to the LEDs.
Loop
btfsc
goto
goto
ADCON0,ADIF
Update
Loop
;a/d done?
;yes then update new value.
;no then keep checking
? 1999 Microchip Technology Inc.
DS33015C-page 19
相关PDF资料
DM163004-LT BOARD DEMO PICDEM.NET
DM163005 KIT EVAL PIC16C432/433 LIN BUSS
DM163007 PICDEM CAN-LIN 1 FOR 18C658/858
DM163008 KIT MCP2120/2150 FOR IRDA COMM
DM163010 BOARD DEMO PICDEM USB
DM163012 BOARD DEMO PICDEM FOR 16C781/782
DM163024 BOARD DEMO PICDEM.NET 2
DM163025 PIC DEM FULL SPEED USB DEMO BRD
相关代理商/技术参数
DM163002 制造商:Microchip Technology Inc 功能描述:PIC16C64/74 DEMO BOARD
DM163003 功能描述:开发板和工具包 - PIC / DSPIC PICDEM 3 PIC16C923/4 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 功能描述:开发板和工具包 - PIC / DSPIC USE 579-DM163004-LT RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 制造商:Microchip Technology Inc 功能描述:DEMO BOARD W/TCP/IP ((NW))
DM163004-LT 功能描述:开发板和工具包 - PIC / DSPIC PICDEM.net Demo Kit w/o TCP/IP Lean Book RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163005 功能描述:开发板和工具包 - PIC / DSPIC PICDEM PIC16C432/3 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163006 功能描述:开发板和工具包 - PIC / DSPIC 18R PIC18C601/801 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163007 功能描述:开发板和工具包 - PIC / DSPIC For PIC18C658/858 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: