Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Duty cycle resolution and printing to serial port #1

Closed
prabiei opened this issue Feb 24, 2022 · 1 comment
Closed

Duty cycle resolution and printing to serial port #1

prabiei opened this issue Feb 24, 2022 · 1 comment
Labels
invalid This doesn't seem right

Comments

@prabiei
Copy link

prabiei commented Feb 24, 2022

I am trying to use slow PWI with a float duty cycle. Ideally I like to set duty cycles to several digits. For example if PWM frequency is 1kHz, I like to be able to set PWM duty cycle resolution to 8nsec which is a duty cycle resolution of 0.000008. However with the current software it is only possible to change at a resolution of 0.01. Can you modify the software to achieve this. Also, when duty cycle is change the program prints to serial terminal. How can I turn the printing off?

@khoih-prog
Copy link
Owner

khoih-prog commented Feb 25, 2022

set PWM duty cycle resolution to 8nsec which is a duty cycle resolution of 0.000008

There is no way this library, or even hardware-based PWM, can achieve that kind of absurd resolution of 8nsec.
You have to know that SAMD hardware timer clock is around 48MHz, and this slow PWM library can provide the accuracy around uSec or mSec range.

Also, when duty cycle is change the program prints to serial terminal. How can I turn the printing off?

Changing in the example to have

#define _PWM_LOGLEVEL_      0

@khoih-prog khoih-prog added the invalid This doesn't seem right label Feb 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants