Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
70
Добавлен:
23.08.2013
Размер:
3.97 Mб
Скачать

MEMORY PARTITIONS

The following example initializes the top of the upper register file (8XC196CA, JT, JV, KS, KT) as the stack. (For the 8XC196JR or KR, the immediate value would be #200H; for the 8XC196JQ or KQ, it would be #180H.)

LD

SP, #400H

;Load stack pointer

The following example shows how to allow the linker locator to determine where the stack fits in the memory map that you specify.

LD SP, #STACK

4.1.7.3CPU Special-function Registers (SFRs)

Locations 0000–0017H in the lower register file are the CPU SFRs (Table 4-7). Appendix C describes the CPU SFRs.

Table 4-7. CPU SFRs

Address

High (Odd) Byte

Low (Even) Byte

 

 

 

0016H

Reserved

Reserved

0014H

Reserved

WSR

0012H

INT_MASK1

INT_PEND1

0010H

Reserved

Reserved

000EH

Reserved

Reserved

000CH

Reserved

Reserved

000AH

Reserved

WATCHDOG

0008H

INT_PEND

INT_MASK

0006H

PTSSRV (H)

PTSSRV (L)

0004H

PTSSEL (H)

PTSSEL (L)

0002H

ONES_REG (H)

ONES_REG (L)

0000H

ZERO_REG (H)

ZERO_REG (L)

NOTE

Using any SFR as a base or index register for indirect or indexed operations can cause unpredictable results. External events can change the contents of SFRs, and some SFRs are cleared when read. For this reason, consider the implications of using an SFR as an operand in a read-modify-write instruction (e.g., XORB).

4.2WINDOWING

Windowing expands the amount of memory that is accessible with register-direct addressing. Register-direct addressing can access the lower register file with short, fast-executing instructions. With windowing, register-direct addressing can also access the upper register file and peripheral SFRs.

4-13

8XC196Kx, Jx, CA USER’S MANUAL

Windowing maps a segment of higher memory (the upper register file or peripheral SFRs) into the lower register file. The window selection register (WSR) selects a 32-, 64-, or 128-byte segment of higher memory to be windowed into the top of the lower register file space. Figure 4-2 shows the upper register file of the 8XC196CA, JT, JV, KS, and KT devices. Please refer to Table 4-1 on page 4-2 for the upper register file addresses for other devices.

The 8XC196JV has additional register RAM in locations 1C00–1DFFH. Like the general-pur- pose register RAM in the upper register file, this register RAM can be windowed and is accessed directly, without the use of the memory controller.

128-byte Window

03FFH

 

(WSR = 17H)

0380H

 

Window in

00FFH

 

Lower Register File

0080H

 

A3060-01

Figure 4-2. Windowing

NOTE

Memory-mapped SFRs must be accessed using indirect or indexed addressing modes; they cannot be windowed. Reading a memory-mapped SFR through a window returns FFH (all ones). Writing to a memory-mapped SFR through a window has no effect.

4.2.1Selecting a Window

The window selection register (Figure 4-3) has two functions. The HLDEN bit (WSR.7) enables and disables the bus-hold protocol (see Chapter 15, “Interfacing with External Me mory”); it is unrelated to windowing. The remaining bits select a window to be mapped into the top of the lower register file.

4-14

MEMORY PARTITIONS

Table 4-8 on page 4-16 provides a quick reference of WSR values for windowing the peripheral SFRs. Table 4-9 on page 4-16 lists the WSR values for windowing the upper register file. Table 4-9 on page 4-16 lists the WSR values for windowing the additional register RAM of the 8XC196JV.

WSR

Address:

14H

 

Reset State:

00H

The window selection register (WSR) has two functions. One bit enables and disables the bus-hold protocol. The remaining bits select windows. Windows map sections of RAM into the upper section of the lower register file, in 32-, 64-, or 128-byte increments. PUSHA saves this register on the stack and POPA restores it.

 

7

 

 

 

 

 

 

 

 

 

 

 

 

 

0

CA, Jx

 

 

W6

 

 

W5

 

W4

 

W3

W2

 

W1

 

W0

 

 

7

 

 

 

 

 

 

 

 

 

 

 

 

 

0

Kx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

HLDEN

 

W6

 

 

W5

 

W4

 

W3

W2

 

W1

 

W0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

Bit

 

 

 

 

 

 

 

Function

 

 

 

 

 

Number

Mnemonic

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7

HLDEN

Hold Enable

 

 

 

 

 

 

 

 

 

 

 

 

 

This bit enables and disables the bus-hold protocol (see Chapter 15,

 

 

 

“Interfacing with External Memory”). It has no effect on windowing.

 

 

 

 

1

= bus-hold protocol enabled

 

 

 

 

 

 

 

 

 

 

0

= bus-hold protocol disabled

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6:0

W6:0

Window Selection

 

 

 

 

 

 

 

 

 

 

 

These bits specify the window size and window number:

 

 

 

 

 

 

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

1

x

x

x

x

x

x 32-byte window; W5:0 = window number

 

 

 

 

0

1

x

x

x

x

x 64-byte window; W4:0 = window number

 

 

 

 

0

0

1

x

x

x

x 128-byte window; W3:0 = window number

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

On the 8XC196CA, Jx devices this bit is reserved; always write as zero.

Figure 4-3. Window Selection Register (WSR)

4-15

8XC196Kx, Jx, CA USER’S MANUAL

Table 4-8. Selecting a Window of Peripheral SFRs

 

WSR Value for

WSR Value for

WSR Value for

Peripheral

32-byte Window

64-byte Window

128-byte Window

 

(00E0–00FFH)

(00C0–00FFH)

(0080–00FFH)

 

 

 

 

Ports 0, 1, 2, 6

7EH

3FH

 

A/D converter, EPA interrupts

7DH

3EH

1FH

EPA compare 0–1, capture/compare 8–9, timers

7CH

 

 

 

EPA capture/compare 0–7

7BH

3DH

1EH

CAN messages 14–15 (CA)

77H

3BH

 

CAN messages 12–13 (CA)

76H

1DH

 

CAN messages 10–11 (CA)

75H

3AH

 

CAN messages 8–9 (CA)

74H

 

 

 

CAN messages 6–7 (CA)

73H

39H

 

CAN messages 4–5, bit timing 1, interrupts (CA)

72H

1CH

 

CAN messages 2–3, bit timing 0 (CA)

71H

38H

 

CAN message 1, control, status, mask (CA)

70H

 

 

 

Table 4-9. Selecting a Window of the Upper Register File

Register RAM

WSR Value

WSR Value

WSR Value

for 32-byte Window

for 64-byte Window

for 128-byte Window

Locations

(00E0–00FFH)

(00C0–00FFH)

(0080–00FFH)

 

 

 

 

 

03E0–03FFH

5FH

2FH

 

03C0–03DFH

5EH

17H

 

03A0–03BFH

5DH

2EH

 

0380–039FH

5CH

 

 

 

0360–037FH

5BH

2DH

 

0340–035FH

5AH

16H

 

0320–033FH

59H

2CH

 

0300–031FH

58H

 

 

 

02E0–02FFH

57H

2BH

 

02C0–02DFH

56H

15H

 

02A0–02BFH

55H

2AH

 

0280–029FH

54H

 

 

 

0260–027FH

53H

29H

 

0240–025FH

52H

14H

 

0220–023FH

51H

28H

 

0200–021FH

50H

 

 

 

01E0–01FFH

4FH

27H

 

01C0–01DFH

4EH

13H

 

01A0–01BFH

4DH

26H

 

0180–019FH

4CH

 

 

 

4-16

Соседние файлы в предмете Электротехника