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

PWM problem

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



Joined: 07 Jan 2006
Posts: 64
Location: Braga

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

PWM problem
PostPosted: Wed Nov 15, 2006 9:34 am     Reply with quote

if i use this , works fine :

int_count=INTS_PER_SECOND;
set_timer0(0);
setup_ccp1(CCP_PWM);
setup_counters( RTCC_INTERNAL, RTCC_DIV_256 | RTCC_8_BIT);
setup_adc_ports(AN0_AN1_AN3);
setup_adc(ADC_CLOCK_INTERNAL);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);


setup_timer_2(T2_DIV_BY_1,54,1);

set_pwm1_duty(110L);

if i use this , nothing happens on CCP1

set_pwm1_duty(110);

what is the mean of this "L" , i need to put a variable to replace fixed duty
and don't know what to do with this "L"

ex : set_pwm1_duty(duty); // this don't work
Ttelmah
Guest







PostPosted: Wed Nov 15, 2006 10:23 am     Reply with quote

'duty, needs to be declared as a _long_.
This is the 'meaning' of the 'L' It forces the constant declaration to be treated as a 'long' type.

long int duty;

duty = 110;

set_pwm1_duty(duty);

Will work.

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