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

Setting up pin RB3 as PWM output

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



Joined: 09 Feb 2007
Posts: 56

View user's profile Send private message

Setting up pin RB3 as PWM output
PostPosted: Sun Feb 18, 2007 3:49 am     Reply with quote

Hello,

I have a pretty basic question regarding PWM. I want to set up RB3 as a sole PWM output but I am not sure how it can be done. Can anyone suggest what the setup_power_pwm_pins statement should be? Note that I need pin RC1 to be set as an ordinary logic output.

Thanks!
Ttelmah
Guest







PostPosted: Sun Feb 18, 2007 5:19 am     Reply with quote

As always with questions like this, _we need to know what chip you are using_. The available options change from PIC to PIC, and though your reference to 'power_PWM', reduces the number of possible chips somewhat, without this extra data, it is not possible to be sure.
Assuming this is something like a xx31 chip, then the option 'PWM_ODD_ON', enables the odd (PWM1,3,5 etc.) output channels only. You can also override any pin on these PWM units, even if enabled for PWM, using the override register (needs manual definition).

Best Wishes
nazoa



Joined: 09 Feb 2007
Posts: 56

View user's profile Send private message

PWM
PostPosted: Sun Feb 18, 2007 6:55 am     Reply with quote

Thanks for the reply Ttelmah.

Yeah, the chip I am using is the 18F4550. I am unsure how a pin is associated to one of the four PWM channels. So, I am looking for how I need to write the arguments for setup_power_pwm_pins statement to get RB3 going as the sole PWM output.

Thanks!
Ttelmah
Guest







PostPosted: Sun Feb 18, 2007 11:02 am     Reply with quote

On the 4550, CCP2, is a normal PWM, not an enhanced PWM (only CCP1 supports the enhanced features). Just setup CCP2 for PWM, and only the one pin is used.

Best Wishes
nazoa



Joined: 09 Feb 2007
Posts: 56

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 3:58 pm     Reply with quote

The thing is that the data sheet tells me that RC1 is the default ouput for CCP2 and to select RB3 instead the 'CCP2MX' bit needs to be set to 0. Now, how do you do this with the CCS compiler?

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 19, 2007 2:00 am     Reply with quote

Quote:
Now, how do you do this with the CCS compiler?

It's done with the #fuses statement. Look near the start of the 18F4550.h
file. You'll see a list of fuse settings. The ones that control the CCPMX
feature start with "CCP".


Last edited by PCM programmer on Thu Feb 17, 2011 2:18 pm; edited 1 time in total
nazoa



Joined: 09 Feb 2007
Posts: 56

View user's profile Send private message

PWM
PostPosted: Mon Feb 19, 2007 4:31 am     Reply with quote

Thanks!

You're right, what I need is

#fuses CCP2B3
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