Wiring a Z80 to Arduino...

Remember the days of stacking eight 1 x n bit RAM chips and bending out the data pin sideways to save on sockets and wire-wrap joints?

And you tell that t’young people today; they won’t believe you.

Luxury we used to dream about eight 1 x n bit RAM chips.

Just found an unused Z80B in my parts box! I know somewhere in my "filing system", I have a diagram for a five chip Z80 board (processor, EPROM, 6116 RAM, UART and PIO).

Hmmm, this could be a long night.

This has been a pretty fun thread to read; I've got a handful of Z80 processors scored from my favorite haunt, Apache Reclamation, here in Phoenix. They've got a back room (full of NOS vaccuum tubes) with these drawers filled with various ICs in tube carriers - I'm sure in one of them is a cache of Z80 processors (found some 6809P once). Heh - in one of the bins there they had a wire-wrap prototyping board - pretty large, lots of area on the top-side, tons of gold plated pins sticking out from the bottom. I wanted to buy it, but they wanted something close to $100.00 for it - well beyond what I was willing to pay (interestingly, years ago they sold me an Altair for about the same amount).

What I don't understand from the OP - is why did he remove the Z80 from the Amstrad CPC? That was his Z80 computer right there; he would've been better off fixing/restoring that machine (its not like they're making more - and these old PCs and such are only climbing in value as the years go by - I was perusing Apple IIe hardware the other day, and saw that while the prices for a system weren't high - they weren't that low, either; still - cheap compared to an Altair system, which is why I consider myself lucky to own one - albeit in non-working condition right now).

I'm sure somewhere on the internet is an Amstrad club or users group of some sort...maybe.

:)

AWOL: After I got bored toggling in programs (no cassette storage and no UV-EPROM programmer), I bought a Nascom 1, but still couldn't afford an assembler, so I became very adept at hand-assembly - I still remember that "INC HL" is 0x23. How sad is that?

Not sad at all. Hey, I still think back fondly on my days writing Macro-11 on PDPs. How can you not like an instruction set that contains SOB (Subtract One and Branch). Back then, we worked pretty hard to write really good, clean, elegant, efficient code. I'm guessing any newer embedded system these days has more RAM than we did, and we ran the OS and DECnet, plus our applications. Those were (mostly) fun times.

Hi.
It’s very late, I’ve spent a lot of time trying to make that thing work,
but… it doesn’t!
This is how I connected the whole thing: (sorry, didn’t find time to draw
a schematic, and I have no dedicated software. Do you know good, open-source ones?)

  • not connected:
    A4-A15 (I only watch A0-A3)
    /HALT,/MREQ,/IORQ, /RD, /WR, /BUSAK, /M1, /RFSH
  • to Arduino 5V :
    Vcc, /INT, /NMI, /WAIT, /BUSRQ
  • to GND:
    Vss, D0-D7
  • to arduino:
    CLK, /RESET, A0-A3

When I power this on, without any resistor before GND, the CPU overheats
very fast (even if I clock the CPU at 1 Hz… it seems strange to me), and I unplug
it 'cause I’m not sure it won’t break.
If I use a resistor, it takes time to heat, but enventually will. And it doesn’t work the same.

My sketch is the following :
setup :
set arduino clk & reset to output, arduino A0-A3 to input
reset ← low
clock ← low
every 500 ms, switch the clock output from low to high or high to low
after 3 s, reset ← hi
read A0-A3. if result is different than previously read, display.

When I use a resistor, I’ve got a fixed 1111 result from A0-A3.
When I don’t, it alternates very quickly between 1111 and 0111. (faster
than the clock). But I didn’t think of MREQ, maybe I have to check its
value too before displaying A0-A3.

So, still I’m stucked… but I go on searching.
BTW, Rob, thanx for the http://www.z80.info website, I think I will try to
setup the minimum Z80 CPU test circuit (Thomas Scherrer Minimum Z80 tester),
seems a good way to find if the CPU is still OK, and if there is any problem with
the heat…

Time to sleep, I will just try the MREQ thingy before (or I won’t be able to sleep!). See ya.

Bozgrul

You can't supply a clock signal to the Z80 from an IO port, you need a high frequency, about 2-4MHz.

You can generate upto 8MHz with any of the timers on the ATmega by directly programming them.

The original Z80 should get hot, its NMOS! Max current 150mA so nearly a watt of heat dissipation (at any clock frequency). The datasheet says static by design but parts only tested down to 5kHz. Have you measured the supply current - if its greater than 150mA you can be sure its fried or overloaded.

I suspect any replacement Z80 you can find these days is CMOS and much less power hungry.

Well, MREQ is alway low (active), A0-A3 is always 1111... Time to go to bed !

Bozgrul

Hello !

So, I've tried a new circuit, the Z80 test circuit from z80.info (http://www.z80.info/z80test0.htm), to be sure that the Z80 was working correctly by itself, before going on. And the result is... the circuit is not working. But I can't tell right now if it's the Z80 that's not working or a mistake of mine, during the assembly. A lot of heat, no LED on.... (btw, I assume that the Z80 can overheat even if it's broken. Is it right ?) I've made a few checks with my voltmeter, and found some weird results : the resistors next to D0-D4 (or D3, not sure) show something around 1V, the next one (D5 or D4) is 2.5V, and the remaining ones (D6-D7 or D5-D7) are 0V. It doesn't seem right, but what can it mean, I cannot tell... I've orderded a few Z80s from Jameco, because I don't know french shops that sell Z80s. So I'll have to wait a few weeks maybe... (btw, do you know european shops, where shipping might be quicker - and cheaper ?)

During this time, I will try to do the same thing with a 6502 I've just received from eBay. I have more confidence in it, so maybe I'll be able to make it work (even if it works differently, the clock for instance...).

I'll tell you as soon as I have any interesting results (w/ the arduino, of course!).

Bozgrul

Sorry I don’t get the D0-7, there are only 3 diodes on that schematic and they are LEDs.

I assume that the Z80 can overheat even if it’s broken. Is it right ?

Yep, it could go either way depending on what’s cactus.


Rob

D0..D7 is the Z80 data bus, just as A0..A15 is the address bus.

D0..D7 is the Z80 data bus, just as A0..A15 is the address bus

I think it is the thought of wiring all that lot up more than anything else turned me on to microcontrollers! My FYP was a 6800 controlled rover, and I damn near sprained my wrist wire-wrapping it.

I don't get the D0-7

0..D7 is the Z80 data bus, just as A0..A15 is the address bus.

Doh, I must have written that before my first cup of coffee.

All the data lines should show 0v I would think, if that's not the case then the chip must be stuffed.


Rob

This project sounds prime for an FPGA

That would be cheating

Hello ! Sorry for the long delay (delayWeeks(), a new Arduino function... :)), but I was waiting for my Z80 - and other electronic stuff - from Jameco (which costed me 44 € for shipping PLUS 44 € for customs... ouch... never again !), and then I became father for the second time... So I'm just beginning to have a little spare time for me again, before going back to work tomorrow (ouch again). While waiting for the Z80, I made some tests with a 6502, and it worked perfectly. So, I've done the same tests with the new Z80, and it works great. - I've bought a 1Mhz oscillator, but it's too fast for the Arduino to keep up the pace, even with a basic test. So I'm still using the Arduino as the source of CLK. - The Arduino plays the role of an memory simulator (using the Arduino RAM for the Z80). For the time being, I write my Z80 code and compile it on PC, then insert it into a byte array in the Arduino code. (eg: char bytes[]={0x3E,0x20,0xD3,0,0x3C,0xC3,2,0};). Every time the Z80 requests a byte from memory, it is taken from this array. Thank you Rob for the suggestion. - It also serves as an I/O IC simulator : every time the Z80 outs a byte to 0, the Arduino sends it back to the PC via Serial and then I can display it on my PC screen. I will use the same mechanism, in the opposite direction, to provide a virtual keyboard to my Z80 computer.

Things I'd like to do now: - use a real memory instead of the Arduino. Since I don't have an EEPROM programmer, I'm trying to use a NVRAM but for now, it doesn't work (whenever I reset my circuit, some bytes - sometimes a lot- from the NVRAM get corrupted, don't know why. Maybe a write occurs during the RESET with the WriteEnabled pin unstable ?). When it will work, I will set up a assembly chain, so that I can write code on my pc, then assemble and download it into the NVRAM, with some kind of bootloader at the start of the NVRAM (the Arduino will "listen" to IORQ queries on address X, and provide the data to the bootloader so it can write it into RAM - don't know if I'm clear !?) - use latches to provide more than 64 kbytes of memory (switching banks) - connect a parallel 40x2 LCD display directly to the Z80, so it can output text by itself - build or connect some kind of keyboard. - connect some kind of mass storage. I've only a few ideas right now, like using the SPI interface of an SD-card. - connect it to a VGA monitor. The tricky part for me, right now. then... - write an O/S (multitask would be great, but is it possible without hardware NMI ?) and maybe a compiler before (or use some kind of C compiler for Z80, like SDCC) - make it multi-processor - etc, etc...

Well, that's a lot to do ! It will eventually require a few years... Thank you again for your advices and help !

cr0sh : sorry, I did'nt have enough time to explain why I'm doing this. - first, I didn't know you could still find DIP40 Z80 (I knew of the Rabbit one, but where's the fun ?) - I'm not interested in repairing it to have it work (I've had a 6128 CPC Amstrad, in the 80's, and emulators are enough for me) - it's really for the sake of the educational value : I've always wanted to design and build my own computer, but I work in the software businness, which is a really separate world (when you don't work with embedded devices). - I was sure the Amstrad was in bad condition. When people sell you this kind of stuff, at a very low price, and without the power cord (because they "could'nt find it"), 99 % of the time it's because it's not working anymore.

Boz

OK I know this thread is as old as my granddad.

If you're still there Boz, did you do any more with this?


Rob

Really enjoyed reading this thread and remembered having some old books lurking about some where.

graynomad said "I had a Microprofessor development board once"

Me too, left it at the office, went on annual leave (late 1983 iirc?... shit, exactly 30 years ago...), and some bar-steward stole it. I was not best pleased.....

Hi, I still have mine...

Tom... :)