I'm in my last year of uni, doing a two wheeled balancing robot for my last year project.
Being made to use a PIC18f452.
at the moment I've just started coding and I'm having difficulty setting up the second channel for the PICs PWM output.
The first PWM channel works fine and I'm not sure what I'm missing for the second.
Any help will be appreciated and ill keep updating the projects status.
Basic code below:
Code:
PR2= 0xff; // Period
T2CON= 0x05; // Timer 2 on and Prescaler = 4
CCPR1L= 0x20; // Dutycycle
CCP1CON= 0x0C; // PWM mode on
CCPR2L= 0x20; // Dutycycle
CCP2CON= 0x0C; // PWM mode on
TRISC= 0x00; // port C output (bit 2)
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
Posted: Mon Nov 28, 2011 8:14 am
Are you using CCS C?. If so, then just use the setup_ccp2 function. If not, then ask on another forum. This forum is if CCS C.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum