Pages: [1] 2   Go Down
Author Topic: 80x25 video display and PC keyboard interface  (Read 3334 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (44.97 KB, 450x215 - viewed 142 times.)
« Last Edit: July 22, 2013, 02:00:37 pm by zx80nut » Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley



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/
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
« Last Edit: September 17, 2013, 09:10:30 am by zx80nut » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: September 21, 2013, 05:24:47 am by zx80nut » Logged

Tacoma, WA
Offline Offline
Full Member
***
Karma: 4
Posts: 192
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 22, 2013, 02:10:48 am by TynemouthSoftware » Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

Grant
Logged

Tacoma, WA
Offline Offline
Full Member
***
Karma: 4
Posts: 192
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

Pages: [1] 2   Go Up
Jump to: