**Dies ist eine alte Version des Dokuments!**
Inhaltsverzeichnis
Switch LED on and off in a button
Hier wird eine LED sauber an- und wieder aus geschaltet.
Idea
Als Modell diente der Taster, der auch schon in der Demo von tasto und clavis benutzt worden ist. Im Taster ist eine LED integriert. Die soll getoggle werden.
bild
Implementation
It's assumed that a program periodically checks whether the switch has been pressed and then changes the state of the LED.
The challenge is to eliminate switch bounce so that the user gets a smooth, reliable impression of the changes. The response should be fast enough to be instantaneous, but slow enough to allow for a safe switchover.
Pseudo code for the toggleLED implementation
What Pseudo code is.
Function: init ( -- ) do all initialisation for the intended operation set variable ILED, set portpins ... Function: toggleLED ( -- ) \ toggle LED in a button on and off IF: edge detection tells button was pressed toggle LED turn off edge detection IF: bottom finally has been released turn on edge detection
Forth implementation of toggleLED
Background information
More about the DUMP utility can found at the Wikipedia page for hexdump
Some Forth DUMP implementations display a fixed amount of bytes and leave the updated address on the stack so that you can invoke DUMP repeatedly to display successive regions of memory.
Possible pitfalls with DUMP
Some systems have hardware memory protection that is triggered if you access memory outside the reserved area. The dump utility can do so by trying to show this forbidden memory. Triggered memory protect might stop the current process and terminate your session. If necessary a suitable test for the validity of used addresses might be reasonable on such systems so that dump can issue a normal error message (or display dummy data) in theses cases and leave the system / session otherwise intact.
Contributions
Alternative Implementations
You have another approach to DUMP?
Please add it at the end of this document.