Controlling relays from exp port, I/O.

Post Reply
User avatar
Erm
Posts: 225
Joined: Thu Jun 20, 2019 7:07 pm
Contact:

Controlling relays from exp port, I/O.

Post 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.
I'm Chris, a Brit in Germany (Chr$ on the QL forum). https:\\QXL.WIN < QL related collection.
User avatar
1024MAK
Posts: 5101
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

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

Post 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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
1024MAK
Posts: 5101
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

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

Post 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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
Erm
Posts: 225
Joined: Thu Jun 20, 2019 7:07 pm
Contact:

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

Post 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.
I'm Chris, a Brit in Germany (Chr$ on the QL forum). https:\\QXL.WIN < QL related collection.
Post Reply