Hi Walter,
I thought we had this working already. 
Here's one thing I see...
Code:
; Set up the main loop
sc_loop_start:
clrf i
banksel atans
lfsr FSR0, atans
banksel will put it in the proper bank for a variable in RAM.
But he's trying to use it with with a Label in FLASH.
I'm sure it was just a mistake on his part because the lfsr is correct.
And with his ASM code at the very beginning, it probably would have come up with bank 0 without him even knowing it.
However, now that it's in an include file for PBP, that atans table will be at a much higher address in Flash and you'll end up in a different bank than where the variables are.
Just comment it out.
I was only 1/3 of the way thru when I found that.
If it doesn't help, let me know, I'll keep looking for more.
P.S. You should specify BANK0 for all the variables used with this routine.
<br>
Bookmarks