MERCIA has a number of I/O devices, namely a:
- 10-bit binary to 3 digit 7-segment decoder;
- 10-digit 7-segment display;
- 4-digit multifunctional hexadecimal keyboard;
- 10-bit digital input and 10-bit digital output interface;
- optical paper tape reader.
They will be explained below.
Binary to 7-segment convertor
In order to show numbers on a 7-segment display, those numbers must be represented in a BCD (Binary Coded Decimal) format. Then each BCD digit can be converted to a 7-segment display code. The conversion of a binary number to a BCD format is done by the shift and add-3 algorithm, also known as the double dabble algorithm.
This conversion can be done by the ALU, but would be very time consuming because two 10-bit words are involved in the conversion. Therefore I choose a hardware implementation. A good description for this hardware implementation can be found here: http://www.johnloomis.org/ece314/notes/devices/binary_to_BCD/bin_to_bcd.html
A diagram that shows the principle of this hardware implementation, is shown below.
The shift and add three algorithm is implemented in hardware through the wiring (shifting) and the use of adders (add three).
The input of this special adder contains four bit (a-d), also the output has four bit (e-h). The transformation logic functions to convert the input to the output and add 3 when larger than 4, are given below. h := d OR (c AND (b OR a)) g := (d AND a) OR (c AND NOT (b OR a)) f := (d AND NOT a) OR (b AND a) OR (b AND NOT c) e := a XOR h The truth table for this special add function is shown to the right. |
This Binary to BCD convertor is part of the entire unit that also contains a BCD to 7-segment code convertor. The complete convertor offers the following functionality:
1. Convert a 10-bit binary number to three BCD numbers.
2. Convert a 10-bit binary number to three hexadecimal codes.
3. Convert a 4-bit BCD number to a 7-bit 7-segment display number.
4. Convert a binary number to a 7-bit 7-segment hexadecimal code.
The complete converter is located on the instruction decoder panel and shown below left. Below right is the relay implementation of the special add 3 adder. Since the adder must only be able to add three when the value is larger than four, it can be implemented with the limited number of 7 relays.
10-digit 7-segment display
MERCIA has a ten digit 7-segment display to display messages to the user. For development purposes, a special 7-segment font has been created. It is the most extensive 7-segment font available and can be downloaded here. This MmERCIA font has the following characters.
Some characters are created using two characters.
The seven segments are coded using bits 0-7 from a MERCIA word, as shown above. Since only eight bits are used, the I/O memory for the display contains only eight bits, saving 20 relays. A description of the relay I/O memory can be found here: Memory. The digits are mapped on the memory as shown in the following table.
Device |
Nº |
Address |
Function |
I/O |
Bits |
Relay's |
00 |
1 |
0 000 000 000 |
Display left digit |
Out |
8 |
18 |
|
2 |
0 000 000 001 |
Digit 9 |
Out |
8 |
18 |
|
3 |
0 000 000 010 |
Digit 8 |
Out |
8 |
18 |
|
4 |
0 000 000 011 |
Digit 7 |
Out |
8 |
18 |
|
5 |
0 000 000 100 |
Digit 6 |
Out |
8 |
18 |
|
6 |
0 000 000 101 |
Digit 5 |
Out |
8 |
18 |
|
7 |
0 000 000 110 |
Digit 4 |
Out |
8 |
18 |
|
8 |
0 000 000 111 |
Digit 3 |
Out |
8 |
18 |
|
9 |
0 000 001 000 |
Digit 2 |
Out |
8 |
18 |
|
10 |
0 000 001 001 |
Display right digit |
Out |
8 |
18 |
Three commands are used to control the display, as shown in the next table.
Device |
I/O code |
Operand |
Task |
Meaning |
Display |
00 |
x |
xx1 |
Display on |
|
00 |
x |
x1x |
Clear display |
|
00 |
x |
1x0 |
Display off |
The display can be set on by connecting all the segments of the display to the ground. It can be set off by breaking this ground connection. The clear command will reset all memory relays, using a special clear line as shown in the Memory section. Clearing individual displays can be done by writing a zero to the related memory word. Those three commands are implemented by the following relay circuit diagram.
Hexadecimal keyboard
Not yet avalaible.
Digital I/O
Not yet avalaible.
Optical tape reader
Not yet avalaible.
April 2017, Jeroen Brinkman