| 数据搜索系统,热门电子元器件搜索 |
|
PIC16F506T-E/MCSQTP 数据表(PDF) 56 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F506T-E/MCSQTP 数据表(HTML) 56 Page - Microchip Technology |
|
56 / 116 page ![]() PIC12F510/16F506 DS41268C-page 54 Preliminary © 2007 Microchip Technology Inc. EXAMPLE 9-1: PERFORMING AN ANALOG-TO-DIGITAL CONVERSION EXAMPLE 9-2: CHANNEL SELECTION CHANGE DURING CONVERSION REGISTER 9-2: ADRES REGISTER R-X R-X R-X R-X R-X R-X R-X R-X ADRES7 ADRES6 ADRES5 ADRES4 ADRES3 ADRES2 ADRES1 ADRES0 bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown ;Sample code operates out of BANK0 MOVLW 0xF1 ;configure A/D MOVWF ADCON0 BSF ADCON0, 1 ;start conversion loop0 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop0 MOVF ADRES, W ;read result MOVWF result0 ;save result BSF ADCON0, 2 ;setup for read of ;channel 1 BSF ADCON0, 1 ;start conversion loop1 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop1 MOVF ADRES, W ;read result MOVWF result1 ;save result BSF ADCON0, 3 ;setup for read of BCF ADCON0, 2 ;channel 2 BSF ADCON0, 1 ;start conversion loop2 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop2 MOVF ADRES, W ;read result MOVWF result2 ;save result MOVLW 0xF1 ;configure A/D MOVWF ADCON0 BSF ADCON0, 1 ;start conversion BSF ADCON0, 2 ;setup for read of ;channel 1 loop0 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop0 MOVF ADRES, W ;read result MOVWF result0 ;save result BSF ADCON0, 1 ;start conversion BSF ADCON0, 3 ;setup for read of BCF ADCON0, 2 ;channel 2 loop1 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop1 MOVF ADRES, W ;read result MOVWF result1 ;save result BSF ADCON0, 1 ;start conversion loop2 BTFSC ADCON0, 1;wait for ‘DONE’ GOTO loop2 MOVF ADRES, W ;read result MOVWF result2 ;save result CLRF ADCON0 ;optional: returns ;pins to Digital mode and turns off ;the ADC module |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |