Searching \ for 'simple timing question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=simple+timing+question
Search entire site for: 'simple timing question'.

Truncated match.
PICList Thread
'simple timing question'
1998\01\01@150543 by Jonathan M. Newport

flavicon
face
OK, I understand how to do these nested loops, but I don't know how to use
the pic timer port.  Is this an example of the timer port being used or
another nested loop?

delay1:
       movlw   .2        ;I don't understand this right here, how does
                         ;that number work?
       movwf   0x0c
dalay2:
       nop
       nop
       decfsz  0x00, f
       goto    delay1
       return

wait, this is a nested loop isn't it because it is taking up processing
cycles, if I'm correct the timer module works in the background, right?
or am I just confusing myself?  well, any examples or explanation of the
timer module would be appreciated.

jonathan

1998\01\02@182237 by Mike Keitz

picon face
On Thu, 1 Jan 1998 14:01:48 -0600 "Jonathan M. Newport"
<spam_OUTjnewportTakeThisOuTspamMAIL.ORION.ORG> writes:

>delay1:
>        movlw   .2        ;I don't understand this right here, how
>does
>                          ;that number work?
>        movwf   0x0c
>dalay2:
>        nop
>        nop
>        decfsz  0x00, f
>        goto    delay1
>        return
>
>wait, this is a nested loop

It's just a single loop, since always returns to 'delay1', never to
'dalay2'.   Writing a value to location 0C does nothing specific to the
C84/F84 hardware; it's general-purpose RAM.  Without knowing which PIC
the program is for it's hard to say what they're trying to do.

Location 0 is the INDF register - it can affect any of the registers
based on the index value in the FSR register - register 4.  So if the FSR
register isn't set up before using this code, it could mess something up.

isn't it because it is taking up
>processing
>cycles, if I'm correct the timer module works in the background,
>right?
>or am I just confusing myself?  well, any examples or explanation of
>the
>timer module would be appreciated.

This looks like just a software timing loop (and one that is unusual at
best).  The hardware TMR0 register, usually at address 01, is never
accessed (uless FSR happens to point there).  If it were, it wouldn't
work properly anyway, since decrementing it all the time with software
would be counterproductive to hardware trying to increment it.

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