I encountered a problem with programming the 16F289. My code went over the 2K boundary and stopped working. Looking through the listing I found several instances of "far" calls (to page 2 of code) that were not preceded with the proper "pagesel" (BSF PCLATH,3) statement. I manually inserted these pagesel statements and got it to work. Seems like a compiler problem. Not sure what else could cause this. . I highlighted the suspect calls in red.
Update: There are bigger issues with 16F chips with > 2K program memory. If you are using interrupts and they can happen while executing on another page, the interrupt handler needs to be at location 4, not just a GOTO statement to the handler. Otherwise, the goto will take you to a different page and not where the interrupt handler resides. I ended up finishing my program in assembly language.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see what you mean about PCLATH not being set before the goto Interrupt at location 4 and will fix this as soon as possible. Busy week coming up unfortunately!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I encountered a problem with programming the 16F289. My code went over the 2K boundary and stopped working. Looking through the listing I found several instances of "far" calls (to page 2 of code) that were not preceded with the proper "pagesel" (BSF PCLATH,3) statement. I manually inserted these pagesel statements and got it to work. Seems like a compiler problem. Not sure what else could cause this. . I highlighted the suspect calls in red.
: http://eflyer.no-ip.org/compiled.pdf
Update: There are bigger issues with 16F chips with > 2K program memory. If you are using interrupts and they can happen while executing on another page, the interrupt handler needs to be at location 4, not just a GOTO statement to the handler. Otherwise, the goto will take you to a different page and not where the interrupt handler resides. I ended up finishing my program in assembly language.
The missing pagesels were due to a bug when dealing with overloaded subroutines and functions, which should be fixed in <a>http://gcbasic.sourceforge.net/newfiles/update.zip</a>.
I see what you mean about PCLATH not being set before the goto Interrupt at location 4 and will fix this as soon as possible. Busy week coming up unfortunately!
The latest update should now fix this by moving the interrupt subroutine to location 4, not just using a goto. The download links are at .
: http://gcbasic.sourceforge.net/update.html