"); //-->
代码
#include<p16f722a.inc> ;__CONFIG _CONFIG1 (_LP_OSC & _PWRTE_OFF & _WDT_OFF & _CP_OFF); ;__CONFIG _CONFIG1, _PWRTE_ON , _XT_OSC , _WRT_OFF , _LVP_OFF, _CPD_OFF cblock 0x20 adChSel adValBuff count1 count2 endc org 0x00 goto main org 0x20 main banksel TRISC MOVLW .0 ;MOVWF TRISB MOVWF TRISC banksel PORTB CLRF PORTB BANKSEL ADCON1 ;CLRF ADCON1 MOVLW B'10' MOVWF ADCON1 MOVLW B'00000001' MOVWF TRISA BANKSEL ADCON0 MOVLW B'000001' MOVWF ADCON0 CLRF adChSel CLRF adValBuff Loop CALL AdConvert goto Loop AdConvert call SamplingDelay clrf STATUS BSF ADCON0,GO BTFSC ADCON0,GO GOTO $-1 BANKSEL ADRES movf ADRES,W banksel PORTC MOVWF PORTC return SamplingDelay ;clrf count1 clrf count2 decfsz count2,f goto $-1 ;decfsz count1,f ;goto $-3 return END
仿真效果图
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。