Page 1 of 1

Controlling relays from exp port, I/O.

Posted: Wed May 27, 2020 5:00 pm
by Erm
A Spec-chum of mine here in Germany wants to drive some relays from his Spectrum (some kind of programmable robotic arm is his aim I believe). I said I'd ask some questions for him as I don't think he can speak English that well. He seems fairly competent with electronics, at least competent enough to make this I/O device, which was detailed in a 1984 German mag:
specchum.jpg
He has asked me how does he make the relays work from a BASIC program. I have no idea, perhaps someone else has an insight.

Re: Controlling relays from exp port, I/O.

Posted: Wed May 27, 2020 6:02 pm
by 1024MAK
As you are asking the question in relation to a ZX Spectrum, I have moved this to the ZX Spectrum hardware area.

On a ZX Spectrum, use:
OUT a,d

Where a is the address the interface is mapped to, and d is the data byte you want sent to it. Both are in decimal. See the manual for more information.

To read data from the inputs, use:
LET d=IN a

Where a is the address, and d will be given the data byte read by the Z80 from the interface inputs.

The above assumes that the selection jumper to IC N11 is wired to /IOREQ.

If the interface was to be used on a ZX81, then the selection jumper can be wired to /MREQ. As ZX81 BASIC does not have an OUT command, POKE is used instead.

We don’t use /MREQ for the ZX Spectrum, because the memory map on the ZX Spectrum is full, and it would conflict with accessing memory.

Mark

Re: Controlling relays from exp port, I/O.

Posted: Wed May 27, 2020 8:47 pm
by 1024MAK
I work the address out to be 0x3FE1 or 16353 decimal.

On a ZX Spectrum address line A0 has to be high (1) otherwise the ULA will respond. Hence 0x3FE1 or 16353 decimal.

Mark

Re: Controlling relays from exp port, I/O.

Posted: Wed May 27, 2020 9:57 pm
by Erm
Ah yes, it's ZX Spectrum related, sorry.

Excellent, I'll see if he has the German version of the manual and point him at the IN/OUT section and forward your info.