Hi Folks,
I am using a Z80180 (64-pin DIL) chip with garden variety Z80 PIO, and I don't
seem to be able to coax the PIO into performing any output whatsoever.
To put this into context, I've successfully programmed a Z80 CTC chip on the
same board and it provides me with a very nice interrupt every 10ms, as I
require it to.
Using a similar code snippet to the CTC programming, here's the PIO
initialisation:-
PIO0_A_CONTROL=0xCF; /* Bit control mode */
PIO0_A_CONTROL=0xFF; /* 1=Input, 0=Output */
PIO0_A_CONTROL=0x00 | 0x07; /* Int control word */
PIO0_A_CONTROL=(byte_t)((&Interrupt_vectors[0]-&Interrupt_vectors[0])*2);
PIO0_B_CONTROL=0xCF; /* Bit control mode */
PIO0_B_CONTROL=0xF0; /* 1=Input, 0=Output */
PIO0_B_CONTROL=0x00 | 0x07; /* Int control word */
PIO0_B_CONTROL=(byte_t)((&Interrupt_vectors[1]-&Interrupt_vectors[0])*2);
Although the above code sets the interrupt vectors, interrupts are not
actually used as yet.
Now, I've verified that the above code sends the correct data to the PIO (as
far as I can see) with a logic analyser - the chip enable, A/B, and C/D pins
and IORQ are all in the correct state (the A/B and C/D pins are connected to
the A0 and A1 lines in the usual way). I have another piece of code that
changes bit 0 on port B roughly once a second, but interestingly port B
always reads back as 0x00.
With the Z80180 one has to do a couple of tweaks to the CPU timing with an
OMCR register. M1 has to be disabled and an IOC flag has to be cleared to
switch-off compatibility with the similar Hitachi Z80-like device. I also
realise that M1 needs to be asserted at some point to arm the Z80 interrupt;
but as I'm not using interrupts it doesn't really matter. M1 does appear
during the CTC interrupt service, so the PIO will see this every 10ms or so
anyway; but I've tried adding an M1TE (M1 temporary enable) after each port
setup above without success.
Can anyone suggest where I might be going wrong? The generated assembly code
shows in0 and out0 instructions, but they still address the correct port
address so I don't really see a problem with that, and the same principle is
used for the Zilog CTC and that works fine.
I'm completely baffled. Any suggestions would be welcome.
--
Richard.
PGP Key-id: 0x5AB3D350
You are here:
***
***
*********
*******
*****
***
*
But you're not all there.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user