This is what you've programmedThanks, i had a look at that code but can't see where it will help me, sorry. The problem is as follows:
I have been writing a program that will goto the Pass routine if the sequence of buttons 4-2-3-1 is pressed, any deviation from this and the program will goto the Fail routine.
The program works for the correct sequence, when i press 4-2-3-1 it goes to the Pass routine but there is a slight problem.
The program starts and waits for 4 to be pressed, if 2, 3 or 1 are pressed at this point it goes to the Fail routine like i want. The only problem is that the program then waits for button 2 to be pressed and it doesn't matter what other buttons are pressed at this stage the program will not deviate to the fail routine as I would like, it waits and waits for button 2 to be pressed and then waits and waits for button 3 etc.
BTFSC PORTA,SW4 ; Test if SW4 is pressed
GOTO SEQ_1 ; YES, now goto SEQ_1
GOTO MENU
SEQ_1 INCF PORTA,F ; Add 1 to PORT A
MOVLW D'10' ; Wait about 10mS
CALL NMSEC ; Call subroutine (NMSEC)
BTFSS PORTA,SW2 ; NOW YOUR LOOKING FOR SW2??? You should
wait for SW4 to be released!!
Remember, the SW4 button will still be pressed at this stage. There is no way
that a human can press and release a button in less than 10us
GOTO $-1 ; Still low
MOVLW D'10' ; Wait about 10mS
CALL NMSEC ; Call subroutine (NMSEC)
BTFSS PORTA,SW2 ; If set, still released
GOTO $-5 ; Still low start release wait all over
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | pic16f627 pwm variable duty cycle help please | Microcontrollers | 1 | |
A | PIC16F627 IR problem | Programming & Languages | 5 | |
B | pic16f627 | Microcontrollers | 2 | |
V | RC RC receiver input into PIC16f627 to turn LED on | Microcontrollers | 19 | |
I | Help - PIC16f627 | Microcontrollers | 2 |
by Jake Hertz
by Duane Benson
by Jake Hertz