Just to add to the "idea pool" of minimal digit displays.
Usually i'm too lazy to wire a seven segment display to a protoboard design just to debug a value in a variable.
For that reason, i've made a small subroutine that blinks a led according to the value of a variable, For fast and ease of translation the variable is divided in its digits. Easy and fast to read.
Here is a code sample:
Code:
'["asynchronous serial protocol for human eye..."]
'[put your port configs and more here]
'---- Define Variables part
x var byte
Y var byte
n var byte
'---- Main program
main:
x = 123 'any value
gosub blinkled 'blink led according to X
goto main
'--- Subroutine part
blinkled: 'blink led on GPIO.1 according to X value
if x > 99 then '1st digit
y = x dig 2
gosub blinkloop 'blink the digit
gpio.1 = 1 'one final large blink to separate digits
pause 1000
gpio.1 = 0
pause 400
endif
if x > 9 then '2nd digit
y = x dig 1
gosub blinkloop 'blink the digit
gpio.1 = 1 'one final large blink to separate digits
pause 1000
gpio.1 = 0
pause 400
endif
y = x dig 0 '3rd digit
gosub blinkloop 'blink the digit
return
blinkloop: 'blink subroutine
for n = 1 to y
gpio.1 = 1
pause 100
gpio.1 = 0
pause 400
next n
return
Actually i've made a wrist clock out of it with just 2 leds as a display
Enjoy
Bookmarks