Andrew Warren wrote: > > Mark Dennehy wrote: > > > I'm just starting out with the PIC chip so if this is a silly > > question, scratch it up to the learning curve :) > > It's not a silly question, Mark... It gets asked all the time. Thanks, Andy, for clarifying this one.... again. :-) On this same topic, there is are two reasons for defining SFR's and variables with values greater than 7 bits. 1. You can use variable names while debugging MPLAB in the Modify window or in the Execute Opcode dialog. 2. You can use the new MPASM directives described below. In the latest beta version of MPASM (v1.99.xx) there are new directives, one called BANKSEL. Originally designed for use with the Linker and relocatable code only, it also now works for non-relocatable output code from MPASM. This allows you to do the bank switching to access an SFR or RAM variable without actually having to toggle the specific bank bits (there's also BANKISEL for indirect addressing, and PAGESEL for ROM paging). When making relocatable code the addresses of RAM variable may not be known until the Linker is invoked, there needs to be a way to set up the proper RAM bank page. This is done like this: banksel myvar movwf myvar ... The Linker will generate the proper bit-banging bank instructions for the processor currently set with the MPASM P directive... So if you move your code from a processor that has two RAM banks to one that has four, or even if you move it from a 16C54 to a 16C84, the proper banking code will be generated. If you are not generating relocatable code (using the /o option with MPASM), then MPASM will expand the BANKSEL directive to the proper instructions. You may want to use ERRORLEVEL -302 to suppress those MPASM messages that are distracting, or as Andy also suggested, AND the operand to strip off the extra bits. Darrel Johansen