PCLATH

Status
Not open for further replies.

heida11

New Member
I am working with a disassembly listing that uses the 16F877 and it is full of instructions modifing PCLATH.

I am converting it to run on a 16F628 and would like to know when an
operation to PCLATH is required??

I have read the datasheets and it just has to be simple way to determine
when to use one.

Would appreciate any explanation!!!!

Thanks

I use MPLAB and WINPINPRO.
 
heida11 said:
I am working with a disassembly listing that uses the 16F877 and it is full of instructions modifing PCLATH.

I am converting it to run on a 16F628 and would like to know when an
operation to PCLATH is required??

A PIC can address only 2K of program memory, so for the 16F877 you need paging instructions for jumps outside the current 2K page. The 16F628 only has 2K memory, so you don't have any paging problems.

So generally you don't need all the paging instructions with a 628.

The original program was most probably written using a high level language, these usually insert paging instructions even when they are not needed.
 
Thanks Nigel!

It makes sense now.

I will set up the code like I usually do for a 628 and it will be a lot simpler to debug and a lot smaller.

Yes, the hex file was generated from some sort of basic compiler.

I stick with ASM for the PICs though.

Happy Holdays!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…