Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Program Address for 16F628A

Status
Not open for further replies.

johnnyquest

New Member
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
 
johnnyquest said:
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top