+ Reply to Thread
Results 1 to 2 of 2

Thread: Program Address for 16F628A

  1. #1
    johnnyquest Newbie
    Join Date
    Dec 2004
    Posts
    12

    Default Program Address for 16F628A

    I ran into a problem when writing a program for the 16F628A, my code worked fime untill I added new code to the program, then it stopped working. The problem was when I added code it pushed the Led Table down past 0xFF. I corrected that problem by moving the table up, then everything worked fine. Could anyone direct me to some literature or a site that might explain program address limitations or somthing to this extent. I added more code to my program and it is buggy again.
    Many Thanks, John


  2. #2
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,793

    Default Re: Program Address for 16F628A

    Quote Originally Posted by johnnyquest
    I ran into a problem when writing a program for the 16F628A, my code worked fime untill I added new code to the program, then it stopped working. The problem was when I added code it pushed the Led Table down past 0xFF. I corrected that problem by moving the table up, then everything worked fine. Could anyone direct me to some literature or a site that might explain program address limitations or somthing to this extent. I added more code to my program and it is buggy again.
    Many Thanks, John
    A table shouldn't cross a 256 byte boundary, it's easiest to keep tables in the first 256 bytes, and jump over them to the start of the program. If they are not in the first 256 bytes, you have to set paging bits before calling the table. If you search on these forums, code has been posted for tables without these limitations - at the expense of greater complexity.

    It's explained in numerous MicroChip documentation, but I couldn't point you to a specific place - but basically PCL is only an 8 bit counter, so the "ADDWF PCL" line can only access a maximum of 256 bytes, without changing the paging bits.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

+ Reply to Thread

Tags for this Thread