Acorn bbc micro   1996-2001
1998 printer port hack

The BBC Micro, featuring a design that invites the connection of customised interfaces and peripherals, is made for experimentation. I was seduced by this open philosophy, missing on most contemporary machines. Soon enough, I was able to control prototypes connected to the machine. I am using mainly two of the available ports:

- The Analog to digital port, featuring 4 analog inputs, allows the connection of various sensors. It can be used to measure values from the real world such as temperature, luminosity, audio level, motion, etc... It also provides to digital inputs for detecting the state of switches.

- The user port, providing 8 digital lines, programmable as input or outputs. An input line can be used to monitor the state of a switch while an output line can control an external device such as motor, solenoid, LED, relay, transistor, etc...

I soon needed more than eight lines. Looking into various BBC manuals I found out that the printer port could be physically re-routed to provide 8 extra I/O lines.

 Printer port re-routed

1998 BBC/Mac interface

Both Macs (prior to Blue and White G3s) and BBC micros use a serial communication protocol based on the RS232 standard. It is possible to transfer data between the two machines.
using this protocol. First you need to make a cable.

Mac serial connector
(modem or printer):

Pin Name Description
1 HSKo Output Handshake
2 HSKi/CLK Input Handshake or External Clock
3 TXD- Transmit Data (-)
4 GND Ground (centre pin)
5 RXD- Receive Data (-)
6 TXD+ Transmit Data (+)
7 GPi General Purpose Input
8 RXD+ Receive Data (+)

BBC RS423 serial connector
(looking at computer):




There are more connections on the Mac side. Three will be ignored, in my experience without inconvenient.

BBC to Mac serial cable

BBC Mac
0v pin 4
data IN pin 3
data OUT pin 5
CTS pin 1
RTS pin 2

The symetrical design of the connector on the BBC micro is confusing. Mark the top of the cable connector to avoid trouble.  

BBC BASIC program


Two procedures will handle the BASIC RS423 exchange

100 DEF PROCout
110 *FX8,7 REM 9600 Baud transmit
120 A%=138:X%=2:Y%=B REM insert variable B into RS423 out buffer
130 CALL &FFF4
140 ENDPROC

B is the value of the ASCII character to be sent to the Mac

200 DEF PROCin
210 *FX2,1 REM gets characters from the RS423 port
220 *FX7,7 REM 9600 baud receive
230 *FX145,1 REM gets character from RS423 buffer
240 M=GET
250 ENDPROC

M is the ASCII value of a character sent by the Mac

*FX2,0 will enable keyboard input on the BBC

Mac program

On the Mac you will need a program that can handle RS423 connection. Find lots of details about that at

http://www.mindspring.com/~jc1/serial/main.html

a site dedicated to serial communication on the Mac. A C program would do fine, or a shareware such as Z Term should also cover most needs.
I use for my purposes Macromedia Director, that comes with a serial port XObject (up to version 6). Director is not the ideal program to handle transfer of text files, but is great for controlling sounds and graphics triggered from BBC run home made interfaces.

Director Serial control Lingo code


on initSerial
global gPort
put SerialPort(mNew,1) into gPort
gPort(mSetUp, 9600, 10, 0)
end

on writeChar
global gPort, macCharOut
gPort(mWriteChar, macCharOut)
end

on writeString
global gPort, macStringOut
gPort(mWriteString, macStringOut)
end

on readChar
global gPort, bbcCharOut
put gPort(mReadChar) into bbcCharOut
end

on readString
global gPort, bbcStringOut
put gPort(mReadString) into bbcStringOut
end