Searching \ for '[PIC]: Adding zero to PCL?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Adding zero to PCL?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Adding zero to PCL?'
2002\08\07@130910 by adam

flavicon
face
Quick question...

movlw 0x00
addwf PCL

Does that code put you into an infinite loop or does PCL still increment
instead of just staying where it is?  (Note: in my code it's not as
overt as above, so the assembler can't detect and correct it.  My
problem is that I'm doing some branching but in one case I want to
branch to the instruction right after the 'addwf', but instead of doing:

movlw 0x01
movwf jump_register

I would rather just do:

clrf jump_register

(I'm in a really time-sensitive application.))

Thoughts?

Thanks,
Adam Smith

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\08\07@133208 by Byron A Jeff

face picon face
On Wed, Aug 07, 2002 at 11:57:52AM -0500, Adam Smith wrote:
> Quick question...
>
> movlw 0x00
> addwf PCL
>
> Does that code put you into an infinite loop

Nope.

> or does PCL still increment  instead of just staying where it is?

Yup.

{Quote hidden}

Do the clrf. It'll work fine.

BAJ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\08\07@134910 by Scott Dattalo

face
flavicon
face
On Wed, 7 Aug 2002, Adam Smith wrote:

> Quick question...
>
> movlw 0x00
> addwf PCL

This will send control to the instruction following the addwf.
Now,

  movlw 0xff
  addwf pcl,f

could cause an infinite loop unless the address mod 0x100 of the addwf
is 0xff.

If you want to see an example of PCL being thoroughly abused, check out:
http://www.dattalo.com/technical/software/pic/pwm256.txt

Scott

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\08\07@142532 by Herbert Graf

flavicon
face
> Quick question...
>
> movlw 0x00
> addwf PCL
>
> Does that code put you into an infinite loop or does PCL still increment
> instead of just staying where it is?  (Note: in my code it's not as
> overt as above, so the assembler can't detect and correct it.  My
> problem is that I'm doing some branching but in one case I want to
> branch to the instruction right after the 'addwf', but instead of doing:

       IIRC PCL alwys contains the lower part of the NEXT address to be fetched,
unless PCL were otherwise modified, therefore your code above would result
in the next instruction in memory being executed. This is actually pretty
useful when doing table reads. Thanks, TTYL

--
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 2002 , 2003 only
- Today
- New search...