title: How do the bank switching in PIC assembler?
body: <p>I'm getting confused by bank switching in PIC assembler... This works for putting a 'Q' on the usart:</p>
  
  <pre><code>bsf PORTB,1         ;Set Transmit DIR (PORTB (0x6) not mirrored in other banks)
  movlw 'Q'           ;'Q' to work reg
  movwf TXREG         ;work reg to TXREG (TXREG (0x19) not mirrored in other banks)
  clrwdt              ;Clear watchdog
  btfss TXSTA,TRMT    ;Wait until 'Q' is shifted (TXSTA is 0x18, not mirrored)
  goto $-2
  bcf PORTB,1         ;Set Recive DIR
  </code></pre>
  
  <p>And this works just as good:</p>
  
  <pre><code>BCF 0x3, 0x5        ;Switch to bank 0
  BCF 0x3, 0x6
  bsf PORTB,1         ;Set Transmit DIR
  movlw 'Q'           ;'Q' to work reg
  movwf TXREG         ;work reg to TXREG 
  BSF 0x3, 0x5        ;Switch to bank 1
  clrwdt              ;Clear watchdog
  btfss TXSTA,TRMT    ;Wait until 'Q' is shifted
  goto $-2
  BCF 0x3, 0x5        ;Switch to bank 0
  bcf PORTB,1         ;Set Recive DIR
  </code></pre>
  
  <p>I have checked that the compiler does not do any bank switching when I'm not watching... When do HAVE to switch bank?</p>