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

8XC196Kx, Jx, CA USER’S MANUAL

Table 16-15. RISM Command Descriptions (Continued)

Value

Command

 

 

 

 

 

Description

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0AH

DATA_TO_ADDR

Puts the low word of the DATA register into the ADDR register.

 

 

 

 

 

 

 

ADDR

 

 

DATA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Before command

 

 

 

F1

05

 

22

16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After command

 

22

16

 

F1

05

 

22

16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0BH

INDIRECT

Puts the word from the memory address pointed to by the ADDR register into the

 

 

ADDR register.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Memory Addr.

 

 

 

 

ADDR

 

 

 

 

 

2217

2216

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Before command

22

16

 

 

 

 

 

 

 

 

80

09

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After command

 

80

09

 

 

 

 

 

 

 

 

80

09

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

12H

GO

PUSHes the user PC, PSW, and WSR onto the stack and starts your program

 

 

from the location contained in the user PC. The RISM PC, PSW, and WSR will

 

 

also be in the stack, so allow enough room on the stack for all six words. Your

 

 

program must not directly alter memory locations 56H–5CH; the RISM uses these

 

 

locations if your program reads from or writes to any memory.

 

 

 

 

 

You can interrogate memory locations while your program is running. The RISM

 

 

interrupts your program to process the command, then returns execution to your

 

 

program.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

13H

HALT

Stops executing your program, POPs the user PC, PSW, and WSR from the

 

 

stack, and PUSHes the RISM PC, PSW, and WSR back onto the stack. The RISM

 

 

PC contains the location of the Monitor_Pause routine, so the RISM returns to

 

 

Monitor_Pause.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

14H

REPORT

Loads a value into the DATA register. This value indicates the status of your

 

 

program:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Value

Status

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

halted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

01

running

 

 

 

 

 

 

 

 

 

 

 

 

 

02trapped

16.10.6RISM Command Examples

This section provides examples of ways in which you might use the RISM commands.

16-38

PROGRAMMING THE NONVOLATILE MEMORY

16.10.6.1Example 1 — Programming the PPW

You should specify the programming pulse width before you do any programming or write to any memory locations. This example assumes an 87C196KT device. It loads the SP_PPW register (221CH/221DH) with 8010H, the minimum value for 16-MHz operation. (See “Programming Pulse Width” on page 16-8 to determine the correct PPW for other frequencies.)

Before this programming step takes place, the SP_PPW register contains its default value, 80FFH. The PPW is equal to 2.30 ms, so this program step will take 11.52 ms per word to complete (5 pulses of 2.30ms each). After the PPW value is changed, subsequent programming operations will take only 500 µs per word (5 pulses of 100 µs each).

Because an OTPROM location is being altered, VPP must be at +12.5 volts. RISM commands must be sent across the serial port one byte at a time, and a SET_DLE_FLAG command must precede any data byte that is less than 1FH. The address being modified must first be loaded into the DATA register, then transferred to the ADDR register.

Send

Comments (Example 1)

 

DATA

 

 

ADDR

 

 

 

 

 

 

 

 

 

22

Data. High byte of address to DATA register.

 

 

 

22

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. The next data byte is < 1FH.

 

 

 

22

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1C

Data. Low byte of address to DATA register.

 

 

22

1C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0A

DATA_TO_ADDR. Move address to ADDR.

 

 

22

1C

 

22

1C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

80

Data. High byte of data to DATA register.

 

22

1C

80

 

22

1C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. The next data byte is < 1FH.

 

22

1C

80

 

22

1C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10

Data. Low byte of data to DATA register.

22

1C

80

10

 

22

1C

 

 

 

 

 

 

 

 

 

08WRITE_WORD. Low word of DATA to memory location 221C (contents of ADDR). Increment ADDR by two.

 

 

22

 

1C

80

 

10

 

22

1C

 

 

 

 

 

 

 

 

 

 

 

 

Memory Addresses

 

 

 

 

 

 

221D

221C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

80

 

10

 

 

22

1E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any write operation can be done in this manner.

16-39

8XC196Kx, Jx, CA USER’S MANUAL

16.10.6.2Example 2 — Reading OTPROM Contents

This example reads the contents of OTPROM address A080H. Because the OTPROM is remapped from 2000H to A000H, the location read is actually 2080H of the program in OTPROM. This example assumes that the word at location 2080H is 8067H, the assembled hex value of the code. No OTPROM locations are changed, so VPP can be either +12.5 volts or +5 volts.

Send

Comments (Example 2)

DATA

A0 Data. High byte of address to DATA register.

80 Data. Low byte of address to DATA register.

0A DATA_TO_ADDR. Move address to DATA register.

05 READ_WORD. Put word at A080H into DATA.

02TRANSMIT. Transmit low byte of DATA across the serial port, increment ADDR by one, and shift DATA right long by eight bits.

02TRANSMIT. Transmit low byte of DATA across the serial port, increment ADDR by one, and shift DATA right long by eight bits.

 

 

 

A0

 

 

 

 

 

 

 

 

 

 

A0

80

 

 

 

 

 

 

 

 

 

 

A0

80

 

 

 

 

 

 

 

 

A0

80

80

67

 

 

 

 

00 A0 80 80

00 00 A0 80

ADDR

A0 80

A0 80

A0 81

A0 82

Any address can be read in this manner, including register RAM, internal RAM, and SFRs.

16.10.6.3Example 3 — Loading a Program into Internal RAM

This example loads a program into internal RAM. No OTPROM locations are changed, so VPP can be either +12.5 volts or +5 volts. The following program is to be loaded:

400 A1221180 LD 80H, #1122H ;Puts 1122H into register RAM location 80H 404 27FE SJMP 0404H ;Jumps to itself to keep program running

;indefinitely

The hex file must be loaded one byte at a time using the RISM commands.

16-40

PROGRAMMING THE NONVOLATILE MEMORY

Send

Comments (Example 3)

 

DATA

 

 

ADDR

00

SET_DLE_FLAG. Next data byte is < 1FH.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

04

Data. High byte of address 0400H.

 

 

 

04

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. Next data byte is < 1FH.

 

 

 

04

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

Data. Low byte of address 0400H.

 

 

04

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0A

DATA_TO_ADDR. Move address to ADDR.

 

 

04

00

 

04

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A1

Data. High byte of hex file for location 0401H.

 

04

00

A1

 

04

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

22

Data. Low byte of hex file for location 0400H.

04

00

A1

22

 

04

00

 

 

 

 

 

 

 

 

 

08WRITE_WORD. Low word of DATA to memory location 0400 (contents of ADDR). Increment ADDR by two.

 

 

04

 

00

A1

 

22

 

04

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Memory Addresses

 

 

 

 

 

 

0401

0400

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A1

 

22

 

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. Next data byte is < 1FH.

04

 

00

A1

 

22

 

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11

Data. High byte of hex file for location 0403H.

00

 

A1

22

 

11

 

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. Next data byte is < 1FH.

00

 

A1

22

 

11

 

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

80

Data. Low byte of hex file for location 0402H.

 

A1

 

22

11

 

80

 

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

 

08WRITE_WORD. Low word of DATA to memory location 0402 (contents of ADDR). Increment ADDR by two.

 

 

A1

 

22

11

 

80

 

04

02

 

 

 

 

 

 

 

 

 

 

 

 

Memory Addresses

 

 

 

 

 

0403

0402

 

 

 

 

 

 

 

11

 

80

 

 

04

04

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

16-41

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