Jump to content
ajbeavan

Calculating The Duty Cycle

Recommended Posts

Hello

I am using the ECCP module of a pic16f690 which is connected to a 555 timer generating a continuous train of pulses that

i can adjust the period of using a POT. I am able to easily get the pulse width and period, but struggling to calculate the

duty cycle.

Presumable I will need to use Float point maths to get the duty cycle or can anyone offer some suggestions.

 

adam

Share this post


Link to post
Share on other sites

Hi Adam,

 

You can use integer arithmetic by scaling the pulse width by say a factor of 100.

 

e.g. Period 125, pulse width 25. Gives 2500/125 = 20, shifting 2 dec places gives 0.2

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...