adastra wrote: > > I am writing a couple of thousand lines of code for 16c877 using the ICD. > Well into the project, I have encountered some very strange problems > involving data memory variables. I have defined a list of them starting at > 0x0020. At some places in my program, I cannot seem to write to them, even > though I THINK I have taken care with respect to the proper bank and page > definitions. For instance, in this case: > > calib nop > banksel msg_nbr > movlw .65 ;table address > movwf msg_nbr > movwf sp1 > > The literal in w WILL be written to msg_nbr, but NOT to sp1. > > FWIW, msg_nbr is assembled at 0x0024 and sp1 is at 0x003D (using > CBLOCK/ENDC.) Curiously, if I reverse the placement of the variable names, > the result reverses also. The easiest check is to look at the *.lst file to make sure of the HEX code produced. If it is correct and the bank select bit is right, then the ICD must(?) be at fault. 00D4 00A4 00342 movwf msg_nbr 00D5 00BD 00343 movwf spl Do you have both 'sp1' labels and 'spl' labels. They look the same, but they aren't. Is this actually doing what you think "banksel msg_nbr" Try using this... calib nop ; banksel msg_nbr clrf STATUS movlw .65 ;table address movwf msg_nbr movwf sp1 If it now works, the banksel is somehow at fault. (unlikely) If it still doesn't work, then good, msg_nbr or spl is defined wrong. I actually got caught with a similar problem yesterday. I accidently deleted a RAM definition, and while writing the upteenth code line I used the same name as a label for a GOTO. It assembles and works ok, but the results are weird. Prior to that I spent 5 frustrating hours trying to find a bug that turned out to be a BTFSC instruction that was supposed to be a BTFSS. After awhile you begin to think that that little PIC has somehow come to life and is out to get you. What you have to remember is the micro will do exactly what you tell it to, not what you want it to. Take a break for an hour and go for a brisk walk. You'd be amazed at the bugs that suddenly jump out at you on your return. I must remember to take that advice myself ;-) -- Best regards Tony ICmicro's http://www.picnpoke.com mailto:sales@picnpoke.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! use mailto:listserv@mitvma.mit.edu?body=SET%20PICList%20DIGEST