A pbp version
Code:
'****************************************************************
'*  Name    : PWM16.BAS                                      *
'*  Author  : RICHARD                    *
'*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 8/23/2014                                         *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
  
#CONFIG
             __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
              __config      _CONFIG2, _PLLEN_ON & _LVP_OFF
#ENDCONFIG


 
  include "dt_ints-14.bas"
  

asm
INT_LIST macro
      
     
     
     
      INT_HANDLER TMR1_INT, _Tm1, asm,yes
      endm
       INT_CREATE
       
     
       
ENDASM   

 
    DEFINE OSC 32 
    

     

    sSEROUT_PIN VAR PORTA.0
    sBAUD CON 84  '16416 = 19200 BAUD 

    yTEMP VAR Byte 
 
    wDUTY  VAR WORD       
    

    '***********************************************
START:
       ' disable analog functions
   OSCCON=$70
   ANSELA=0
   ANSELC=0

    '********************
    '16 BIT CCP1 PWM
    T1CON   = 0   ' Turn off Timer1 with a Prescaler value of 1:8
    PIE1    = %00000001    ' enable TMR1 overflow interrupt 
    INTCON  = %11000000    ' enable global and peripheral interrupts 
     ' LOW PORTC.2 ON MATCH TM1 WITH DUTY
    ccp4con=0
    wDUTY = 32768          ' 32768 = 50% DUTY PWM
    T1CON.0 = 1            ' TMR1 ON
    CCPR4H=$80;
    CCPR4L=0;
    PAUSE 800 
    SerOut2 sSEROUT_PIN,sBAUD,["START",13] 
     trisc = %11111001
    '***********************************************
      CCP4CON = %00001001  
MAIN:
    yTEMP = yTEMP +1 
    SerOut2 sSEROUT_PIN,sBAUD,["LOOP ",Dec yTEMP,13] 
    PAUSE 500
Goto MAIN


  '**** ASSEMBLY INTERRUPT ROUTINE ****  
Tm1: 
  Asm
    bsf PORTC  ,2
    CHK?RP   CCP4CON                  
    clrf      CCP4CON 
    movlw     9            
    movwf     CCP4CON            
      banksel 0 
    bcf      PORTC  ,2
    
  EndAsm
  '**** END ASSEMBLY INTURRUPT ROUTINE **** 
@ INT_RETURN 
End