2008-10-04

Z80 computer LED display

The Z80 computer now has its name in lights! (See video; I apologize in advance for the horrible low resolution and mp4 artifacts.)

Dr. Rosen and I got approval to buy an Alpha 215R single-line LED display as a demo for the Z80 computer. While it was on the way, I built a second peripheral for the Z80: a specialized RS232 port that accepts strings and reformats them for output to the LED display. (It's an interesting challenge to build a peripheral based solely on information from a datasheet, without having the actual device available.)

When I finally got to work with the display on Thursday, the interface actually worked -- but various electrical gremlins were causing all sorts of problems, when the Z80, interface, control panel, and sign were all connected. The problems eventually turned out to be mostly due to insufficient voltage -- as it turns out, 5.5V (rather hot for TTL circuits) at the power supply ends up being a nice, clean 5.0V to 5.1V at the Z80. Those 40-pin ribbon cables keep finding new ways in which to be a Dumb Idea(tm)...

At any rate, it started running very reliably Friday afternoon. The bad news was that this meant that it was time to start programming it. Writing Z80 code to do a demonstration script isn't too bad; a bit tedious to enter the strings, but still fun.

Toggling some 200 bytes of machine code in, byte by byte, however, is mind-numbingly boring -- even if (like me) you actually enjoy programming in assembler. (Note to self: there has GOT to be some source for knobs for those rotary switches SOMEWHERE!)

The script is running, though. Hopefully it will prove inspiring to the EET325 students. (How many college courses out there lead you through building your own computer, chip by chip and wire by wire?)

Labels: , , , , , , ,

2008-09-28

Much Ado About Nothing

Sometimes, nothing is exactly what you need. A specific amount of nothing, to be precise.

Here is a delay library, written in assembly, for PIC microcontrollers running at 8MHZ. If you find it useful, please let me know. Share and enjoy!

8MHz delay library

Labels: , , , , ,

2008-08-31

First peripheral



The first peripheral for the Z80 is working (although still somewhat alpha at this point): a two-line LCD text display. It's mapped as I/O ports 0x00 and 0x01, with control commands being sent to 0x00 and data to 0x01.

It's been tested with a "Hello, World!" program written in Z80 assembler. (The current version of the program is very inefficient; the ideal way to handle it would be to write the "Hello, World!" data into memory and then clock it out to the I/O port automatically (I believe the Z80 can do this in a single instruction, once the registers are set up.)

Here is the "Hello, World!" assembly code. The C register is loaded with 0x01, then the A register is loaded with the ASCII code for each character, which is output to the port.

In related news, I think I've found how to turn off all the peripherals on the PIC16F887. It's a good replacement for the '877A -- with an internal 8MHz clock, plus a complete 8-bit PORTA -- but it does seem to power up with a lot of extraneous analog options turned on. The MPU for the text display is an '887.

Edit: Here is an updated version of the "Hello, World!" app -- using a single OTIR (Output/Incrementing/Repeat) instruction to do the dirty work, once the registers are all updated. Apparently it works by not incrementing the program counter, so the same instruction is executed over and over until B counts down to zero. Whatever the mechanism, it works as advertised, and the program now takes up only 27 instead of 60 bytes of memory!

Labels: , , , , ,

2008-07-17

Plus ça change...

...plus ça ne change pas. Or so they say, anyway -- but the design of this computer has certainly changed. The changes are for the better, though: the core (which will be constructed by the students) has been greatly simplified, with as much functionality as possible having been collected into a control panel unit.

Here is the schematic for the "core." Some more minor changes may yet happen (perhaps another 74LS245 for the control lines etc), but the core design is essentially finalized. The idea is that the core system can run as a "headless" unit, without a control panel: with the addition of 24 LEDs to show the status of the address and data lines, it should look like a real "Hollywood" computer, complete with blinking lights! I'm still skeptical about putting LEDs directly onto the busses, but we'll see how that works out. If nothing else, they can be driven by three more '245s.

The control panel (still under construction) will include:
  • Rotary hex switches to enter addresses and data;
  • An LCD panel to read addresses and data (and perhaps other information);
  • Run/Stop, Single-Step, Manual/Auto, Reset, and Write switches;
  • An SD card slot and Load/Save switches to back up programs to an SD card; and
  • Three PIC microcontrollers to run all of this.
Right now, I'm creating a set of inter-MPU commands, to keep everything in sync. Complete details will be available here once it's all finished.

Labels: , , , , ,

2008-05-05

VSI gauge progress

The first CHComm-based instrument is starting to take shape. A Futaba servo connected to a PIC16F877a (yeah, I know -- gross overkill -- but it was handy) to make a VSI gauge. At this point, it works intermittently; it seems to only register changes of the hundreds' place; I really need to get an LCD on it to help diagnose what's going on.

On the bright side, it's up to 9600 baud, from 2400, so that helps.

Getting the PIC to properly multitask while communicating with the serial port is an interesting proposition. Right now, the main loop provides constant position pulses to the servo while polling the serial port line every 500us or so, to see if a start bit has been received. I'm leaning towards a 2-MCU solution for each gauge, though -- one to handle comms and one to run the servo. That way, the servo MCU would be guaranteed a very short data-update cycle, rather than allowing for a potential stoppage should something happen to the serial line. (Servos act strange when their position pulses are interrupted.)

Labels: , , , ,