7 segment display and alphabet...
Is there a way to display letters on a 7 segment display via a DATA variable that is easier than ' Send_To_Display("letter", number_of_letter_in_alphabet) '? What I am trying to accomplish is to send a STRING to the single 7 segment display via a function and it split the string and display it letter by letter with a small delay between letters so it is readable. Any help is greatly appreciated!
*** EDIT : Nevermind, I figured it out
*** EDIT : Nevermind, I figured it out

Comments
A
b
C
c
d
E
F
H
I (same as one)
J
L
n
o
0 (same as zero)
P
r
S (same as five)
t
u
If you cannot build your string with this set then a different display is in order. If these letter work, you'll need to build an array of segment masks to create the letters -- so long as you have individual segment control over the LEDs.
numbers := 3 Display(numbers) ' I have to use it like this : numbers := 3 case numbers 1: to_display := string("1") 2: to_display := string("2") 3: to_display := string("3") Display(to_display) ' **** Display Function PUB Display(todisplay) | x, i, pattern, str_size, Index x := 0 BYTEMOVE(@DisplayStr, todisplay, strsize(todisplay)) str_size := strsize(@DisplayStr) leds.init(LED_DATA, LED_LATCH) repeat str_size Index := lookdown(DisplayStr[x]: " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0") if Index > 0 pattern := alpha[Index] dira[LED_Output_Enable]~~ outa[LED_Output_Enable] := 1 repeat i from 0 to 8 leds.out(pattern, true) pattern >>= 1 outa[LED_Output_Enable] := 0 x++ if x < str_size pause(500) bytefill(@DisplayStr, 0, 9) return DAT ' invalid letters : k, m, w, x, z alpha byte %1011_0001, %0000_0000, %1111_0101, %0111_1100, %1101_1000, %0011_1101, %1111_1000, %1111_0000, %1110_1101, %0111_0101, %0101_0000, %0001_1101, %1011_0001, %0101_1000, %1011_0001, %0011_0100, %0011_1100, %1111_0001, %1011_0001, %0011_0000, %1110_1100, %0111_1000, %0001_1100, %0101_1101, %1011_0001, %1011_0001, %0110_1001, %1011_0001, %0000_0101, %1011_1001, %1010_1101, %0110_0101, %1110_1100, %1111_1100, %1000_0101, %1111_1111, %1101_1101, %1101_1101 ' First index is a ? which will display if character not found.Right now, I am having difficulty sending menu data to the function.
PUB Program_Mode | ok_to_exit, selected_menu ok_to_exit := 0 selected_menu := 0 Display(string("setup ")) pause(1000) Display(string(" ")) repeat while ok_to_exit == 0 Display(lookup(selected_menu: _menuItems)) ' This is not working here. ok_to_exit := 1 return PUB Display(todisplay) | x, i, pattern, str_size, Index x := 0 BYTEMOVE(@DisplayStr, todisplay, strsize(todisplay)) str_size := strsize(@DisplayStr) leds.init(LED_DATA, LED_LATCH) repeat str_size Index := lookdown(DisplayStr[x]: " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0") if Index > 0 pattern := alpha[Index] dira[LED_Output_Enable]~~ outa[LED_Output_Enable] := 1 repeat i from 0 to 8 leds.out(pattern, true) pattern >>= 1 outa[LED_Output_Enable] := 0 x++ if x < str_size pause(500) bytefill(@DisplayStr, 0, 9) return DAT _menuItems word "menu 0", "menu 1", "menu 2", "menu 3"pub get_segments(c) '' Returns 7-segment pattern for character c if ((c => "0") and (c =< "9")) return DigitTable[c - "0"] else c := lookdown(c : " AbCcdEFHhIiJLlnoPrStUuY") if (c) return AlphaTable[c] else return 0I just noticed that you want to display "menu 0" -- this cannot be done on a 7-segment display as there is no way to do a "m". You might consider a 13-segment display if you really want to display words like this.
Now, could you help me figure out how to use my display function like this :
Or....
selected_menu := 1 Display(lookup(selected_menu: _menuItems)) ' this should output "?enu 1" the (?) is because there since no way to display an "m" and lookdown will return 0. I will just avoid using invalid characters. DAT _menuItems word "menu 0", "menu 1", etc....number_value := 3
Display(number_value)
I can't seem to figure out what I am missing besides all values sent to the Display function must be sent using string("stuff")
' this section is supposed to pull the menu text and run it through the "str" function. It is not working. I am actually not sure how to do this. selected_menu := 1 display_string := lookup(selected_menu: _menuItems) str(display_string) ' Using the "str" function like this works... str(string("test") PUB str(stringptr) '' Send zero terminated string that starts at the stringptr memory address repeat strsize(stringptr) Display(byte[stringptr++]) pause(500) DAT _menuItems word "select 0", "select 1", "select 2" '_menuItems byte "select 0", "select 1", "select 2" '_menuItems long "select 0", "select 1", "select 2"Jon,
There is at least 300 of us here that owe you a beer.
Not at the same time, of course.
Not to mention those that owe you from your various article over the years.
Thank You,
Jim
Back in the day a couple of us were trying to use a 7 segment LED calculator display as the output of a forth like controller. This language would use single character words.
Since 7 segments can display 127 characters, 255 if you include the decimal point.
Here is something we came up with.
We never went very far with this, but it was a cool thought experiment.
Duane J
I have gotten everything to work good so far until I ran into this issue....
variable1 := 2 variable2 := 750 str(string("test")) ' This works Display("t") ' this works Display(variable1 + "0") ' this works Display(variable2 + "0") ' this does not work :( str(variable2 + "0") ' this does not work :(If I need to post more code, please let me know. All the functions are the pretty much the same.