prinsloo
Member level 5
- Joined
- Sep 19, 2004
- Messages
- 93
- Helped
- 2
- Reputation
- 4
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Bethlehem RSA
- Activity points
- 697
Dear Members
The code at the bottom is for a pushbutton to control a light.The problem that I have is that when the button is pushed it connects the micro to ground.This STOP the program.
When I leave it open then the program START (out of controll).
I want the program to activate when I push the button once and not run out of controll.
ORG 0
goto start__code
ORG 4
_interrupt
bcf INTCON, T0IF ;clear interrupt flag
retfie
start__code
_main__code
movlw D'192'
bsf STATUS, RP0
movwf _option_reg
label_0006
bsf STATUS, RP0
movf TRISB, W
iorlw D'16'
movwf TRISB
bcf STATUS, RP0
movf PORTB, W
andlw D'16'
sublw D'16'
movlw 1
btfss STATUS, Z
clrw
movwf _FCV_KEY
movf _FCV_KEY, W
btfsc STATUS, Z
goto label_0006
label_0008
goto label_0006
label_0007
_mainendloop
goto _mainendloop
_main__end
const_ptr_data
END
Thanks in advance
The code at the bottom is for a pushbutton to control a light.The problem that I have is that when the button is pushed it connects the micro to ground.This STOP the program.
When I leave it open then the program START (out of controll).
I want the program to activate when I push the button once and not run out of controll.
ORG 0
goto start__code
ORG 4
_interrupt
bcf INTCON, T0IF ;clear interrupt flag
retfie
start__code
_main__code
movlw D'192'
bsf STATUS, RP0
movwf _option_reg
label_0006
bsf STATUS, RP0
movf TRISB, W
iorlw D'16'
movwf TRISB
bcf STATUS, RP0
movf PORTB, W
andlw D'16'
sublw D'16'
movlw 1
btfss STATUS, Z
clrw
movwf _FCV_KEY
movf _FCV_KEY, W
btfsc STATUS, Z
goto label_0006
label_0008
goto label_0006
label_0007
_mainendloop
goto _mainendloop
_main__end
const_ptr_data
END
Thanks in advance