Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer period unable to set to microseconds #2792

Closed
ccspoz opened this issue Jan 15, 2017 · 3 comments
Closed

Timer period unable to set to microseconds #2792

ccspoz opened this issue Jan 15, 2017 · 3 comments

Comments

@ccspoz
Copy link

ccspoz commented Jan 15, 2017

Is there a reason why timer periods are measured in milliseconds while the timers on the pyboard are in microseconds? Is there a way to get sub-ms granularity with the timers? I am trying to implement AC phase control with a triac and the millisecond limitation is essentially limiting my output to only 10 discrete steps.

Apologies if the answer can be found here already, or if this is a newbie question- I have been searching all day to no avail.

@dhylands
Copy link
Contributor

dhylands commented Jan 15, 2017

This question is more appropriate for the forum.

What board are you using? The pyboard timers can go all the way to 1/42 MHz granularity (or 1/84 MHz depending on the timer).

Can you provide some code? Here's some code for the pyboard that uses microsecond granularity:
https://github.com/dhylands/upy-examples/blob/master/ic_test.py

@ccspoz
Copy link
Author

ccspoz commented Jan 16, 2017

Oh, my bad, will use the forum in the future, thanks.

I am trying to use the ESP12e board.

The code I am attempting to use is:

from machine import Timer
tim = Timer(-1)
tim.Init(period=2, mode=Timer.ONE_SHOT, callback=timer_callback)

And this virtual timer works but with only ms granularity. I realise the timing at these levels is not accurate but being able to set in us would provide for smooth fading.

Is it currently possible to implement hardware timers on the esp8266?

@pfalcon
Copy link
Contributor

pfalcon commented May 6, 2017

Thanks for switching to forum. Closing.

@pfalcon pfalcon closed this as completed May 6, 2017
tannewt pushed a commit to tannewt/circuitpython that referenced this issue Apr 27, 2020
When allocate_display_bus_or_raise was factored out, the assignment
of the bus's Python type was lost.  Restore it.

This would have affected displays of any type other than RGBMatrix, when
they were created dynamically.  Boards with displays configured in flash
were unaffected.

Closes: micropython#2792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants