英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流
标题:
RA1电平中断唤醒 zhuan
[打印本页]
作者:
star
时间:
2012-8-21 18:18
标题:
RA1电平中断唤醒 zhuan
;********************************************************************
list p=16F676,R=DEC ; list directive to define processor
#include <p16F676.inc> ; processor specific variable definitions
; errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
;**********************************************************************
ORG 0 ; processor reset vector
GOTO INIT ; go to beginning of program
ORG 4 ; interrupt vector location
RETFIE
;---------------------
IINIT
BCF STATUS,RP0
MOVLW 00010000B
MOVWF PORTA
MOVLW 00111000B
MOVWF PORTC
CALL 0x3FF ; retrieve factory calibration value
BSF STATUS,RP0 ; set file register bank to 1
MOVWF OSCCAL ; update register with factory cal value
; set file register bank to 0
MOVLW 10H
MOVWF ANSEL
MOVLW 00001010B ;A0,A5,INPUT
MOVWF TRISA
MOVLW 00000001B ;
MOVWF TRISC
MOVLW 07H ;1:128,up_enable
MOVWF OPTION_REG
MOVLW 00000010B
MOVWF WPUA
MOVLW 00000010B
MOVWF IOCA
MOVLW 01010000B
MOVWF ADCON1 ;FOSC/16
CLRWDT
BCF STATUS,RP0
MOVLW 07H ;
MOVWF CMCON ;io set digital
MOVLW 10010001B
MOVWF ADCON0
MOVLW 08H ; RAIE
MOVWF INTCON
NOP
BTFSS PORTA,1
GOTO $-1
MOVF PORTA,0
BCF INTCON,RAIF ;要清中断
nop
sleep
nop
BSF PORTA,0
GOTO $
;------------------------------------------
END ; directive 'end of program'
欢迎光临 英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 (http://enroobbs.com/)
Powered by Discuz! X3.2