Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

PWM resolution


  • Please log in to reply
4 replies to this topic

#1 DrJaymz

DrJaymz

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 17 October 2012 - 08:53 PM

Does anyone know what the PWM resolution is when using 4.2? (Latest)? I am using PWM at 10Khz and the minimum duty ratio I can get is 0.01. Which suggests that the PWM resolution is 100. The ARM has a resolution of 16bit which is a good deal higher than the 7 bits I seem to be getting. This means when controlling LED brightness it goes from off to about 20% perceived brightness in one jump which is a bit rubbish really. I'm using Microsoft.Spot.Hardware.PWM, am I doing something stupid? Would I get a better result by setting the period and the duration of the pulse? I would have though this had already been posted but I couldn't find anything.

#2 DrJaymz

DrJaymz

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 18 October 2012 - 09:03 PM

Does anyone know what the PWM resolution is when using 4.2? (Latest)?

I am using PWM at 10Khz and the minimum duty ratio I can get is 0.01. Which suggests that the PWM resolution is 100.

The ARM has a resolution of 16bit which is a good deal higher than the 7 bits I seem to be getting. This means when controlling LED brightness it goes from off to about 20% perceived brightness in one jump which is a bit rubbish really.

I'm using Microsoft.Spot.Hardware.PWM, am I doing something stupid? Would I get a better result by setting the period and the duration of the pulse?

I would have though this had already been posted but I couldn't find anything.



Really no-one know?

#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 October 2012 - 09:18 PM

Hi DrJaymz, Netduino Plus uses 16-bit PWM based on a 1MHz clock. If you're running at 10KHz, that gives you a period of 100 (i.e. 1000000/10000 = 100). Which means that your duration/dutycycle is roughly 7-bit. If you use a slower frequency, you will get a larger set of available durations and your dutycycle resolution will be much finer. Chris

#4 DrJaymz

DrJaymz

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 22 October 2012 - 07:37 PM

Aha, that makes sense. Will try lower freq.

#5 DrJaymz

DrJaymz

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 24 October 2012 - 09:06 PM

this works well now. My code was fine.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.