CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F452 PWM issue

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
john_doe01



Joined: 28 Nov 2011
Posts: 1

View user's profile Send private message

18F452 PWM issue
PostPosted: Mon Nov 28, 2011 6:26 am     Reply with quote

Hi
New to the forum.

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

View user's profile Send private message

PostPosted: Mon Nov 28, 2011 8:14 am     Reply with quote

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.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group