At 02:29 PM 2/23/00 +1100, you wrote: >John Orhan wrote: > >> I am trying to wrap my head around the paging system that the '505 >> uses. If I understand correctly, the memory is banked into four arrays >> of around 255 bytes each. > > > On 12-bit instruction chips, bit 7 is missing from CALL instructions >but not GOTOs, so you simply cannot call a subroutine in the second half >of a "page" (256 bytes - exactly). Lets clear this up. Bit 7 is not missing from a call instruction, bit-8 is. A page is 512 * 12-bit words. You can call any location in the first half of a 512 word page but a goto can go to any location in the page selected by the PA0 and PA1 bits in the status register. > > Otherwise, whatever bits are not contained in the GOTO or CALL >instruction are picked for the high Program Counter byte from the >register called PCLATH (or two of the status bits on the 12-bit cores). >If you want to GOTO or CALL a routine on a chip where there are less >bits stored in the GOTO or CALL instruction than the PC, you must set >set PCLATH to correspond to the high address bits of that page. (There is no PCLATH on the '505 but if you later use a 14-bit core PIC you will need to learn a new page select scheme as Paul is describing above.) > > Note that on many chips, the GOTO or CALL instruction contains all the >necessary bits. Up to 2K only. You need to use the PCLATH register for all calls and goto's above 2K. (PIC16C family, n/a for 17C and 18C Pics.) > > Note also that if you change the low Program Counter by using it as >the destination of an operation, the high PC will be loaded from PCLATH >in the process, so you must also set PCLATH correctly prior to doing >this. It initialises to zero, so you may *not* need to set it if you >want to branch to page zero and have never set it otherwise. In the case of the '505 the upper bits come from PA0 and PA1 in the STATUS register. -Jim >-- > Cheers, > Paul B. > Regards, Jim Robertson NEWFOUND ELECTRONICS ________________________________________ Email: newfound@pipeline.com.au http://www.new-elect.com MPLAB compatible PIC programmers. ________________________________________