Seth Guest
|
Problem with PWM on pic18f1320 |
Posted: Mon Jun 19, 2006 6:17 pm |
|
|
I want to have pwm on one channel on this device (RB3/CCP1). I got that working but the enhanced CCP seems to be forcing all the other parallel ccp ports (P1B, P1C, P1D) active low and I can't use them. I need these I/O's to do regular I/O while the CCP1 channel is running pwm. It looks like CCP1CON is getting set correctly (to 0x0C), but that doesn't seem to allow me to use the I/O's. What am I doing wrong?
Code snippet:
set_tris_b(0x00); // all output on port b
//.........
setup_timer_2(T2_DIV_BY_4, 255, 1);
CCP1CON = 0x00;
CCP_1_LOW = 0x00;
//.........
// turn on PWM
CCP1CON = 0x0C;
CCP_1_LOW = 0x20;
// continue......
Any help/suggestions? |
|