emperror123
- Nov 7, 2011
- 1
- Joined
- Nov 7, 2011
- Messages
- 1
Code:
list p=16F84A
#include p16f84a.inc
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _RC_OSC
W_ISR_TEMP equ 12
STATUS_ISR_TEMP equ 13
d1 equ 21
d2 equ 22
org 00
goto start
org 04
movwf W_ISR_TEMP
swapf STATUS,W
clrf STATUS
movwf STATUS_ISR_TEMP
bcf INTCON,T0IF
btfss PORTA,1
goto ledon
bcf PORTA,1
goto isrend
ledon bsf PORTA,1
isrend swapf STATUS_ISR_TEMP,W
movwf STATUS
swapf W_ISR_TEMP,F
swapf W_ISR_TEMP,W
retfie
timer bcf PORTA, 1
call delay
bsf PORTA, 1
call delay
goto timer
start bsf STATUS, RP0
movlw b'00001000'
movwf TRISB
clrf TRISA
movlw B'00000110' ; set up timer0 , bits 0-2 prescaler 1:128, bit3 prescaler to Timer 0, bit5 using main internal clock 800khz/4 = 200khz !
movwf OPTION_REG
bcf STATUS, RP0
bsf INTCON,T0IE ; enable interrupts
BSF INTCON,GIE
loop bsf PORTB,4
call delay1
bcf PORTB, 4
CALL delay1
goto loop
delay movlw 0x0F
movwf d1
movlw 0x28
movwf d2
Delay0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay0
;2 cycles
goto $+1
return
delay1 movlw 0x3F
movwf d1
movlw 0x9D
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay0
;2 cycles
goto $+1
return
end
i just want RB7 to on when RB0 is pressed, and it is also ask us to use INTCON, INTE, and also INTEDG from OPTION_REG
as i modified
Code:
list p=16F84A
#include p16f84a.inc
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _RC_OSC
W_ISR_TEMP equ 12
STATUS_ISR_TEMP equ 13
d1 equ 21
d2 equ 22
org 00
goto start
org 04
movwf W_ISR_TEMP
swapf STATUS,W
clrf STATUS
movwf STATUS_ISR_TEMP
bcf INTCON,T0IF
btfss PORTA,1
goto ledon
bcf PORTA,1
goto isrend
ledon bsf PORTA,1
isrend swapf STATUS_ISR_TEMP,W
movwf STATUS
swapf W_ISR_TEMP,F
swapf W_ISR_TEMP,W
retfie
timer bcf PORTA, 1
call delay
bsf PORTA, 1
call delay
goto timer
start bsf STATUS, RP0
movlw b'00001000'
movwf TRISB
clrf TRISA
movlw B'00000110' ; set up timer0 , bits 0-2 prescaler 1:128, bit3 prescaler to Timer 0, bit5 using main internal clock 800khz/4 = 200khz !
movwf OPTION_REG
bcf STATUS, RP0
bsf INTCON,T0IE ; enable interrupts
BSF INTCON,GIE
loop btfsc PORTB, 0
call delay2
bcf PORT,7
btfsc PORTB,3
call delay1
bcf PORTB, 4
CALL delay1
goto loop
delay movlw 0x0F
movwf d1
movlw 0x28
movwf d2
Delay0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay0
;2 cycles
goto $+1
return
delay1 bsf PORTA, 4
movlw 0x3F
movwf d1
movlw 0x9D
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay0
;2 cycles
goto $+1
return
delay1 bsf PORTA, 7
movlw 0x3F
movwf d1
movlw 0x9D
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay0
;2 cycles
goto $+1
return
end
in the end nothing changes on it but since i modified it, the RA1 blinking very fast than what i have been set, what shud i do in order to make RB7 on?
Last edited: