Hello,
I work on a application and need two hardware PWM outputs. One PWM (CCP1) to
control a DC motordriver LMD18200 (10 Khz) and one PWM (CCP2) for IR comm (38KHz)
The motor is still running, but runs on 1 KHZ. (I need 10KHz or maybe the same 38KHz as the IR Comm.)
Questions:
- Runs CCP1 and CCP2 with the same Timer2 Prescale settings ?
- So, can I set different frequences on the two PWM channels ?
Thanks for replays,
Regards, Gevo
The setting in my program:
' PIC16F887
DEFINE OSC 4 ' Inform PBP PIC Speed
OSCCON = %01100111 ' Internal Clock set to 4MHZ
INTCON.7 = 0 ' Disable interrupts.
CM1CON0 = 0 ' Comparators off
CM2CON0 = 0 ' Comparators off
' Motor PWM settings
TRISC.2 = 0 ' Set PORTC.2 (CCP1) to output
CCP1CON = %00001100 ' Set CCP1 to PWM, ACTIVE HIGH
T2CON = %00000101 ' Timer2 ON, Prescale 1:4
PR2 = 249 ' Set PWM Periode to 1 KHz
' IR COMM PWM settings
TRISC.1 = 0 ' Set PORTC.1 (CCP2) to output
CCP2CON = %00001100 ' Set CCP2 to PWM, active high
T2CON = %00000100 ' Timer2 ON, Prescale 1:1
CCPR1L = 13 ' Set PWM Duty-Cycle to 50%
PR2 = 25 ' Set PWM Periode to 38 KHz
---