Time delay circuit from momentary switch.

jpanhalt

Joined Jan 18, 2008
11,087
Hi thank you for all your hard work and ideas.

Ken
Does that mean you no longer need to adjust the delay? Your current delay ("pausit") simulated at about 174 ms. If you still need to increase it, what delay do you need? Is that the delay you need adjusted? There appear to be at least two other much shorter delays.

I have edited it to give a 2-second delay:
Code:
pausit   
    MOVLW    D'230'        ;1.00 sec wait set
    MOVWF    clkcnt
    CLRF        INTCON        ;Clear interupt flag
pause                    ;Initial 1/5th sec wait before setting up lcd
    BTFSS    INTCON,2        ;Has a timer time-out been detected?
    GOTO        pause        ;No
    BCF        INTCON,2        ;Yes
    DECFSZ    clkcnt,F        ;Dec loop, is it zero?
    GOTO        pause        ;No
    RETURN                ;Yes

John
 
Last edited:

Thread Starter

macke

Joined Oct 12, 2014
65
Does that mean you no longer need to adjust the delay? Your current delay ("pausit") simulated at about 174 ms. If you still need to increase it, what delay do you need? Is that the delay you need adjusted? There appear to be at least two other much shorter delays.

I have edited it to give a 2-second delay:
Code:
pausit  
    MOVLW    D'230'        ;1.00 sec wait set
    MOVWF    clkcnt
    CLRF        INTCON        ;Clear interupt flag
pause                    ;Initial 1/5th sec wait before setting up lcd
    BTFSS    INTCON,2        ;Has a timer time-out been detected?
    GOTO        pause        ;No
    BCF        INTCON,2        ;Yes
    DECFSZ    clkcnt,F        ;Dec loop, is it zero?
    GOTO        pause        ;No
    RETURN                ;Yes

John
Hi the 2 second pause will be required, but only on the + (up) or - (down) button press and before it increments or decrements the co-ordinate reading. There will be a slight pause on the save button, if only to give the operator time to read the words SAVED that is shown when it's pressed. Basically pause between saving and incrementing.
Ken
 

jpanhalt

Joined Jan 18, 2008
11,087
The subroutine "pausit" is about 200 ms. The modified version is 2 sec. You could change the name of the 2-second delay to pausit2. Then it is just a matter of going through the code, finding the calls for pausit and deciding which you want to be 2 seconds. "wait34" is a button read, so that may be one you want to change. The first 4 calls are setting up various registers and the LCD, so you probably don't want to change them. In the "setocx2" routine, there are two sets of 5 calls each to pausit (i.e., 1 sec total for each instance). You could just leave those and test changing only the "wait34" call to pausit2. If that does what you want, then you are set.

This may do that for you, but is untested:
Code:
pausit2
     MOVLW     D'230'
     GOTO        $+2
pausit
    MOVLW       D'30'        ;1.00 sec wait set
    MOVWF       clkcnt
    CLRF        INTCON        ;Clear interupt flag
pause                         ;Initial 1/5th sec wait before setting up lcd
    BTFSS       INTCON,2      ;Has a timer time-out been detected?
    GOTO        pause         ;No
    BCF         INTCON,2      ;Yes
    DECFSZ      clkcnt,F      ;Dec loop, is it zero?
    GOTO        pause         ;No
    RETURN                   ;Yes
Sorry for the sloppy formatting.

John
 

Thread Starter

macke

Joined Oct 12, 2014
65
The subroutine "pausit" is about 200 ms. The modified version is 2 sec. You could change the name of the 2-second delay to pausit2. Then it is just a matter of going through the code, finding the calls for pausit and deciding which you want to be 2 seconds. "wait34" is a button read, so that may be one you want to change. The first 4 calls are setting up various registers and the LCD, so you probably don't want to change them. In the "setocx2" routine, there are two sets of 5 calls each to pausit (i.e., 1 sec total for each instance). You could just leave those and test changing only the "wait34" call to pausit2. If that does what you want, then you are set.

This may do that for you, but is untested:
Code:
pausit2
     MOVLW     D'230'
     GOTO        $+2
pausit
    MOVLW       D'30'        ;1.00 sec wait set
    MOVWF       clkcnt
    CLRF        INTCON        ;Clear interupt flag
pause                         ;Initial 1/5th sec wait before setting up lcd
    BTFSS       INTCON,2      ;Has a timer time-out been detected?
    GOTO        pause         ;No
    BCF         INTCON,2      ;Yes
    DECFSZ      clkcnt,F      ;Dec loop, is it zero?
    GOTO        pause         ;No
    RETURN                   ;Yes
Sorry for the sloppy formatting.

John
Hi that's brilliant I will give it a go. I am desperately trying to find a book that will help me understand the flow used in ASM. I can then try programming for myself. I have only ever done basic and pascal.
Ken
 

AnalogKid

Joined Aug 1, 2013
11,041
Here's a variation on AK's circuit to give positive pulses
The inputs to U1D are completely floating.
My interpretation of the initial problem is that there are two separate output signals, one instant and one delayed, on two separate wires.

ak
 
Top