Searching \ for 'HELP ME in THIS Delay routine' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/timers.htm?key=delay
Search entire site for: 'HELP ME in THIS Delay routine'.

Truncated match.
PICList Thread
'HELP ME in THIS Delay routine'
2000\03\15@152213 by Muqtar Mohamed Usuf

flavicon
face
How for example to go about it in my MAIN before calling this
routine(bellow). 1/2 a second delay routine( I guest  1:64 scaler
must be set).
IF u can spare time. Try before making me go crazy please

                             Constants
                                       tmr0     equ    0x1
                               status equ 0x3
                               work     equ     0h


DELAY

        movlw  .255
        movwf  tmr0
deloop
        clrw
        xorwf  tmr0,work
        btfss status,Z
        goto deloop
        retlw 00

Tanks
Bad Boy from ell

2000\03\15@160416 by paulb

flavicon
face
Muqtar Mohamed Usuf wrote:

> How for example to go about it in my MAIN before calling this
> routine(bellow). 1/2 a second delay routine( I guest  1:64 scaler
> must be set).

 You should be using the .INC file to match your particular chip, not
define your own constants.  This allows others to follow your code
easily.

 You should also state which PIC chip you are using, and you MUST state
your clock speed.  14-bit core chips such as the 16F84 have a timer
overflow flag which simplifies the procedure greatly.

 At 4 MHZ crystal, with prescale by 256, the timer increments each
256µs and rolls over each 65536µs.  You need about 7¸ of these to time
a half second, so you might want to load the timer with a suitable value
and count eight rollovers.

 The code you post would delay about 65ms with a 256 prescale, 16ms
with a 64 prescale.  Is that what you found?

> deloop
>       clrw
>       xorwf  tmr0,work
That's a long way to do:
       movf    tmr0,W
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...