'simple timing question'
Jonathan M. Newport
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?
movlw .2 ;I don't understand this right here, how does
;that number work?
decfsz 0x00, f
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.
|On Thu, 1 Jan 1998 14:01:48 -0600 "Jonathan M. Newport"
<MAIL.ORION.ORG> writes: jnewport
> movlw .2 ;I don't understand this right here, how
> ;that number work?
> movwf 0x0c
> decfsz 0x00, f
> goto delay1
>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
>cycles, if I'm correct the timer module works in the background,
>or am I just confusing myself? well, any examples or explanation of
>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
- New search...