kent_twt4 - 2011-05-12

+1 for having GCBasic handling the SFR's in non access ram.  Think this was brought up before, but my first time dealing with it.  GCBasic insists on appending ACCESS even when using assembler.  Below is code that worked in MPLAB 8.66.  Didn't try setting BSR, or maybe movff with W.

    movlw   12      ;std PWM mode
    banksel CCP3CON
    movwf   CCP3CON
    movlw   128     ;set CCP3 PWM timer as TMR6
    banksel CCPTMRS0
    iorwf   CCPTMRS0
    movlw   100     ;100 instr cycles * 16 prescale * 1/16000000 = 100 us or freq. of 10kHz
    banksel PR6
    movwf   PR6
    movlw   50      ;50% D.C. with PR4=100: 50 (instr cycles) * 16 (prescale) * 1/16000000 = 50 us
    banksel CCPR3L
    movwf   CCPR3L
    movlw   7       ;Prescale is 16, TMR6ON=1
    banksel T6CON
    movwf   T6CON