26
External peripherals on the system bus
External peripherals can be connected in a simple way to the module, thanks to the fact that the data bus, two
bits of the address bus and universal SELx outputs were put out of the module. In the simplest case the SEL
outputs will be used directly as the write/read strobe which will allow to locate two registers in the address
space, without using additional address decoders. Such a case is depicted in the figure below.
+5V
GND
AD1
AD5
AD7
AD3
AD6
AD0
AD2
AD4
+5V
GND
+5V
SEL1
SEL2
GND
IN0
IN1
IN2
IN3
IN4
IN5
IN6
IN7
OUT0
OUT1
OUT2
OUT3
OUT4
OUT5
OUT6
OUT7
DIR
1
A0
2
A1
3
A2
4
A3
5
A4
6
A5
7
A6
8
A7
9
GND
10
OE
19
Q7
11
B6
12
B5
13
B4
14
B3
15
B2
16
B1
17
B0
18
VCC
20
74HCT245
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
OE
1
D0
2
D1
3
D2
4
D3
5
D4
6
D5
7
D6
8
D7
9
GND
10
CP
11
Q7
12
Q6
13
Q5
14
Q4
15
Q3
16
Q2
17
Q1
18
Q0
19
VCC
20
74HCT574
Figure 20
An example of using the SEL output and a write/read strobe.
The configuration and write/read methods of registers such connected looks like this:
MMnet102_CONF = 0b00100001; // SEL2 – read strobe, active low,
// SEL1 – write strobe, active high,
// memory decoder mode 1
MMnet102_SEL1 = output_value; // write to output register
input_value = MMnet102_SEL2; // read from input register
If a greater number of external I/O circuits are required, the SEL terminals can be used as address selection
outputs. After connecting additional address decoders, e.g. 74HCT138, the number of registers possible to be
addressed is increased to 4 output and 4 input registers. The configuration and write/read of registers may
look like this:
MMnet102_CONF = 0b00100001; // SEL2 – address decoder, active low,
// SEL1 – address decoder, active low,
// memory decoder mode 1
MMnet102_SEL1_0 = output_value_0;
// write to output register 0
MMnet102_SEL1_1 = output_value_1;
// write to output register 1
MMnet102_SEL1_2 = output_value_2;
// write to output register 2
MMnet102_SEL1_3 = output_value_3;
// write to output register 3