Now we know that what you want to do is possible, thanks to Richard. Can anyone work out what is wrong with Talat's code?Code:'************************************************* *************** '* Name : * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 09.08.2014 * '* Version : 1.0 * '* Notes : 16F1827 * '* : * '************************************************* *************** ' DEVİCE 16F1827 ASM __config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF __config _CONFIG2, _PLLEN_ON & _LVP_OFF & _LVP_OFF & _STVREN_OFF; & _VCAPEN_OFF ENDASM CLEAR DEFINE OSC 32 OSCCON=%01110000 '32 DEFINE INTHAND PWM_INT PWM_VAL VAR WORD BANK0 SYSTEM VALUE VAR WORD INIT: APFCON0 = 0 'SET PORTB.3 TO CCP1 T1CON = %00100000 'Prescaler 1:4 PIE1.0 = 1 'TMR1IE TMR1 Interrupt Enable PIR1.0 = 0 'TMR1IF TMR1 Interrupt Flag INTCON.7 = 1 'GIE Global Interrupt Enable INTCON.6 = 1 'PEIE Peripheral Interrupt Enable CCP1CON = 9 'compare mode OUTPUT PORTB.3 'CCP PIN T1CON.0 = 1 'TMR1ON SET TMR1 PAUSE 1000 VALUE=1000 MLOOP: VALUE=VALUE+1 PWM_VAL = VALUE Goto MLOOP Asm PWM_INT movlw 9 ; compare mode clrf CCP1CON ; clear reg movwf CCP1CON ; Set reg movf PWM_VAL+1,W ; hb movwf CCPR1H ; put movf PWM_VAL,W ; lb movwf CCPR1L ; put bsf INTCON,7 ;GIE = 1 bsf INTCON,6 ;PEIE = 1 Enable peripheral interrupts bsf PIE1,0 ; TMR1IE= 1 Enable TMR1 bcf PIR1,0 ; TMR1IF = 0 Clear Timer1 Int Flag RETFIE ; Return from Interrupt EndAsm END
Bookmarks