Greetings,
I'm trying to interface a PICAXE 28X2 with a Z80. The interface uses a 74HC373 for communications from the Z80A to the PICAXE, and the OUT instruction of the Z80 (i.e. the data from the Z80 gets latched by the 74HC373 when IORQ goes low, WR goes low, and the A0-A7 address lines correspond to the PICAXE interface address). The PICAXE also receives the latch pulse on pin C.0 so that it is aware that new data has been latched into the 74HC373 and is ready to be read.
I configured the timer as a counter, and set it up so that it overflows at each pulse received on C.0 and triggers an interrupt for the PICAXE, like so:
So far so good... Until I actually tried to output something from the Z80 to the PICAXE: only (and exactly) one out of two OUTs are actually detected, even when the two consecutive OUTs are separated by a very long pause (even seconds). I tried at various PICAXE clock speeds (up to 64MHz), but to no avail. I however remarked that below 16MHz, the PICAXE was missing even more pulses, so I made the latter longer, by simply adding a diode between the output of the gate generating the latching pulse for the 74HC373 and pin C.0, with a capacitor (tried up to 470pF) and a resistor (tried up to 4.7K) in parallel, between pin C.0 and ground (this results in pulses that last up to 2.5µs on C.0). With the pulse lengthening, the PICAXE detects the pulses in the same way at all clock frequencies, but alas still only one pulse out of two !
My questions are therefore:
I'm trying to interface a PICAXE 28X2 with a Z80. The interface uses a 74HC373 for communications from the Z80A to the PICAXE, and the OUT instruction of the Z80 (i.e. the data from the Z80 gets latched by the 74HC373 when IORQ goes low, WR goes low, and the A0-A7 address lines correspond to the PICAXE interface address). The PICAXE also receives the latch pulse on pin C.0 so that it is aware that new data has been latched into the 74HC373 and is ready to be read.
I configured the timer as a counter, and set it up so that it overflows at each pulse received on C.0 and triggers an interrupt for the PICAXE, like so:
Code:
symbol NEWBYTE = bit0
.../...
let dirsC = %00000010
settimer count 65535
let toflag = 0
let timer = 65535
setintflags %10000000, %10000000
.../...
main:
if NEWBYTE = 1 then
let NEWBYTE = 0
; recover byte and deal with it
endif
goto main
.../...
interrupt:
let toflag = 0
let timer = 65535
setintflags %10000000, %10000000
let NEWBYTE = 1
return
My questions are therefore:
- Which PIC18F25K22 timer (0,1,3,5) is actually used by the PICAXE 28X2 firmware to implement its "timer" ?
- Is there any defined limitation on the pulse width ? Is the PICAXE able to sample individual pulses on C.0, or only a clock signal ?
- What did I do wrong ?
Last edited: