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 #2 "single-shot" mode doesn't produce expected pulses #709

Open
Art-ut-Kia opened this issue Dec 30, 2023 · 1 comment
Open

Timer #2 "single-shot" mode doesn't produce expected pulses #709

Art-ut-Kia opened this issue Dec 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Art-ut-Kia
Copy link

The bug
This repository: https://github.com/bigjosh/TimerShot/blob/master/TimerShot.ino contains an example of single-shot mode for timer 2 to generate an accurate duration commanded pulse on pin 3.
When running this code in wokwi, rather than the expected pulse, we get a zero-length pulse in the logic analyzer (same date for the rising and the falling edges). In contrast, this code works well on a real Arduino UNO.

To Reproduce
Connect a wokwi logic analyser on pin 3 of simulated Arduino UNO and run the code above.

Expected behavior
A series of various length pulses should be observed on pin 3 (PD3).

Environment

  • OS: Windows 11
  • Browser: Firefox
  • Version: 121.0 (64 bits)
@Art-ut-Kia Art-ut-Kia added the bug Something isn't working label Dec 30, 2023
@drf5n
Copy link

drf5n commented Dec 31, 2023

It's this line:

  OCR2A = 0;      // Set TOP to 0. This effectively keeps us from counting becuase the counter just keeps reseting back to 0.

Versus the top=0 problem in:

wokwi/avr8js#122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants