Pic16LF877a Help with Banks

John P

Joined Oct 14, 2008
2,026
As far as UserPIN0,1,2,3 are on the pic's internal epprom.
Please try to be more careful with typos. A letter or two wrong with processor terminology makes it impossible to be sure what you mean. If "epprom" means EEPROM, then you can't just read the data out as if it's a RAM address; you have to go through a little rigmarole with EEADR and EEDATA. It's even more complicated if it's the code ROM. If the UserPIN locations are actually in RAM, which addresses are they, in which banks?
 

Thread Starter

maxpower097

Joined Feb 20, 2009
816
Thats already done at boot. The issue is with all the banks not switching to 1 for some reason. The code used to work, and I've now been told the working code is in another state. I was hopeing to fix this code to make it work but it doesn't seem to be possible. I'm just gonna have to wait for the working code, before the previous programmer got a hold if it. Theres just too many things it could be. I've gone through every way to bank switch possible and it just won't do it. I have a strong feeling this code is from a debug realice and hooked up somehow in the middle of a debug or code malfunction. Sorry my spelling is bad I just don't type the carefully. I figure usually people know what I mean when its not code.
 

Thread Starter

maxpower097

Joined Feb 20, 2009
816
The 302 warning is nothing to worry about if you have changed to the right bank. See my earlier post for how to get rid of it, and t06afre has quoted the explanation.
The 305 warning means that you have left off a ",W" or ",F" and it has defaulted to ",F" I think.

The complier can't always know if the bank is correct so it just gives the warning for everything not in bank 0.
eg
btfsc STATUS, C
BCF STATUS, RP0
BSF STATUS, RP0
clrf TRISA

Also make sure that after context saving in the interrupt, you change to the correct bank, because it could be in the wrong one in any complex program. Restoring context will put it back in the right bank.
I tried that and it worked and removed the msg's but my issue is the msg's were not there before when I was working on the code, now when I build the code it build successfully, but the program crashes immediately upon init;ing the LCD. I just can't figure out what would cause the msg's to appear now and have the code that doesn't work. I remember using the BankSet commands with no issues. Like I said I'm just gonna hve to wait for the proper working code. Theres just too many things it could be.
 

Thread Starter

maxpower097

Joined Feb 20, 2009
816
Ok I got the story, some programmer was trying to hook it up to a wifi module and it never ended up working. I guess this was the code from that attempt.
 

Thread Starter

maxpower097

Joined Feb 20, 2009
816
BANK PROBLEM HAS BEEN FIXED!!!! What happened is the previous programmer/s were messing with the include file. I think took MC's include file, then compared it with the latest custom include file and switched all banking over to default include settings. Bingo Bango it compiled and worked. Still getting stupid 302 msgs but the codes running fine.
Thanks for everyones help even though I did it all myself. :) j/k You guys really did help me understand banking better then I did before.
 
Last edited:
Top