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. > Mpasm keeps giving me the 'incorrect bank' error message (#302). > Here's the code chunk - anyone know if this is my code or mpasm ? > > .... > > bcf STATUS,RP1 > bsf STATUS,RP0 > movlw baud(9600) > movwf SPBRG ;MPASM gives error #302 here ... > movlw TXSTA_INIT > movwf TXSTA ;... and here > movlw RCSTA_INIT > bcf STATUS,RP0 > movwf RCSTA > return Strictly speaking, the error's in your code... Although this section of your program will assemble correctly and work as you expect. Here's what's happening: SPBRG and TXSTA are, as you know, located on register-page 1; the PIC16C74A.INC file equates them to 0x99 and 0x98, respectively. The numbers 0x98 and 0x99 are 8 bits wide, but if you look at your PIC16C74 data shet, you'll see that the MOVWF instruction only has room for a SEVEN-bit register number. This, of course, is why you need to set the RP0 bit before accessing registers on page 1, and clear it before accessing registers on page 0; RP0 holds the eighth bit of the register number. Ok... When you write "MOVWF SPBRG" (or "MOVWF 0x99"), MPASM notices that you're trying to force an eight-bit register number into a space only large enough to hold seven bits, so it builds the instruction using only the low seven bits of the register number (0x19, in this case) and generates Warning #302 to inform you. Your code will assemble and work fine, since you really only WANT the "MOVWF" insruction to hold the low seven bits of the register number, but if you really want to do it RIGHT, you should change your "MOVWF SPBRG" and "MOVWF TXSTA" instructions to: MOVWF SPBRG^080H ; The "^080H" masks off the high bit ; of the register number. and: MOVWF TXSTA^080H ; The "^080H" masks off the high bit ; of the register number. Of course, you can also just turn off the warnings by putting an "ERRORLEVEL -302" line near the start of your program. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499 === For PICLIST help (including "unsubscribe" instructions), === put the single word "help" in the body of a message and === send it to: listserv@mitvma.mit.edu