At 05:11 PM 5/28/03 +0100, Andy Pryer wrote: >Steve, > >Code looks fine to me, except one point - Why do you have an XOR on the >registers ? e.g. on TRISIO ? Just looking at some of my code and >MicroChip code which initialises these registers, neither of which use >an XOR. I thought this was the function of changing to Bank1 using the >STATUS,RP0 flag ? The reason the original poster is XORing the MSB is to suppress the warning message that will otherwise be emitted by the assembler. The assembler does not keep track of the bank select or ram page bits. So anytime it sees a RAM or ROM address that goes past a boundary, it outputs a warning message to prompt you to make sure have taken care of it. The problem with that is that there can be MANY such messages - how do you tell which messages can be ignored? The solution is to manually flip or mask the bit that causes the problem. The advantage of using an XOR is that if by mistake, you put in the name of a register that is in RAM page 0, you are warned to check it. I do this using macros, rather than manually typing in the 'XOR 0x80' for every register that needs it. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 19 years of Engineering Innovation (1984 - 2003) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics