Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
MCLRE: RA3/MCLR pin function select(5)
1 = RA3/MCLR pin function is MCLR
bit 13-12 BG1:BG0: Bandgap Calibration bits for BOD and POR voltage(1)
00 = Lowest bandgap voltage
11 = Highest bandgap voltage
;include "P16F676.inc" ;include the defaults for the chip
__config 0x3114 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
CLRF OPTION_REG
BSF STATUS,RP0
CLRF VRCON
MOVLW 0x3f
MOVWF TRISA ; porta as input
MOVLW 0x0
CLRF ANSEL ; disable ADC
MOVWF TRISC ; portb as output
BCF STATUS,RP0
MOVLW 0x7
MOVWF CMCON
START
btfss PORTA,1 ; test bit 1
call delay
GOTO START
delay
movlw 0xff
movwf PORTC
movlw 0fh
movwf 0x21
dECfsz 0x21,f
clrf PORTC
RETURN
end
ORG 0
GOTO INIT
please explain more this part of code...
CLRF OPTION_REG??
CLRF VRCON??
bit 3 CIS: Comparator Input Switch bit
When CM2:CM0 = 110 or 101:
1 = VIN- connects to CIN+
0 = VIN- connects to CIN
;include "P16F676.inc" ;include the defaults for the chip
__config 0x3114 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
CLRF OPTION_REG
BSF STATUS,RP0
CLRF VRCON
MOVLW 0x3f
MOVWF TRISA ; porta as input
MOVLW 0x0
CLRF ANSEL ; disable ADC
MOVWF TRISC ; portb as output
BCF STATUS,RP0
MOVLW 0x7
MOVWF CMCON
START
btfss PORTA,1 ; test bit 1
call delay
GOTO START
delay
movlw 0xff
movwf PORTC
movlw 0fh
movwf 0x21
again: dECfsz 0x21,f
call again
clrf PORTC
RETURN
end
;include "P16F676.inc" ;include the defaults for the chip
__config 0x3114 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
CLRF OPTION_REG
BSF STATUS,RP0
CLRF VRCON
MOVLW 0x3f
MOVWF TRISA ; porta as input
MOVLW 0x0
CLRF ANSEL ; disable ADC
MOVWF TRISC ; portb as output
BCF STATUS,RP0
MOVLW 0x7
MOVWF CMCON
START
btfss PORTA,1 ; test bit 1
call delay
GOTO START
delay
movlw 0xff
movwf PORTC
movlw 0fh
movwf 0x21
dECfsz 0x21,f
clrf PORTC
RETURN
end
The decfsz is NOT being used a Conditional Instruction!!
Hi again,
Then i think there is no use of it!!