Exact match. Not showing close matches.
PICList
Thread
'[PIC] Clever 3-cycle delay?'
2003\03\30@132850
by
shoppa_piclist
OK, I'm doing some very timing-sensitive waveform generation with
a PIC, and I also want to conserve memory usage.
For long delays I just call a subroutine which does the delay. One
word and I'm done.
For one and two cycle delays I use a NOP and a GOTO $+1, respectively.
Again, each is one word.
But for three cycle delays I don't have any tricks up my sleeve. I
can do a NOP followed by a GOTO $+1, but that's two words. Any
tricks out there? The 16F628 is what I'm using, but I'd be willing
to hear tricks for other PIC lines.
Tim.
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2003\03\30@165553
by
Scott Dattalo
|
On Sun, 30 Mar 2003 spam_OUTshoppa_piclistTakeThisOuT
TRAILING-EDGE.COM wrote:
> OK, I'm doing some very timing-sensitive waveform generation with
> a PIC, and I also want to conserve memory usage.
>
> For long delays I just call a subroutine which does the delay. One
> word and I'm done.
>
> For one and two cycle delays I use a NOP and a GOTO $+1, respectively.
> Again, each is one word.
>
> But for three cycle delays I don't have any tricks up my sleeve. I
> can do a NOP followed by a GOTO $+1, but that's two words. Any
> tricks out there? The 16F628 is what I'm using, but I'd be willing
> to hear tricks for other PIC lines.
It's not possible in just one instruction. On the 18F devices you could do
this:
here: GOTO $+2
That's a 3 cycle delay, but it's still two words. You might as well do
this:
BRA $+2
NOP
Note that a $+2 in the 18F family is analogous to a $+1 in the 16X
family. In the first example, the goto will branch to the second half of
the goto instruction which is executed as a NOP.
You can do a single word 4-cycle delay:
CALL some_spare_return
There's bound to be a RETURN somewhere in your program that can be
labeled.
Scott
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2003\03\30@175923
by
Marcelo Puhl
On 30 Mar 2003 at 13:55, Scott Dattalo wrote:
>
> You can do a single word 4-cycle delay:
>
> CALL some_spare_return
>
> There's bound to be a RETURN somewhere in your program that can be
> labeled.
>
This can be a 3-cycle delay when following some movlw instruction, which
can be changed to a retlw.
Mark
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2003\03\30@192900
by
Scott Dattalo
On Sun, 30 Mar 2003, Marcelo Puhl wrote:
> On 30 Mar 2003 at 13:55, Scott Dattalo wrote:
>
> >
> > You can do a single word 4-cycle delay:
> >
> > CALL some_spare_return
> >
> > There's bound to be a RETURN somewhere in your program that can be
> > labeled.
> >
>
> This can be a 3-cycle delay when following some movlw instruction, which
> can be changed to a retlw.
Are you saying that instead of:
MOVLW K
GOTO $+1
NOP
That you write:
CALL retlw_K
...
RETLW K
?
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2003\03\30@211524
by
Marcelo Puhl
On 30 Mar 2003 at 16:27, Scott Dattalo wrote:
> Are you saying that instead of:
>
> MOVLW K
> GOTO $+1
> NOP
>
> That you write:
>
> CALL retlw_K
>
> ...
>
> RETLW K
>
Yes, and you even gain one instruction.
Mark
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
More... (looser matching)
- Last day of these posts
- In 2003
, 2004 only
- Today
- New search...