Close

PIO Modes Working

A project log for 3-Chip Z80 Design

Combining a Z80 retro design with a modern PSoC CPU.

land-boardscomland-boards.com 10/31/2019 at 23:030 Comments

Put in a level of support for the PIO. 

It's not possible to completely emulate the PIO using an MCP23017 I2C Port Expander. The PIO has hardware handshake which runs automatically in particular modes. There's no support in the MCP23017 for hardware handshake. Plus the MCP23017 is much slower. 

But emulating the PIO does work at some level. There are two 8-bit ports and they can be set to the same modes as the PIO:

The interrupt controller function needs work. The MCP23017 has an interrupt line which can be set when there is a change of an input pin. The PSoC can communicate with the MCP23017 to determine the interrupt source.

But, I'm happy with the operation as it is. I hooked an LED up to a pin, made it an output and then toggled the line from OUT commands in BASIC. Here's the BASIC program.

10 REM BLINK THE EXPANSION MCP23017 LED ON GPB7
20 REM SET PORT B INTO OUTPUT MODE
30 OUT 35,15
40 OUT 33,0
50 FOR I=1 TO 1000
60 NEXT I
70 OUT 33,255
80 FOR I=1 TO 1000
90 NEXT I
100 GOTO 40

Discussions