Pic page size

Jul 05, 2006 2 Replies

Afternoon group...



I am going mad here...



I have a 16LF84A PIC here that appears to freak whenever it does a call to a location above 0x0ff.



Now I remember about pages etc, but I didn't thik the 84 had these limitations and you could jump about all over the place within the 1K program space. I hev googled all over the place and the datasheet for the device gives no indication this is not true.



to illustrate, I have a bit of code like this:



MSG_INIT addwf pcl,f DT "Initialising",0


and it all works nicely... however, if I put


ORG 0x100



above the label so this code is assembled starting at 100h, it crashes. I get no warning about this org from MPASM



Come on, what am I doing wrong? I must have missed something.



regards



H

Adding w to f operates on an eight bit field only so the pcl only can get up to eight bits, 0xff. You also have to set the pclath, upper 5 bits of the pcl to to its upper value in this case "1." This can automatically be done by including... movlw HIGH "Wherever you want to go", movwf pclath. This loads the high value of your destination to the pclath. Get use to including this anytime there is a Table read or computed goto where only eight bits are available to load the pcl. Bob

ah. yes... I found a tiny little foot-note in the pdf

Thanks for this Bob

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required