How to define the PWM duty cycle in this project?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I am reding the code of this project but can not find out why the #define HILIMIT 0x1600 means /*45% duty cycle*/ .   in the LiIonCharger_H sourcefile. What is the realtionship between the 0x1600 and the 45%.

   

 

   

Thanks.

0 Likes
8 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Seems like this is used for Dithered PWM, but the only period

   

I could find used was 48, so does not explain commented duty

   

cycle. Unless someone else can explain download ap note and you

   

will get an email indicating who is now the "owner" at Cypress of

   

the ap note, and reply to them asking the question.

   

 

   

Or file a CASE -

   

 

   

    

   

          

   

To create a technical case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi Dana

   

I will do 

   

Thanks

0 Likes
Anonymous
Not applicable

Hello Leo2

   

in your avatar a star is missing!

   

 

   

Günter

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

A star? What does a bass-loudspeaker has to do with a star? Or am I too short-sighted to recognise something else?

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Leo2, did tech support get back to you, if so what

   

was the answer ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi 

   

Yes.

   

The reply from technical support:

   

 

   

Q: I am reading the code of this project but can not find out why the #define HILIMIT 0x1600 means /*45% duty cycle*/ . in the LiIonCharger_H sourcefile. What is the relationship between the 0x1600 and the 45%.    

   

    

           

   

A: User defined Dithered PWM is been used here.     

   

     HILIMT = 0x1600    

   

   You can see in ChargerProtocol.c    

   

   ----->  DitheredPWM_1_SetPeriod(48); /* Generates 500KHz frequency */    

   

           DitheredPWM_1_SetDuty(PWMDuty);      

   

   And in DitheredPWM_1_DitheredPWM.c    

   

   ----->  DitheredPWM_1_PWMDuty = DitheredPWM_1_Duty>>8;    

   

           DitheredPWM_1_PWM_WriteCompare1(DitheredPWM_1_PWMDuty);    

   

    

           

   

   So what we got here is Period = 48    

   

   And Duty Cycle = 0x1600>>8 = 0x16 = 22    

   

    

           

   

   Thereby duty cycle in percentage = 22/48 ~= 45%    

   

     

   

   I hope this answers your query. Please let us know if you have any additional queries regarding this issue. We will be glad to assist you.    

   

    

           

   

Best Regards,    

   

 

   

Jobin  

   

 

   

Thanks for your and Jobin's help.

   

 

   

BTW, I have tried to update my photo in profile, but failed. Thanks for your mention.

   

 

   

Leo2

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Thanks for posting the tech support answer.

   

 

   

Regards, Dana.

0 Likes