| 数据搜索系统,热门电子元器件搜索 |
|
AN672 数据表(PDF) 2 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN672 数据表(HTML) 2 Page - STMicroelectronics |
|
2 / 3 page ![]() 2/3 Optimizing The St6 A/d Converter Accuracy ;******************** SUBROUTINE AVERAGE *********************** ;description: measures ADC input 256 times and stores average * ; of the 256 measures into accumulator * ;*************************************************************** average lid ior,10h ; global enable interrupts clr aver_lo ;aver_lo, aver_hi and count are RAM registers clr aver_hi ldi count,255 ; set for 256 measurements aver1 ldi adcc,10110000b ; start conversion with interrupt wait ld a,adc ;======================= two byte addition of adc to 16-bit word: add a, aver_lo jrnc aver2 inc aver_hi aver2 ld aver_lo,a ;======================= end of two byte addition ld a,count jrz aver4 dec count jp aver1 ;do it 256 times aver4 ld a,aver_lo cpi a,127 ;round to next value if decimal part >0.5 jrc aver3 inc aver_hi aver3 ld a, aver_hi ;store high byte of result into accumulator, ret ;the low byte is not significant ;*********************** interrupt service routine ************* adcint ldi adcc,10h reti ;*********************** interrupt vector ********************** .org 0ff0h jp adcint 2 |
|
|
链接网址 |
| 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 |