80x25 video display and PC keyboard interface

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

ATMega328Video_S.jpg

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)

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 :slight_smile:

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/

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)

Have you seen the Gameduino shield?

yes

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:

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

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.

Thanks,

Dave

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/

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

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

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..

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..

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 - Tynemouth Software: Arduino 80x25 Text TV Out Shield and Library)

The update to support all the new per-line styles is coming shortly.

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 :slight_smile:

Grant

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.

Hi Unaclocker.
Thanks for the info. The prices I saw were from PJRC and also a UK supplier for the Teensy 2, however, appreciate may be cheaper elsewhere :slight_smile:

The Teensy 3 that I can see is 48MHz (but appreciate faster would be available). Obviously, different chip so not "Arduino", but then again... if you are going up to that sort of price then for a few dollars more than the Teensy, you could get a MUCH higher spec Raspberry Pi with HDMI high definition output running Linux or RiscOS
...anyway... that's a different forum :slight_smile:

Back to this... coding is going well (display is working, but the command processor part needs to handle the differences between the single/double width/height). Hope to have updated files online in a few days, but would also like to get the set/reset graphic command implemented at the same time.

Regards.

Grant.

Little update again...
Got a couple of glitches (there's one on screen) to clean-up, but nearly ready.
Also now supports bitmap graphics (160x100) supported with set pixel and reset pixel commands.
Each font style or graphics section (can have many on-screen) is on a line-by-line basis (most that can be done in only 2K RAM!) so can be mixed as shown in the screenshot.

Only two chips...
ATmega328P (as on the UNO) and a 74HCT166

(Patterning is just due to taking a photo of a CRT screen - not visible in real life)

Will update the page when complete.

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

Grant.

Due to enhanced functionality, I've started a new thread with a more applicable title...

http://forum.arduino.cc/index.php?topic=190368.0

:slight_smile:

Please continue on that thread instead.

Regards.

Grant

Hi, i know this is a very old thread but I'll give it a try.
I'm trying to make work this video adapter with a pro mini with a 328p on it. The main issue is that I don't have access to eBay, or any other online shop, because I live in Cuba (US Embargo, you know).
I'd like to use a pro mini by burning the CLKOUT fuse to ON, and using some other pin for VSync output. I will not use the 8 bit interface, nor the I2C. There are some available pins left. I was taking a look on the 328 data sheet and it looks that you have selected PB0 as VSync because there is an interrupt vector that points to it. My assembler skills are 0.000001%, I can't figure out how to use for VSync, let's say PB5.
Please help.

I was guessing another workaround, burning CLK fuse so the slave Arduino receives CLK from the master one, in the master CLKOUT:ON. That would give me a TTL CLK for the shift register too.