Dot-matrix + Connecting to a Mac

Dot-matrix + Connecting to a Mac

Postby Janke » Mon Feb 20, 2017 12:21 pm

Hello, new forum member here, in Helsinki, Finland! :D

I'm about to order a EzSBC1 board for building a long dot-matrix display using multiple MAX7219 Dot matrix modules. Do you think the speed will suffice for scrolling ten or more 8x8 dot displays (address+data totals 1280 bits) in real time? I assume this can be done by outputting string data on the serial pins? The MAX7219 module needs a clock pulse for each data bit: "For the MAX7219, serial data at DIN, sent in 16-bit packets, is shifted into the internal 16-bit shift register with each rising edge of CLK"

Re Mac OS:
Reading the somewhat daunting info in "OS X D2XX Library Version 1.2.2" with all those sudo commands, is there someone on this forum who has interfaced to a Mac and can advice, if needed? :?:

(I run the slightly antiquated OS X 10.6.8, and have had positive experience with a PIC PicoBasic microcontroller, which only needs the USB port recognized and set for operation; the only problem is its speed, only about 1000 instructions/sec, and limited instruction set; only 12 commands - the EzSBC1 is supposed to be 50 times faster and has a fantastic interpreter...)
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Daniel » Fri Feb 24, 2017 4:53 pm

Do you think the speed will suffice for scrolling ten or more 8x8 dot displays (address+data totals 1280 bits) in real time? I assume this can be done by outputting string data on the serial pins? The MAX7219 module needs a clock pulse for each data bit: "For the MAX7219, serial data at DIN, sent in 16-bit packets, is shifted into the internal 16-bit shift register with each rising edge of CLK"


I don't really know what real time means but sending 1280 bits is easy if you use the SHIFTOUT instruction. It shifts a byte at a time through a pin of your choice and generates a clock pulse for each bit on another pin of your choice. Shifting 160 bytes will take around 40ms. I hope it is fast enough. Sending a bit at a time by shifting the data and toggling a bit will be slow, maybe around a millisecond per bit. That's why I have the SHIFTOUT function.

I can help with the driver installation if you get stuck. Contact me by email if you are stuck.

Daniel
Daniel
 
Posts: 91
Joined: Tue Nov 13, 2012 2:10 pm

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Sat Feb 25, 2017 1:33 am

Thanks, Daniel, for your encouraging reply. In fact, I ordered an EzSBC1 (and also twenty 8x8 LED matrices with 7219 drivers, for only $1.30 each!) on eBay even before your reply (I assume it's you selling the EzSBC on eBay...)

However, the bottleneck is probably not in the shifting out of the data, but the preparation of the data; the 7219 driver is intended mostly for 7-segment numerical displays, thus using it for dot-matrix is a bit more complicated in software, if you want to scroll the display. You need to calculate the 7219 register address and the 8-bit data for every column of pixels that is shifted, and in a message of, say 16 characters (in a 5x8 matrix), that will take some time, certainly a lot more than 40 ms (which would certainly be enough for scrolling if there's no need for calculation...)

However, a static display of 16 characters will probably be enough for my purpose*, so even if the calculation and the building of the 1280 bits of data to be sent out in 40 ms on SHIFTOUT takes half a second, no problem...

* An information display for my PIC-processor controlled miniature railroad, see: https://www.youtube.com/watch?v=5bnbbi1O2RE

Best wishes from Finland (see a parody of our country here: https://www.youtube.com/watch?v=yP9Qt-bSz40 )

Jan-Eric
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Daniel » Sat Feb 25, 2017 10:16 am

That's an impressive minature! How long did it take to build? And how do you move the trucks and cars?

Here's another Finnish work of art. http://pokitto.com/index.php?id=15 The project grew out of a module that Jonne bought from me a while ago.

Daniel
Daniel
 
Posts: 91
Joined: Tue Nov 13, 2012 2:10 pm

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Sat Feb 25, 2017 3:08 pm

Daniel wrote:That's an impressive minature! How long did it take to build? And how do you move the trucks and cars?


Thanks for the thumbs up!

I've spent about 500 hours on the layout so far, including programming the PicoBASIC (only 12 commands) PIC controller which runs the trains (I've already maxed out the program memory of only 8 KB). Had I but known about the EzSBC1 a year ago, I certainly would have chosen it instead! Most of the other stuff is simple electronics, timed with a handful of 555 ICs.

The cars and trucks are commercial products, German FALLER "Car System" brand. No processor needed for this! The steering is by a steel wire hidden under the road surface, and a tiny magnet in the vehicle turning the front wheels - completely mechanical! Power on/off is by a servo-moved magnet under the road, and a reed switch in the vehicle. I've added a voltage converter for the lights in the cars, since no LED will light up on the mere 1.2 volts from a NiMh battery... that was fiddly to fit into the smaller car!

I'm continuing with a funfair addition with a couple of working rides (built from Faller kits, but added electronics and LED lights), a rock concert with moving, only 19 mm (3/4") tall performers (all my own design), all these controlled with a second PIC.

However, the PIC is not capable enough for the next part of the project, a LED matrix display of informative text and graphics - the layout will be displayed at the Finnish Railway Museum's "100 years of Finnish Independence Miniature Train Expo " in May...

Thus, the EzSBC1, which is on its way at the moment...
Last edited by Janke on Sat Apr 01, 2017 6:42 am, edited 1 time in total.
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Wed Mar 01, 2017 10:09 am

Got the EzSBC1 today, just one week after ordering it - great!

After some problems getting suitable communication software installed in OS X, I'm now using the MacWise VT100 emulator, which appears to interface well - the LEDs are blinking colorfully, and I can edit the program!

One question: this emulator doesn't have a file download option, so I'm pasting text in the editor instead. That is rather slow (about 3 short lines per second) - but the manual says download is slow, too. Any difference there - would another emulator with download capacity be any faster?

Now, just waiting for the LED matrix shipment...

EDIT: After some timing tests using the clocked SHIFTOUT command, I conclude that merely loading the data into ten daisy-chained MAX7219 LED display matrices will take about 50-60 milliseconds. Thus, a refresh rate of about 15-20 Hz can be achieved. The problem, however, is that in order to scroll the matrix display, both address & data must be modified for each load - and this will take time, probably a lot more than the sending out of the data.

Thus, no scrolling text with Control Basic! (A different matrix setup with simple, non-addressable shift-register drivers would enable scrolling in real time, but I haven't found any cheap components for such a setup...)

However, the MAX7219 drivers + displays are dirt cheap (only $1.30 apiece for an 8x8 LED matrix), so that a long, even multi-line display won't cost much. Outputting static text to a display of, say, 120 x 16 pixels (2 rows of 20 characters each), will take about 1/10 of a second, and such a display will cost less than $40... and will be rather impressive with a size of about 3 by 20 inches!
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Daniel » Wed Mar 01, 2017 1:24 pm

To get a decent working environment try using CoolTerm. It works reasonably well.

The reason why pasting into the window doesn't work well is that I convert the text to tokens as they are typed and save them to memory. The conversion to tokens is fast but the saving to memory is slow and tricky. I have to program the same memory that I'm running from and that requires fancy footwork, because you can't read from the memory while you are writing to it. That means some code is copied to RAM and executed from there.

Downloading is much faster than pasting text into the editor. From memory its about 2000 characters per second.

I made some dumb descisions early in the development of the interpreter. At the time they looked like sensible choices but there are unforseen consequences of each descsion and the way the editor, tokenizer and downloading works together is now massively complicated. What is even worse is that it works reasonably well and changing it is a huge task. The resistance to change is large ....

Daniel
Daniel
 
Posts: 91
Joined: Tue Nov 13, 2012 2:10 pm

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Wed Mar 01, 2017 2:02 pm

Yes, thanks for the hint - CoolTerm looks pretty cool! And loading a file is indeed a LOT faster this way!

However, editing messes up the display, instead of a normal listing, all lines are concatenated to a single block of text, impossible to edit. I'm sure some setting is wrong, but despite trying a lot of the options, still a mess... looks like this:

eEditor.......New fileSIZE=240PINMODE 21, OUTPINMODE 20, OUTPINMODE 22, INDIM BYTE(SIZE+1)SETTICK(0)FOR I=1 TO SIZEBYTE(I)=RND(256)NEXT IPRINT GETTICK/10;PRINT " ms"REPEATSETTICK(0)FOR I=1 TO SIZESHIFTOUT (21,20,1,BYTE(I))NEXT IPRINT GETTICK/10;PRINT " ms" x=INKEYUNTIL x>0ENDCtrl-\ Help

Any idea what's wrong?

EDIT: This happens also with some other terminal emulators, but not with all... The editor is actually the most "inconvenient" part of the EzSBC1, so I'll be using an open text editor all the time, saving the file and loading it into EzSBC1 - so no big deal, really, but of course, I'd like to have it work... ENDEDIT

BTW, the list command works OK, here's the same short test code for shifting out enough data to fill fifteen 8x8 LED matrices, i.e. 20 ASCII characters:

Program Listing:
SIZE=480
PINMODE 21, OUT
PINMODE 20, OUT
PINMODE 22, IN
DIM BYTE(SIZE+1)
FOR I=1 TO SIZE
BYTE(I)=RND(256)
NEXT I
REPEAT
SETTICK(0)
FOR I=1 TO SIZE
SHIFTOUT (21,20,1,BYTE(I))
NEXT I
PRINT GETTICK/10;
PRINT " ms"
x=INKEY
UNTIL x>0
END

As you can see, I've only generated random data, but I timed the actual shifting of the data to the MAX7219s... 80 milliseconds for 240 bytes of address and data.
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Fri Mar 03, 2017 1:41 am

Hi again -

I found out that Mac OS X's own Terminal program works well, once you get the settings right:

screen /dev/tty.usbserial-A601TIHF 57600,cs8


(Note: The exact command contains the boards serial info, so you need do a ls /dev/tty.usb* command first, to get it...)

Editing also works correctly, which it doesn't in CoolTerm, see above.

The only thing missing from OS X Terminal is a "Send File" command, but I can just copy/paste the program after hitting D. Ez!
Last edited by Janke on Sat Apr 01, 2017 6:48 am, edited 1 time in total.
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am

Re: Dot-matrix + Connecting to a Mac

Postby Janke » Sat Mar 11, 2017 6:58 am

Just an update FYI:

The software is progressing nicely, I have the bitmap font ready, in Hex notation (not binary which takes twice the space - there's not enough RAM for everything else I'll be needing...)

For a simple text display there's ample RAM, and if you want to design your own font, it's easier in binary - in fact, I did that, and converted to Hex later to save space.

I'll post photos, schematics and will open-source my code here, as soon as I get everything together and up and running. (Still waiting for the LED matrices to arrive from eBay...)
Janke
 
Posts: 15
Joined: Mon Feb 20, 2017 11:48 am


Return to EzSBC1

Who is online

Users browsing this forum: No registered users and 1 guest

cron