en:pfw:switchledwithbutton
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:pfw:switchledwithbutton [2025-06-22 00:04] – [Forth implementation of toggleLED] mka | en:pfw:switchledwithbutton [2025-06-22 00:26] (current) – ↷ Links angepasst, weil Seiten im Wiki verschoben wurden mka | ||
---|---|---|---|
Line 171: | Line 171: | ||
==== Glossary ==== | ==== Glossary ==== | ||
- | clavis? and tasto? are different methods for querying the button. | + | '' |
- | Clavis? checks whether there has been a falling edge on the pin. The port pin remembers this in its interrupt flag bit, requiring no additional wiring on the MCU. | + | '' |
- | Tasto?, on the other hand, monitors the logic level on the port pin several times in succession. Only when all queries have returned an H level is it assumed that the bouncing is over, i.e., the button has been released. | + | '' |
With these two routines, the state of the LED can be toggled back and forth. | With these two routines, the state of the LED can be toggled back and forth. | ||
- | Only when the button has been safely released does clavis? fire on the next keypress. | + | Only when the button has been safely released does '' |
- | The " | + | The " |
==== Background information ==== | ==== Background information ==== | ||
- | See clavis? and tasto? for more background information. | + | See [[en: |
- | Here, clavis? has been configured to immediately clear its interrupt flag after the query. This isn't really necessary, since it can only be queried again after tasto? allows it and has cleared the flag. | + | Here, '' |
==== Possible Pitfalls ==== | ==== Possible Pitfalls ==== |
en/pfw/switchledwithbutton.1750543489.txt.gz · Last modified: 2025-06-22 00:04 by mka