Got to thinking again about the 7-segment table I constructed in my head, how do I check it without hardware. The answer was a just a few lines of code and here is the result. I spotted a couple of errors in my table right away plus a couple of improvements I could make too.
$7F $20 DO I .SEGS CR I .BYTE SPACE I EMIT PRINT" =$" I BL - 7segs + C@ .BYTE CR LOOP
20 =$00
|
|.
21 ! =$86
__|
22 " =$42
__
__
__
23 # =$49
__
|
__|
24 $ =$2D
__|
|
25 % =$52
__
__|
|__
26 & =$5B
|
27 ' =$02
__
|
|__
28 ( =$39
__
|
__|
29 ) =$0F
__
__
__ .
2A * =$C9
__|
|
2B + =$46
|
2C , =$04
__
2D - =$40
.
2E . =$80
__|
|
2F / =$52
__
| |
|__|
30 0 =$3F
|
|
31 1 =$06
__
__
|__
32 2 =$59
__
__|
__|
33 3 =$4F
|__|
|
34 4 =$66
__
|__
__|
35 5 =$6D
__
|__
|__|
36 6 =$7D
__
|
|
37 7 =$07
__
|__|
|__|
38 8 =$7F
__
|__|
__|
39 9 =$6F
__
__
3A : =$41
__
__
|
3B ; =$45
|__
|
3C < =$70
__
__
3D = =$48
__|
|
3E > =$46
__
__|
|__ .
3F ? =$DB
__
|__|
|__
40 @ =$7B
__
|__|
| |
41 A =$77
|__
|__|
42 B =$7C
__
|
|__
43 C =$39
__|
|__|
44 D =$5E
__
|__
|__
45 E =$79
__
|__
|
46 F =$71
__
|
|__|
47 G =$3D
|__|
| |
48 H =$76
|
|
49 I =$30
|
__|
4A J =$0E
|__|
|
4B K =$72
|
|__
4C L =$38
__
| |
4D M =$23
__
| |
4E N =$54
__
|__|
4F O =$5C
__
|__|
|
50 P =$73
__
|__
|__
51 Q =$79
__
|
52 R =$50
__
|__
__|
53 S =$6D
__|
|
54 T =$46
| |
|__|
55 U =$3E
|__|
56 V =$62
|__|
57 W =$1C
__|
|
58 X =$52
|__|
__|
59 Y =$6E
__
__
|__
5A Z =$59
__
|
|__
5B [ =$39
|__
|
5C \ =$64
__
|
__|
5D ] =$0F
__
5E ^ =$01
__
5F _ =$08
60 ` =$00
__
|__|
| |
61 a =$77
|__
|__|
62 b =$7C
__
|
|__
63 c =$39
__|
|__|
64 d =$5E
__
|__
|__
65 e =$79
__
|__
|
66 f =$71
__
|
|__|
67 g =$3D
|__|
| |
68 h =$76
|
|
69 i =$30
|
__|
6A j =$0E
|__|
|
6B k =$72
|
|__
6C l =$38
__
| |
6D m =$23
__
| |
6E n =$54
__
|__|
6F o =$5C
__
|__|
|
70 p =$73
__
|__
|__
71 q =$79
__
|
72 r =$50
__
|__
__|
73 s =$6D
__|
|
74 t =$46
| |
|__|
75 u =$3E
|__|
76 v =$62
|__|
77 w =$1C
__|
|
78 x =$52
|__|
__|
79 y =$6E
__
__
|__
7A z =$59
__
|
|__
7B { =$39
| |
| |
7C | =$36
__
|
__|
7D } =$0F
__|
|
7E ~ =$52
ok
pub (LED) ( char -- )
ledbuf 7 > IF ledbuf 2 + ledbuf 1+ 7 CMOVE ledbuf C-- THEN --- scroll if at end
SWITCH --- use the ASCII value as a switch in the case statement
^M CASE ledbuf C~ BREAK --- on CR reset display pos
^J CASE BREAK --- ignore LF
^L CASE ledbuf 9 BL FILL REFRESH BREAK --- reset and blank
^N CASE 0 12 LED! BREAK --- enable display (unblank)
^O CASE 1 12 LED! BREAK
"." CASE $80 ledbuf C@ 1- 7 AND ledbuf 1+ + C+! BREAK --- add in DP to previous character (or first)
SWITCH@ BL < IF SWITCH@ >N 10 LED! EXIT THEN --- set 4-bit brightness $10..$1F
SWITCH@ BL - 7segs + C@ ledbuf C@ 7 AND ledbuf 1+ + C! --- otherwise treat it as a character
ledbuf C++ --- increment position
REFRESH
;
If it's a control character then it shouldn't scroll plus you need a delay for each character while scrolling otherwise it will fly off the display far too quick. So the code has been updated with this and other features and fixes too.
btw, ledbuf 7 > should be ledbuf C@ 7 >
btw, yes, it is fun. Now if only I had a display....
MAX7219 driver
- don't bother anybody with trying the published code yet.
Nothing beats a test with real HW.
I sent an update to Peter since I can not directly edit the document.
It is really working fine now.
I was actually in the process of updating the driver again to handle multiple displays which is not quite as easy as it seems with the weird dummy nops that need to be issued when talking to one of the cascaded displays. Anyway I decided that I would just repeat the same address/data for any control registers and have another method to write to the data registers that needed unique data.
After I had done that I read the email from @MJB which pointed out that the actual hardware flips segments and digits so I patched my version but rather than manually recoding the segment I let Forth do the work for me at compile time with a simple one-liner in the source as that table might prove useful elsewhere.
Looks like it should work and if anybody has multiple displays they can test it out by downloading the MAX7219X-PBJ.FTH file onto an Explorer or other suitable system. To specify the number of displays you need to do this before downloading the driver source by typing into Tachyon this line (assume 4 displays)
4 == displays
then download the source and BACKUP
In the meantime I will order some displays off ebay and play with this too.
Have fun!
MAX7219 driver
- don't bother anybody with trying the published code yet.
Nothing beats a test with real HW.
I sent an update to Peter since I can not directly edit the document.
It is really working fine now.
I was actually in the process of updating the driver again to handle multiple displays which is not quite as easy as it seems with the weird dummy nops that need to be issued when talking to one of the cascaded displays. Anyway I decided that I would just repeat the same address/data for any control registers and have another method to write to the data registers that needed unique data.
After I had done that I read the email from @MJB which pointed out that the actual hardware flips segments and digits so I patched my version but rather than manually recoding the segment I let Forth do the work for me at compile time with a simple one-liner in the source as that table might prove useful elsewhere.
Looks like it should work and if anybody has multiple displays they can test it out by downloading the MAX7219X-PBJ.FTH file onto an Explorer or other suitable system. To specify the number of displays you need to do this before downloading the driver source by typing into Tachyon this line (assume 4 displays)
4 == displays
then download the source and BACKUP
In the meantime I will order some displays off ebay and play with this too.
Have fun!
Hi Peter,
I have multiple displays and the plan ready to handle them -
you beat me again ...
not too difficult, just some 0-words to clock out after the data/register write
now curious how you did it ...
and yes I did the bit reordering in the table with a one-liner too ;-)
Markus
now that the MAX7219 - 8-digit 7-segment LED driver converges to perfection, there are also those 8*8 LED matrix modules based on this driver chip :-)
so @Peter if you order displays ... ;-)
I already have some basic code ....
and I do not need to run the full Parallax font on them with scrolling etc ...
I want to just display the temperature profile of my solar storage tank.
MAX7219 based 8*8 Matrix works even in combination with 7-Segment display.
E.g. here the temperatures over the height of my solar storage tank.
Looks good Markus, how's the scroll speed do you think for continuous output? I am going to order some displays just for the fun of it, maybe eight in a continuous string.
btw, the video doesn't seem to work and I find that I have to youtube it and simply paste the youtube id using the youtube button.
MAX7219 based 8*8 Matrix works even in combination with 7-Segment display.
E.g. here the temperatures over the height of my solar storage tank.
Looks good Markus, how's the scroll speed do you think for continuous output? I am going to order some displays just for the fun of it, maybe eight in a continuous string.
btw, the video doesn't seem to work and I find that I have to youtube it and simply paste the youtube id using the youtube button.
scroll speed at 50ms is too fast - I set it to 100ms after I took the video.
I put it to Youtube and inserted it with the Youtube button, with Chrome it works for me.
Here's a handy little addition to Tachyon, I don't know why I never thought of it before. Two PBASIC'like words SERIN and SEROUT are written in Tachyon bytecode for simple bit-bashed serial communications. You could incorporate them into an output device for instance and use all your standard print functions through it as is normal for Tachyon. But as I was running some quick little serial decode tests on my new MSO I thought all I need is a word like SERIAL to redirect the output using SEROUT for instance. Better still, pass a pin number to SERIAL to set the transmit line. So I did and have been testing this up to 820,000 baud so far which isn't too bad for "interpreted" code.
Extend now has this added:
BYTE serpin
pri (SEROUT) serpin C@ SEROUT ;
pub SERIAL serpin C! ' (SEROUT) uemit W! ;
and I use it like this to say output serially on pin 5 and then on pin 9 at different baud rates.
460,800 SERBAUD
5 SERIAL PRINT" HELLO WORLD" CR CON
820,000 SERBAUD
9 SERIAL PRINT" HELLO WORLD" CR CON
I'm doing fine with the ioT modules, the loss was all the work product MJB did and I did with jgauges that worked on the spinnerete that wouldn't work with the 5500 module. MJB tried to get his forth web scripting to work with the module but no joy. Really sad because that scripting with ajax was just what was needed for the IOT in forth to be easy to use.
I will dig through my source to see if I can find my copy of the project.
I'm doing fine with the ioT modules, the loss was all the work product MJB did and I did with jgauges that worked on the spinnerete that wouldn't work with the 5500 module. MJB tried to get his forth web scripting to work with the module but no joy. Really sad because that scripting with ajax was just what was needed for the IOT in forth to be easy to use.
I will dig through my source to see if I can find my copy of the project.
Thanks for looking MJB
I had it working on Tachyon 2.1 (I think) but only on the Spinneret (W5100).
And when the EASYNET / Tachyon ? changed I could not get it to work again.
And Peter was busy with Wiz5200/5500 and not 5100.
When I have a W5500 AND the time, I'll try again.
I'm doing fine with the ioT modules, the loss was all the work product MJB did and I did with jgauges that worked on the spinnerete that wouldn't work with the 5500 module. MJB tried to get his forth web scripting to work with the module but no joy. Really sad because that scripting with ajax was just what was needed for the IOT in forth to be easy to use.
I will dig through my source to see if I can find my copy of the project.
Thanks for looking MJB
I had it working on Tachyon 2.1 (I think) but only on the Spinneret (W5100).
And when the EASYNET / Tachyon ? changed I could not get it to work again.
And Peter was busy with Wiz5200/5500 and not 5100.
When I have a W5500 AND the time, I'll try again.
I have a batch going off to Erna hopefully today (finally, now) and I have some extras in there for Markus but can you send me the code that doesn't work so I can check it on an IoT5500 and get it going?
I have one of Peter's IoT5500+P8 board sets that I'm sure I'm never going to have time to use. Don't get me wrong, it's a beautiful design. It's just that my eyes are bigger than my stomach. I have far too many Propeller boards. If you want it and you live within the US, send me a PM with your mailing address and I'll send it to you. I'd rather someone make good use of it than have it sit here collecting dust.
Good news I've found a working example archive of the Ajax and MJB's FORTH web scripting work. Let me dust it off and make sure it compiles on the spinnerete I need to find dang it. I'll pm you peter and mjb soon, mjb for your archive.
Here's a snippet I save with the project.
CREATE SMALL and IP setting is in files
Propeller .:.:--TACHYON--:.:. Forth V23140617.0000
NAMES: $4F6A...7442 for 9432
CODE: $0000...4CAE for 10198 (4294967286 bytes added)
CALLS: 0122 vectors free
RAM: 0700 bytes free
MODULES LOADED:
3F10: EASYWEB.fth WEBSERVER MJB WIZNET NETWORK SERVERS 140723.2300
38AE: W5100.fth WIZNET W5100 driver 140615.0000
2F8B: EASYFILE.fth FAT32 Virtual Memory Access File System Layer V1.1 140626-2100
2AB4: SDCARD.fth SD CARD Toolkit - 140626.1400
2954: SPINNERET.fth Spinneret + W5100 HARDWARE DEFINITIONS 131204.1200
28A1: EPRINT.fth EPRINT 140626.0000
1880: EXTEND.fth Primary extensions to TACHYON kernel - 140703-14OO
BOOT: EXTEND.boot
Good news I've found a working example archive of the Ajax and MJB's FORTH web scripting work. Let me dust it off and make sure it compiles on the spinnerete I need to find dang it. I'll pm you peter and mjb soon, mjb for your archive.
Here's a snippet I save with the project.
CREATE SMALL and IP setting is in files
Propeller .:.:--TACHYON--:.:. Forth V23140617.0000
NAMES: $4F6A...7442 for 9432
CODE: $0000...4CAE for 10198 (4294967286 bytes added)
CALLS: 0122 vectors free
RAM: 0700 bytes free
MODULES LOADED:
3F10: EASYWEB.fth WEBSERVER MJB WIZNET NETWORK SERVERS 140723.2300
38AE: W5100.fth WIZNET W5100 driver 140615.0000
2F8B: EASYFILE.fth FAT32 Virtual Memory Access File System Layer V1.1 140626-2100
2AB4: SDCARD.fth SD CARD Toolkit - 140626.1400
2954: SPINNERET.fth Spinneret + W5100 HARDWARE DEFINITIONS 131204.1200
28A1: EPRINT.fth EPRINT 140626.0000
1880: EXTEND.fth Primary extensions to TACHYON kernel - 140703-14OO
BOOT: EXTEND.boot
yes - looks like the migration from Tachyon 2.3 to 2.4 was when I got stuck,
tried to debug into Peter's EASYNET and W5100 driver, but not enough time to really understand it to the level needed to debug into it. -
and had to much else so I shelved it.
just had a quick look into MY code and found some strange things I don't think are right -
but maybe I just dont understand them any more :-).
I'll have a look into it later - I hope ...
Comments
this is fun ;-)
If it's a control character then it shouldn't scroll plus you need a delay for each character while scrolling otherwise it will fly off the display far too quick. So the code has been updated with this and other features and fixes too.
btw, ledbuf 7 > should be ledbuf C@ 7 >
btw, yes, it is fun. Now if only I had a display....
I was thinking the same ;-)
But I would order it from china to be sent to Peter
if he just sents me his postal address ...
- don't bother anybody with trying the published code yet.
Nothing beats a test with real HW.
I sent an update to Peter since I can not directly edit the document.
It is really working fine now.
Markus
I was actually in the process of updating the driver again to handle multiple displays which is not quite as easy as it seems with the weird dummy nops that need to be issued when talking to one of the cascaded displays. Anyway I decided that I would just repeat the same address/data for any control registers and have another method to write to the data registers that needed unique data.
After I had done that I read the email from @MJB which pointed out that the actual hardware flips segments and digits so I patched my version but rather than manually recoding the segment I let Forth do the work for me at compile time with a simple one-liner in the source as that table might prove useful elsewhere.
Looks like it should work and if anybody has multiple displays they can test it out by downloading the MAX7219X-PBJ.FTH file onto an Explorer or other suitable system. To specify the number of displays you need to do this before downloading the driver source by typing into Tachyon this line (assume 4 displays)
4 == displays
then download the source and BACKUP
In the meantime I will order some displays off ebay and play with this too.
Have fun!
Hi Peter,
I have multiple displays and the plan ready to handle them -
you beat me again ...
not too difficult, just some 0-words to clock out after the data/register write
now curious how you did it ...
and yes I did the bit reordering in the table with a one-liner too ;-)
Markus
so @Peter if you order displays ... ;-)
I already have some basic code ....
and I do not need to run the full Parallax font on them with scrolling etc ...
I want to just display the temperature profile of my solar storage tank.
but maybe I can do it more generic ... :-)
Peter, looks great
I can even use it as Tachyon Console Output
E.g. here the temperatures over the height of my solar storage tank.
btw, the video doesn't seem to work and I find that I have to youtube it and simply paste the youtube id using the youtube button.
I put it to Youtube and inserted it with the Youtube button, with Chrome it works for me.
I thought it might have been a bit fast but I didn't want it to crawl either! Thanks for fixing the youtube link, it works now.
[/quote]
MJB,
"I didn't do anything" does not cut it.
you have to say it right.
a) "It wasn't me, and I will not do it again"
or
b) "I did not do it, it was like that"
Enjoy!
Mike
MJB,
"I didn't do anything" does not cut it.
you have to say it right.
a) "It wasn't me, and I will not do it again"
or
b) "I did not do it, it was like that"
Enjoy!
Mike
[/quote]
oh subtleties of language
I meant B ... but maybe I am wrong ... anyway it works now ...
thanks
The one we did with the nice ajax and java gauges?
Spinnerets are on sale and I have a use case for them at this price but need the Tachyon build for this device to make it possible.
dp
How did you go with the IoT modules?
Extend now has this added:
and I use it like this to say output serially on pin 5 and then on pin 9 at different baud rates.
slowly, slowl, ....
I will dig through my source to see if I can find my copy of the project.
Thanks for looking MJB
And when the EASYNET / Tachyon ? changed I could not get it to work again.
And Peter was busy with Wiz5200/5500 and not 5100.
When I have a W5500 AND the time, I'll try again.
take your time, have fun
I have a batch going off to Erna hopefully today (finally, now) and I have some extras in there for Markus but can you send me the code that doesn't work so I can check it on an IoT5500 and get it going?
Here's a snippet I save with the project.
yes - looks like the migration from Tachyon 2.3 to 2.4 was when I got stuck,
tried to debug into Peter's EASYNET and W5100 driver, but not enough time to really understand it to the level needed to debug into it. -
and had to much else so I shelved it.
just had a quick look into MY code and found some strange things I don't think are right -
but maybe I just dont understand them any more :-).
I'll have a look into it later - I hope ...