Electronic – Z80 I/O explanation

integrated-circuitz80

I have been following the two Great Z80 Project guides and the only thing I don't get is the I/O. He uses a 6522 I/O V.I.A. and I don't quite understand the idea of I/O ports. So my question is, how do I hook more than one 6522 to the CPU so I can control more peripherals?

Best Answer

For the 6522 to work, both CS (Chip Select) pins must be active. The trick here is that CS1 is active-high and CS2 is active-low; So tie CS1 to the high side of your power supply and CS2 to the low side.

Great Z80 project goes on with I/O accesses, finding a way to bring 6522 to life every time the Z80 does an *I/O cycle. 6522's CLK2 pin is driven:

We can easily substitute the Z80's "I/O Request" (IORQ) pin, which is the pin used by the Z80 to tell the I/O chip that it needs to access I/O.

No I/O address decoding is done, which mean your single 6522 hogs the entire I/O address space. No other I/O device can be added to the bus, else you'll have a data bus conflict.
This is what chip select lines are for. He hard-wires the two CS lines (one high, the other low) to keep the single 6522 awake. If you want two 6522s on the bus, connect one of the CS lines (of each 6522) to a Z80 address line to select one or the other. And thanks for the memories.