pic16 page boundary

Discussion in 'Programmer's Corner' started by seanamana, Mar 6, 2009.

  1. seanamana

    Thread Starter New Member

    Mar 6, 2009
    Hi guys,

    I'm writing a pretty lengthy keypad-LCD interface and I apparently just crossed the page boundary. What does this mean? I guess that means I need to write new functions for, say, writing to the LCD and reading from the keypad using bank 1 memory addresses, right? I've pretty much run out of the 0x70-0x7F registers for stuff like EEPROM access so I assume I need like bank-specific functions (writeLCD1, writeLCD2, etc). I'm just wondering what I need to keep in mind for the rest of my code.

    I hope this question made sense. Thanks for looking!
  2. Papabravo


    Feb 24, 2006
    Crossing a page boundary means that there are not enough address bits in an instruction to cover the available memory. The address bits must come from somewhere like the PSW which has register file bank select bits. For any instruction you get the register file bank selected by these bits. This can lead to unintended consequences because the corresponding registers in different banks perform different functions.
    Last edited: Mar 7, 2009
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    If your application uses interrupts, using more than one bank gets very complicated, frequent checks for which bank you are in when an interrupt occurs, save and restore more information in case of interrupt and on interrupt, and many other details that can be overlooked on first build/run, and not show up as a bug for a month.

    I'd suggest switching to a high level compiled language, such as C or Basic, if you are going to span more than one bank with a single function.