Main:
;PORTLAR AYARLANIYOR
BANKSEL PORTA ;
CLRF PORTA;
CLRF PORTB;
CLRF PORTC;
BANKSEL TRISA ;
MOVLW B'11111111' ;'00001101'
MOVWF TRISA
MOVLW B'11111111' ;'00011110'
MOVWF TRISB
MOVLW B'11111000'
MOVWF TRISC
BSF OPTION_REG,NOT_RBPU ;PULL UP KAPATILIYOR
BANKSEL ANSEL ;
MOVLW B'00000110' ;VREF+ VE VREF- ANALOG
MOVWF ANSEL
MOVLW B'00001111'
MOVWF ANSELH
BANKSEL ADCON1 ;
BSF ADCON1,ADFM ;SAGA YASLA
BSF ADCON1,VCFG0 ;SET IKEN +VREF GIRISINDEN RESETKEN VDD
BCF ADCON1,VCFG1 ;SET IKEN -VREFERANS HARICI RESETKEN VSS
;********************************************
;OSILATOR 125KHZ INTERNALE AYARLANIYOR
BANKSEL OSCCON
; MOVLW B'00000001' ;31KHZ
MOVLW B'01000001' ;1 MHZ
MOVWF OSCCON
;********************************************
GOTO MainLoop
;-------------------
UYUMAYAGIT: ;KONDANSATOR DOLDURULUYUR VE BOSALINCAYA KADAR UYUTULUYOR
BANKSEL PORTA ;
BSF PORTA,0 ;Set RA0 data latch
BANKSEL ANSEL ;
BCF ANSEL,0 ;RA0 to digital I/O
BANKSEL TRISA ;
BCF TRISA,0 ;Output high to
CALL BEKLE1S ;charge capacitor ;1UF KONDANSATORDE 2 DAK
BANKSEL PIR2 ; ;
BCF PIR2,ULPWUIF ;Clear flag
BANKSEL PCON
BSF PCON,ULPWUE ;Enable ULP Wake-up
BSF TRISA,0 ;RA0 to input
BSF PIE2, ULPWUIE ;Enable interrupt
MOVLW B'11000000' ;Enable peripheral
MOVWF INTCON ;interrupt
BANKSEL OPTION_REG
BCF STATUS,NOT_PD
BSF STATUS,NOT_TO
CLRWDT
BANKSEL PORTA
SLEEP ;Wait for IOC
CLRF INTCON
NOP
;****************************************
MainLoop CLRWDT
BANKSEL PORTA
CALL GONDER
MOVLW .5
MOVWF TEMP4
BBBB ; CALL BEKLE1S
; DECFSZ TEMP4,F
; GOTO BBBB
goto UYUMAYAGIT
goto MainLoop
;********************************************************
END
Daha önceleri assambler dilini kullanıyordum,uyguladıgım yazılım bu.Belki bir fikir verir.