I am a little puzzled by the following sampLe in my code.
If I close switch one and set PORTC,0 and PORTC,1, why does PORTC,1 also go off if when i open the switch I only clear PORTC,0?
If I close switch one and set PORTC,0 and PORTC,1, why does PORTC,1 also go off if when i open the switch I only clear PORTC,0?
Rich (BB code):
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
cblock 0x20
CounterA ; Define two file registers for the
CounterB ; delay loop
CounterC
CounterD
ALARM
endc
org 0
INIT:
BSF STATUS,RP0
CLRF TRISC
MOVLW 0XFF
MOVWF TRISB
BCF STATUS,RP0
CHECKDHW:
BTFSC PORTB,7 ;IS SWITCH OPEN
GOTO PRIORITYOFF
GOTO PRIORITYONLY
PRIORITYOFF:
BCF PORTC,0
GOTO CHECKDHW
PRIORITYONLY:
BSF PORTC,0
BSF PORTC,1
GOTO CHECKDHW
END