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 support@ccsinfo.com

general question about 4 channels pwm/

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







general question about 4 channels pwm/
PostPosted: Sat Nov 07, 2009 3:40 am     Reply with quote

Hi

Generally I know how to produce pwm in 1 channel .

I wanted to understand-if the datasheets says pic16f690 has 4 pwm ch,
it means that I can produce 4 different frequencies? I have only 2 timers!!

This is my code for 1 channel that works :
Code:

setup_oscillator(OSC_4mHZ);
SETUP_CCP1(CCP_PWM);
set_pwm1_duty(70); // set  pwm
SETUP_TIMER_2(T2_DIV_BY_16,213,1);

I just can't understand how to produce another channel??
I have to set timer 1 ? I have to set_pwm2_duty ???
Or I can set 2 different freq' with the same timer ?????????

How exactly this pwm's system is working anyway ?
How do I set another channel- from syntax aspect?

thanks a lot.
Ttelmah
Guest







PostPosted: Sat Nov 07, 2009 4:06 am     Reply with quote

Unfortunately, this is an area where the Microchip nomenclature can mislead.
The PIC16F690, has _one_ ECCP module, with up to four output pins (not channels). If you look at the actual data sheet for the module, you will find that it's single output, can be used to drive a single pin, in standard PWM mode, or a pair of pins as complementary outputs (figure 11-6).
You only have one PWM counter, so can't generate four PWM outputs.
You could generate low frequency PWM outputs using 'software PWM', and code for this has been posted here in the past. To genuinely have four distinct PWM frequencies, requires a chip actual PWM generators, and I can't at the moment think of a PIC16, which does. Chips with the 'power control' PWM module, have multiple generators for this, but those with either the three channel version of this, and another CCP, or more than four standard CCP modules, that I can think of, are all larger PIC18 devices...

Best Wishes
eric P
Guest







thanks a lot.
PostPosted: Sun Nov 08, 2009 5:50 am     Reply with quote

thanks a lot for your answer.
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