Go Down

Topic: 80x25 video display and PC keyboard interface (Read 4008 times) previous topic - next topic

zx80nut

Jul 22, 2013, 08:57 pm Last Edit: Jul 22, 2013, 09:00 pm by zx80nut Reason: 1
Not STRICTLY Arduino, but close, as I use ATmega328 and ATmega88 processors, and could be adapted to Arduino-based code.

This is one of my other projects (you may have seen my other posts about the 70's TV game that I did on the Arduino).

Originally intended to be an interface to my CP/M design, it can actually be used for any project that has a 115200 (can be altered in code) serial port. It provides a full 80x25 display on either a PAL or NTSC monitor/TV.
The design shows a keyboard/serial interface along with the display, however, if only a display is needed then only half of the circuit is needed.

I recently changed the design (it's been online for a while) to use the ATmega328 processor, so the hardware would be familiar to those here in this forum, hence the reason for putting it here.

The video design is based on a project done by Daryl Rictor (credit to him, Google the name and you'll find his pages) but he did a 40 char display. I however, made changes to the code and hardware and managed to produce a full 80 char display using the ATmega328 (plus a 74HCT166 parallel to serial chip). The additional processor - the ATmega88 (could use a 168 or 328 though) handles the PC keyboard and serial interface.

The video chip uses assembler, but the keyboard processor is in C, so easily converted for the Arduino.

The pin choices were picked to make PCB design be as simple as possible.

Have a look on the page for more details. Some more pics will be added soon.
On free web hosting, so if the page is down (bit slow at the moment), please try again in a little while.
http://searle.hostei.com/grant/MonitorKeyboard/index.html

Grant.
http://searle.hostei.com/grant/index.html

Osgeld

very cool, been using the tv out library and a pile of ram in a 1284 to get 40 char, this is more what I was looking for (though basic bitmap graphics with tv out has its interesting parts)
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

zx80nut

I've now added a picture of the prototype to the page.
I'm sure some clever person on this forum could convert to a shield and library :)



Full "PC" character set displayable shown here:



Anyway, if any of this is useful to you, please feel free to use (non commercial only).

http://searle.hostei.com/grant/MonitorKeyboard/index.html

Grant
http://searle.hostei.com/grant/

fungus


very cool, been using the tv out library and a pile of ram in a 1284 to get 40 char, this is more what I was looking for (though basic bitmap graphics with tv out has its interesting parts)


Have you seen the Gameduino shield?
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Osgeld

http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

zx80nut

Hi.
An update now available on my page.
The display interface can now be accessed using 4 bits instead of 8 if needed (similar to LCDs) where each byte is passed as two sets of 4 bits.

So, controller requirements reduced from 10 pins (8 data + 2 handshake) to 6 pins (4 data + 2 handshake).

The 4/8 bit interface is selected by the inclusion of a resistor (or you can easily change the sourcecode and re-assemble if you don't want the resistor selector).

Updated diagrams, schematic, description and all source and hex files available online.

Latest version as always on my page here...

http://searle.hostei.com/grant/MonitorKeyboard/index.html

Regards.

Grant
http://searle.hostei.com/grant/index.html

Based on Grant's code, I've written an Arduino Library to support 80x25 TV out, using the Arduino as the serial interface rather than the ATMega 88. The ATMega328P video processor remains with Grant's code in.

The library has been updated for 4 bit mode support, and can be found here:

http://blog.tynemouthsoftware.co.uk/2013/09/arduino-80x25-tv-video-output-library_15.html

This is just the display output side of things, but it allows you to add 80x25 text out to a TV or monitor in the same way you would a 16x2 LCD display. If you need the PS/2 keyboard input, there are libraries available for that.

Thanks,

Dave Curran
Tynemouth Software
Vintage Computer repairs, Software Development, Web Design.
www.tynemouthsoftware.co.uk
http://blog.tynemouthsoftware.co.uk

Further to yesterdays update, I've had a go at reducing the interface even more, it's now lost another 4 pins. It's now down to a two wire interface, using I2C. It is a tradeoff, it does work out slower, but is fine for most uses.



One of the I2C pins was used as the latch pin on the shift register on Grant's original version. I've had to move that, so have generated a separate version with I2C support, and updated my library accordingly.

http://blog.tynemouthsoftware.co.uk/2013/09/arduino-80x25-tv-video-output-library_16.html

Thanks,

Dave
Tynemouth Software
Vintage Computer repairs, Software Development, Web Design.
www.tynemouthsoftware.co.uk
http://blog.tynemouthsoftware.co.uk

zx80nut

#8
Sep 17, 2013, 04:06 pm Last Edit: Sep 17, 2013, 04:10 pm by zx80nut Reason: 1
Following Dave's suggestion, I am including two-wire as an interface option to my page.

The display interface will then be hardware-configurable as 8-bit (10 pins needed), 4-bit (6 pins needed) or two-wire (2 pins needed).
The same software in the display processor will handle all options.

Minor change to the schematic needed (shift register load and RTS pins moved so that connections remain generic).
Updated schematic and code for the display and keyboard interface (both can use 4, 8 or two wire) is complete (not tested yet) and should be online soon. Will update once ready and tested.


Grant.
http://searle.hostei.com/grant/

zx80nut

TWI / I2C schematic and code all online now.

If the I2C connection remains open, it works well (and really fast). There is a bit of a problem if the I2C is closed and reopened. Investigating that bit. However, if this is the only I2C device that you are using then no need to close the data stream.

The I2C flow between my keyboard/serial interface to it (also on the same page) works perfectly and is as fast as the other options when converting 115200 baud serial to the display.
Only two connections between the serial/kb and the display are now needed (8 and 4 bit interfaces are still available as options)



http://searle.hostei.com/grant/MonitorKeyboard/index.html

Regards.

Grant

zx80nut

#10
Sep 21, 2013, 12:21 pm Last Edit: Sep 21, 2013, 12:24 pm by zx80nut Reason: 1
Lots more enhancements coming up soon.
Will have the ability to set the font size on a line-by-line basis as you can see here (actual screenshot on a normal CRT monitor - also works well on LCD TVs etc). There is also an alternate non-bold font available (again, per line). Also, possibly adding low-res graphics (160x100) - again, on a line-by-line selection so some areas can be graphics, some text. All of this is done with a very cheap ATmega328P (same as on the Uno) and 74HCT166 chips and is really fast and has no loading or memory on the host processor. All source will, as always, be published so that you can modify as needed.


http://searle.hostei.com/grant/MonitorKeyboard/index.html

Will update when ready.

Regards.

Grant.
http://searle.hostei.com/grant/index.html

UnaClocker

Very cool. Given how cheap something like the Teensy 3.0 is, perhaps this whole thing could be rolled into that very fast/high performance chip, for a simpler, single board/chip solution? Or if you need the 5v support, perhaps the Teensy++ 2.0 could do it? It's got a fair bit of ram onboard compared to the 328..
Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

#12
Sep 22, 2013, 09:08 am Last Edit: Sep 22, 2013, 09:10 am by TynemouthSoftware Reason: 1

Very cool. Given how cheap something like the Teensy 3.0 is, perhaps this whole thing could be rolled into that very fast/high performance chip, for a simpler, single board/chip solution? Or if you need the 5v support, perhaps the Teensy++ 2.0 could do it? It's got a fair bit of ram onboard compared to the 328..


The video generation needs very accurate timings, so as such has to be the only interrupt. That's why the communications needs to use an interface which is polled. If it were to use something like rs232 or spi, every time some data comes in, the display would be corrupted. In order to get sufficient pixels for an 80 character display, the data has to be shifted out in exactly 8 clock cycles at 16MHz, and there isn't much of a gap in the timings to do other things, and it needs 80x25x1 byte = 2048 bytes RAM for the display memory. So it basically consumes most of the memory and processing time of the one atmega328p, leaving the other pretty much empty and free to do what it wants.

That separation seems to be the best way of doing it, otherwise you end up having to make lots of concessions to get things working. Early 8-bit computers like the ZX81 did both tasks and ended up only running user code in the vertical blank period at the top of the page, the rest of the time being entirely devoted to drawing the screen. When it had to do some thinking, it would turn off the display. See Grant's ZX80 page (http://searle.hostei.com/grant/zx80/zx80.html) to find out all about that.

Once programmed and working, the second ATMega328P and the 74HCT166 can be pretty much left alone and you can get on with the rest of your project on the other atmega88 or arduino (depending on which way you're doing it).

I made a shield up for an Arduino, and I've written a library to do the 8-bit, 4-bit or I2C comms with the video processor, so its ends up being a self contained peripheral like an 16x2 LCD display. See my earlier posts here or my blog for further information on the library - http://blog.tynemouthsoftware.co.uk/2013/09/arduino-80x25-text-tv-out-shield-and.html)

The update to support all the new per-line styles is coming shortly.
Tynemouth Software
Vintage Computer repairs, Software Development, Web Design.
www.tynemouthsoftware.co.uk
http://blog.tynemouthsoftware.co.uk

zx80nut

As for anything, there are alternatives. However, the Teensy is NOT cheap in comparison, and would be $16 for the 2K version or $24 for the 8K version (more in the UK, no doubt). The ATmega328 is only a couple of dollars/pounds, plus it is well-used and understood on this forum. The mega328 chip is also easily available as a simple DIP package so any hobbyist can use it. Actually, given the size, you can squeeze the two chips needed for this version into a similar size factor that Teensy supports. Could also go other ARM chips etc. etc. etc... but that's not the purpose of this forum or thread :)

Grant

UnaClocker

Yeah, I understand at 16MHz it could be a problem, so that rules out the Teensy++ 2.0, but the Teensy 3.0 runs at 96MHz.. Not sure how a $13 Teensy gets up to $24, but it's your gadget, I was just trying to thing of a simpler solution. I do like the shield setup, I made a similar one for the Arduino DUE that includes VGA output, so you could use an old small LCD. But man, if you want to see expensive, that'd be the DUE for sure.
Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

Go Up