The serial interface from a programmer's view
The PDP-11/05 has a serial interface compatible with the KL11/DL11 standard.
Here is one excellent additional documentation about a DL11 card.
And this is the register interface in the UNIBUS I/O page, as described in the PDP-11/20 documentation. At 1972, the nomenclature is very paper-tape orientated. Simply translate "Reader" as "Receiver" and "Punch" as "Transmitter".
Register name |
Address |
Register bits |
||||||||||||
15-12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
||
TKS = Reader status register |
177560 |
|
RCVR BUSY |
|
|
|
RCVR DONE |
RCVR INT ENB |
|
|
|
|
|
RDR ENB |
TKB = Reader buffer register |
177562 |
|
|
|
|
|
RECEIVED DATA BITS |
|||||||
TPS = Punch status register |
177564 |
|
|
|
|
|
XMT RDY |
XMIT INT ENB |
|
|
|
MAINT |
|
|
TPB = Punch buffer register |
177566 |
|
|
|
|
|
TRANSMITTER DATA BUFFER |
Name of bits/datafields:
Name of bit field |
Function |
r/w |
RCVR BUSY |
1 between the start and the stop bit of an incoming character |
read-only |
RCVR DONE |
1, if an entire character has been received. Starts interrupt if receiver interrupt enable bit is set. |
read-only |
RCVR INT ENB |
receiver interrupt enable bit |
r/w |
RECEIVED DATA BITS |
these bits contain the character just read |
read-only |
XMT RDY |
Transmitter ready. Cleared when transmit buffer is loaded, set when transmit buffer can accept another character. Will start interrupt if transmitter interrupt is enabled. |
read-only |
XMIT INT ENB |
Transmitter interrupt enable. |
r/w |
MAINT |
Maintenance. When set, the serial line input is connected internally to the serial line output for loopback tests. |
r/w |
TRANSMITTER DATA BUFFER |
A write will start transmission of a character |
write-only |
For interrupts, the vector is 000060 for the Reader part, and 000064 for the Punch part. Priority level is BR4.
Serial protocol parameters?
Well, we talked already about the baudrate ... but what about bit length, parity, stop bits?
On other DL11 boards, these values can be set over jumpers. But on the PDP-11/05, there is no choice. The UART is hard wired to 8bit, no parity, 2 stop bits ... the format of paper tapes.
Testprogram #1: "Hello, world"
This programs uses and tests only the transmitter.
You have to toggle it in over the blinkenlight console. In the attachement file "hello.blinkenlight_instruction.txt" you find the detailed word-for-word procedure how to enter this program.
Good news: if you have core memory, you have to do this only once.
Start address is 2000.
1 2 .title Hello world program 3 4 ; This program prints "Hello, world" 5 ; (or any other string) on the serial console at 177650. 6 ; Then it HALTs. 7 ; On CONT, it repeats. 8 9 .asect 10 11 177560 serial = 177560 ; base addr of DL11 12 13 14 002000 .=2000 15 16 start: 17 002000 012702 177564 mov #serial+4,r2 ; r0 points to DL11 transmitter section 18 002004 012701 002032 mov #string,r1 ; r1 points to the current character 19 nxtchr: 20 002010 112100 movb (r1)+,r0 ; load xmt char 21 002012 001405 beq done ; string is terminated with 0 22 23 002014 110062 000002 movb r0,2(r2) ; write char to transmit buffer 24 002020 105712 wait: tstb (r2) ; character transmitted? 25 002022 100376 bpl wait ; no, loop 26 002024 000771 br nxtchr ; transmit nxt char of string 27 28 002026 000000 done: halt 29 002030 000763 br start 30 31 string: 32 002032 110 145 154 .ascii /Hello, world/ ; arbitrary text 002035 154 157 054 002040 040 167 157 002043 162 154 144 33 002046 012 000 .byte 12,0 ; LF char, end marker 34 35 .end 35 |
Testprogram #2:
This program echoes back any character typed in. Thus it tests receiver and transmitter.
Start address is 1000, so it can coexist with the "Hello world" program above.
1 2 .title Console serial port 3 4 ; http://www.psych.usyd.edu.au/pdp-11/hints.html 5 ; Any DL-11 style serial port (including the console) can be simply 6 ; tested by depositing 060 (octal) into its 'transmitter buffer ', 7 ; 0777566 in the case of the console. A '0' should appear on the 8 ; console. If it is anything else, check the baud rate settings. 9 ; 10 ; To check the input register, press the '0', then examine the 11 ; receive register 0777562 and it should contain 060. 12 ; 13 ; Needles to say, if you are using any of the Qbus processors, 14 ; or a PDP11/24, /44, /84 or /94 then you need the serial console 15 ; working to do anything. 16 ; 17 ; As simple serial echo test would be:- 18 19 .asect 20 21 177560 kbs = 177560 22 23 24 001000 .=1000 25 26 start: 27 001000 012700 177560 mov #kbs, r0 28 29 001004 105710 wait: tstb (r0) ; character received? 30 001006 100376 bpl wait ; no, loop 31 001010 016060 000002 000006 mov 2(r0),6(r0) ; transmit data 32 33 001016 000772 br wait ; get next character 34 35 ; Note:- PDP11 guru's will notice that I don't test for 36 ; transmitter ready, as there is little point given that you 37 ; cannot type fast enough for it to overrun! 37 |