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
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mazedm80



Joined: 18 Feb 2015
Posts: 12

View user's profile Send private message

PostPosted: Fri Feb 20, 2015 1:13 am     Reply with quote

thank u Ttelmah
i u got the problem...
i always use the int16 and it divide by 4 and if it is float the motor didn't run...
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Fri Feb 20, 2015 1:19 am     Reply with quote

Glad you got there.

You can always 'force' the function to use whichever version you actually want, by using a 'cast'. So:
Code:

float fred;

    fred=1000.0;

    set_pwm1_duty((int8)(fred/4));


Will force the 'int8 ' version of the function to be used, even though you are handing the function a 'float' (which will always default to using the int16 version - code always uses the _highest_ type from those available if a type doesn't actually fit the choices).

Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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