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

any example to use PWM 1 and PWM 2 in PIC18F452 ?

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



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

any example to use PWM 1 and PWM 2 in PIC18F452 ?
PostPosted: Tue Jan 27, 2015 9:09 am     Reply with quote

Hello,

I want to use PWM1 and PWM2 in PIC18F452 to control RGB power LED
to get different colours...

... maybe PWM1 and 2 to control R and G and software PWM for

B ...

is there any quick example hot to configure those PWM:s ?

please tell me

best regards
-arto-
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Tue Jan 27, 2015 9:34 am     Reply with quote

in the CCS manual
have you read:

setup_CCPx ????

edited - Embarassed Embarassed


Last edited by asmboy on Tue Jan 27, 2015 10:53 am; edited 3 times in total
artohautala



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

PostPosted: Tue Jan 27, 2015 9:53 am     Reply with quote

asmboy wrote:
in the CCS manual
have you read:

setup_PWMx ????


no I have not... I do not know where to find it?

I've read:

setup_power_pwm() , setup_power_pwm_pins() ,

set_power_pwm_override(), set_power_pwmX() , set_power_pwmx_duty(),
set_power_pwm_duty()...
but I do not know in which order to use them ...
and how to get things going...

thank for your answer


Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Jan 27, 2015 10:12 am     Reply with quote

You don't.

Those are for the _power PWM module_ your chip only has a conventional module, so those do not apply.

Key is that on the standard PWM, the PWM, is a 'sub function' of the CCP module. Just look in the manual at 'setup_ccp', and then at the bottom ofthe page at 'set_pwmx_duty', and 'ccp1 overview'.

Then look in the examples at 'ex_pwm.c'

This is for a single PWM, but setup_ccp2, and set_pwm2_duty, do the same for the second PWM.
artohautala



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

PostPosted: Tue Jan 27, 2015 10:19 am     Reply with quote

Ttelmah wrote:
You don't.

Those are for the _power PWM module_ your chip only has a conventional module, so those do not apply.

Key is that on the standard PWM, the PWM, is a 'sub function' of the CCP module. Just look in the manual at 'setup_ccp', and then at the bottom ofthe page at 'set_pwmx_duty', and 'ccp1 overview'.

Then look in the examples at 'ex_pwm.c'

This is for a single PWM, but setup_ccp2, and set_pwm2_duty, do the same for the second PWM.


OK!
that was very good advice ... no I think I'm going forward !

thank you so much !

Smile Smile

all the best
-arto-
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