Hello.. I' resolve the problem in hardware with the module CCP1 in mode comparation ( CCP1CON = 00001010 ), the TIMER1 with prescaler /8 and crystal extern of 40Khz between the pins RC0/T1OSO/T1CKI and RC1/T10SI/CCP2. The TIMER1 in loop free, increment each 200useg (without interrupt in overflow). 40000Hz / 8 = 5000Hz 1 / 5000Hz = 200useg resolution pwm = 200useg. as I' like pwm at 50Hz 1 / 50Hz = 20000useg with a scale of 100 step 100 * 200useg = 20000useg The code to generate the cycle active and inactive of pwm into of ISR: a - input ISR b - stop TIMER1 ( bcf T1CON,TMR1ON ) c - ( TMR1H-TMR1L + cycle active required ) --> CCPR1H-CCPR1L d - set or clear pin used to pwm e - enable comparator CCP1 f - enable TIMER1 ( bsf T1CON,TMR1ON ) g - restore FSR-STATUS-W h - exit ISR Pwm0 bsf RFlags,_Pwm ;The next is the active cycle bcf T1CON,TMR1ON ;Disable the TMR1 movf TMR1H,W ;Copy the part high of TMR1 movwf CCPR1H ;in the part high of CCP1 movf TMR1L,W ;TMR1L --> W to add addwf RInactiveCycle,W ;(TMR1L + RInactiveCycle) --> W skpnc ;? Carry ? incf CCPR1H,F ;Yes CCPR1H + 1 --> F movwf CCPR1L ;Load the part low of comparator movlw B'00001010' ;Configuration of CCP1 to movwf CCP1CON ;generate interrupt bsf STATUS,RP0 ;Bank 1 bsf PIE1,CCP1IE ;Enable the interrupt of comparator 1 bcf STATUS,RP0 ;Bank 0 bsf T1CON,TMR1ON ;Enable the TMR1 bcf HAB ;begin the inactive cycle goto RestoreRegisters ;Restore FSR-STATUS-W Pwm1 bsf RFlags,_Pwm ;The next is the inactive cycle bcf T1CON,TMR1ON ;Disable the TMR1 movf TMR1H,W ;Copy the part high of TMR1 movwf CCPR1H ;in the part high of CCP1 movf TMR1L,W ;TMR1L --> W to add addwf RActiveCycle,W ;(TMR1L + RActiveCycle) --> W skpnc ;? Carry ? incf CCPR1H,F ;Yes CCPR1H + 1 --> F movwf CCPR1L ;Load the part low of comparator movlw B'00001010' ;Configuration of CCP1 to movwf CCP1CON ;generate interrupt bsf STATUS,RP0 ;Bank 1 bsf PIE1,CCP1IE ;Enable the interrupt of comparator 1 bcf STATUS,RP0 ;Bank 0 bsf T1CON,TMR1ON ;Enable the TMR1 bsf HAB ;begin the active cycle goto RestoreRegisters ;Restore FSR-STATUS-W Regards... Nestor Ariel Marchesini Radioaficionado LU3JIL QAP simple 2mts VHF 144320 o repetidora radio club Chajari LU5JC 145405 -600 Chajari-Entre Rios-Argentina ICQ # 50983752 nick colo nestorm@biybyte.com.ar ----- Original Message ----- From: Jeffrey Siegel Sent: Thursday, May 11, 2000 6:00 PM Subject: PWM lowest frequency... | Am I missing something? If I'm running on a 4MHz PIC, the lowest frequency | PWM that I can generate would be: | | PWM period = (255 + 1) * 4 / 4,000,000 * 16 = 0.004096 | | ...giving a frequency of: 244.14 Hz | | What do I do if I need a lower frequency than this? | | Thanks!! |