Author Topic: software pwm  (Read 4834 times)

0 Members and 1 Guest are viewing this topic.

Offline bakilTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
software pwm
« on: July 21, 2007, 05:10:10 AM »
can just somebody explain how i can calculate the period that a led needs to be off and on at lets say 3.69mhz (or use something else but mention it  :D)

my goal is to build a function that you give a % and then the led is burning at that %



//------------ old topic -------------\\
does anyone of you people at societyofrobots know how to make an software PWM for fading a LED

my microcontroller runs at 4khz (i think this is the most easy frequency)

-> i know its something like 1micro seconde on and 3 microseconds off etc
« Last Edit: July 21, 2007, 01:25:36 PM by bakil »

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
    • Roebotz
Re: software pwm
« Reply #1 on: July 21, 2007, 07:32:36 AM »
If you tell us what microcontroller you are using and what language you are programming it in, I am sure we can help you.

Offline bakilTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: software pwm
« Reply #2 on: July 21, 2007, 08:15:46 AM »
ow woops im srry

i use C

atmega16L programmed with the stk500 board

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
    • Roebotz
Re: software pwm
« Reply #3 on: July 21, 2007, 02:20:22 PM »
This was designed for PICs, but it may work for Atmegas as well... http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: software pwm
« Reply #4 on: July 22, 2007, 08:43:02 AM »
If you have your LED off for 3us and on for 1us, that means your LED will only be 1us/(1us+3us) = 25% bright.

 


Get Your Ad Here