Professional Documents
Culture Documents
EE 308 Apr. 1, 2002
EE 308 Apr. 1, 2002
EE 308 Apr. 1, 2002
EE 308
MICROPROCESSOR
MEMORY
CONTROL
INSTRUCTION & ADDR
DATA
1
IN
ALU CONTROL
OUT CONTROL
STATUS CLOCK
Apr. 1, 2002
EE 308 Apr. 1, 2002
ADDR(N Bits)
DATA(M Bits)
COMPUTER MEMORY
CONTROL
2
EE 308 Apr. 1, 2002
ADDR(16)
DATA(16)
HC12 MEMORY
E
R/W
LSTRB
3
EE 308 Apr. 1, 2002
org 0x2000
4
The HC12 address, data and control buses (simplified)
EE 308
Note: The following diagram assumes that the HC12 accesses one byte at a time
The HC12 actually accesses two bytes (16 bits) at a time, when it can
What actually occurs on the HC12 bus is a little more complicated than what is shown below
5
ADDR 2000
DATA 72 04 00 A3 00 A4 20 FB 00 72
R/W
The HC12 has address regions occupied by internal memory and peripherals
A diagram showing which address regions are used is called a memory map
Here is a memory map of the HC12B32 with no added memory or peripherals
0x0000
REGISTERS
0x03FF
0x0800
RAM
0x0BFF
0x0D00
EEPROM
0x0FFF
0x8000
FLASH
EEPROM
0xFFFF
6
EE 308 Apr. 1, 2002
0x0000
REGISTERS
0x03FF
0x0400 Use address 0x0400−0x0402
0x0402 for External Peripherals
0x0800
RAM
0x0BFF
0x0D00
EEPROM
0x0FFF
0x1000
Use address 0x1000−0x7FFF
for External RAM
EXTERNAL
RAM
0x7FFF
0x8000
FLASH
EEPROM
0xFFFF
7
EE 308 Apr. 1, 2002
ADDR(16)
DATA(16)
HC12 MEMORY
R/W
E
LSTRB
R/W
ADDR 0x3456
DATA 0xfedc
8
EE 308 Apr. 1, 2002
When the HC12 reads data from memory it does the following:
– It puts the address it wants to read from on the address bus (when E-clock
goes low)
– It brings the Read/Write (
) line high to indicate a read
– The HC12 expects the external device at the given address will put data
on the data bus
– On the falling edge of the E-clock, the HC12 latches the data into its
internal registerl
ADDR(16)
DATA(16)
HC12 MEMORY
R/W
E
LSTRB
R/W
ADDR 0x5678
DATA 0xba98
9
EE 308 Apr. 1, 2002
10
EE 308 Apr. 1, 2002
R/W
E
HC12
LSTRB
11
EE 308 Apr. 1, 2002
ADDR(16)
DATA(16)
HC12 MEMORY
R/W
E
LSTRB
Requires 35 bits
Not enough pins on HC12 to allocate 35 pins
for buses and pins for all other functions
12
EE 308 Apr. 1, 2002
ADDR(16)
WE − Write Enable
OE − Output Enable (Read)
DATA(16)
CS − Chip Select
MEMORY
WE HBE − High Byte Enable
OE LBE − Low Byte Enable
CS
HBE
LBE
13
The Multiplexed Address/Data Bus
EE 308
To talk to memory chip we will need to build a demultiplexer between the HC12 and the memory chip
DATA/ADDR (16)
OE − Output Enable (Read)
MEMORY WE − Write Enable
DEMUX ADDR(16) CE − Chip Enable
HC12
R/W OE UB − Upper Byte Enable
E WE LB − Lower Byte Enable
LSTRB CS
UB
14
LB
Requires 35 bits