Exact match. Not showing close matches.
PICList
Thread
'[PIC]: Long Accurate Timing loops'
2003\11\16@121714
by
Oliver Broad
|
I've been away from PICs for some time now
I've recently offered to write a program that involves frequency counting
and so I got to thinking about timing loops. I searched PICLIST and it
seemed as if there were long time delays, accurate time delays, but no long
and accurate timing delays. I recall some discussion on this and a few
one-byte counters that were cycle accurate.
Would anyone like to comment on this code fragment for a two byte
cycle-accurate delay loop:
movlw high delay
movwf delayhi
movlw low delay
movwf delaylo
d1 incf delayhi,f
movlw D'5'
loop subwf delaylo,f
skpc
decfsz delayhi,f
goto loop ;5 cycle loop
comf delaylo,w
addwf PCL,f
nop
nop
nop
nop
d2
The delay between d1 and d2 is the value of "delay" plus nine cycles and I
have been unable to find any trick values that trip it up so far. The loop
finishes with a negative number in "delaylo" and COMF converts it to a
number between 0 and 4 used to add up to four "noops"
I guess that on a 14 bit pic delaylo could be stored in the W register?
Oliver
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuT
mitvma.mit.edu with SET PICList DIGEST in the body
2003\11\16@124031
by
Oliver Broad
I'd like to add to my previous post that I'm getting an odd sense of
deja-vu. I suspect I've just re-created something someone else devised
originally.
Anyone recall?
{Original Message removed}
2003\11\16@131605
by
2003\11\16@135232
by
Oliver Broad
I'll be using the timer to count pulses!
The loop is to set the "window", though actually I just got curious about
delay generation.
Oliver
{Original Message removed}
2003\11\17@035059
by
Ian McLean
Why not get the "Zero-Error One second timer" from Roman Black. Written in
MPASM and available at http://www.romanblack.com/one_sec.htm
This can modified for any time delay. Great bit of code.
BTW, whatever happened to Roman ?
Rgs
Ian.
> {Original Message removed}
2003\11\17@035647
by
Oliver Broad wrote:
>
> From: "Jan-Erik Soderholm XA (TN/PAC)"
>
> > Why not use one of the timers ?
> > Jan-Erik.
>
> I'll be using the timer to count pulses!
>
*The* timer ?
Most PIC has a couple of them, maybe use one timer
for the "window" and another for the counting...
Or is this a 16F84 design ? I think that one had
just one timer (?)...
Jan-Erik.
--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-request
KILLspammitvma.mit.edu
2003\11\17@164114
by
James Cameron
More... (looser matching)
- Last day of these posts
- In 2003
, 2004 only
- Today
- New search...