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

8XC196Kx, Jx, CA USER’S MANUAL

Send

Comments (Example 3)

 

DATA

 

 

ADDR

 

 

 

 

 

 

 

 

 

27

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

22

11

80

27

 

04

04

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FE

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

11

80

27

FE

 

04

04

 

 

 

 

 

 

 

 

 

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

11 80 27 FE

Memory Addresses

0405 0404

27 FE

04 04

04 06

16.10.6.4Example 4 — Setting the PC and Executing the Program

This example sets the PC and begins executing the program loaded in example 3. The PC (at location 5EH) must be set at 400H to tell the RISM where to begin execution of the program. The WSR and PSW are automatically set to their default values (1000H and 200H, respectively), but can be changed in this same manner. No OTPROM locations are changed, so VPP can be either +12.5 volts or +5 volts.

.

Send

Comments (Example 4)

 

DATA

 

 

ADDR

00

SET_DLE_FLAG. Next data byte is < 1FH.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

Data. High byte of PC address 005EH.

 

 

 

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5E

Data. Low byte of PC address 005EH.

 

 

00

5E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0A

DATA_TO_ADDR. Move address to ADDR.

 

 

00

5E

 

00

5E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. Next data byte is < 1FH.

 

 

00

5E

 

00

5E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

04

Data. High byte of program address 0400H.

 

00

5E

04

 

00

5E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

SET_DLE_FLAG. Next data byte is < 1FH.

 

00

5E

04

 

00

5E

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

Data. Low byte of program address 0400H.

00

5E

04

00

 

00

5E

 

 

 

 

 

 

 

 

 

16-42

PROGRAMMING THE NONVOLATILE MEMORY

Send

Comments (Example 4)

DATA

ADDR

08WRITE_WORD. Low word of DATA to PC location 005EH (contents of ADDR). Increment ADDR by two.

00 5E 04 00

Memory Addresses

005F 005E

04 00

00 5E

00 60

12GO. PUSHes the user PC onto the stack and begins program execution at 0400H. (Had they been changed, GO would also PUSH the PSW and WSR.)

00

5E

04

00

 

00

60

 

 

 

 

 

 

 

You can now interrogate memory locations using RISM commands. Reading location 80H using the method shown in example 2 will return 1122H (the value that the executing program loaded into that location). A REPORT command (14H) will place “01” into the DATA register, indicating that a program is running. A HALT command (13H) will stop execution of the program. The PC will be reset to the Monitor_Pause location. At this point, a REPORT command (14H) will place “00” into the DATA register, indicating that the program is halted.

16.10.6.5Writing to OTPROM with Examples 3 and 4

If a program writes to OTPROM or if it is to be loaded into an OTPROM location, +12.5 volts must be applied to VPP. There are other considerations, as well.

Assume that the program in examples 3 and 4 attempted to write OTPROM location A500H with the value 1122H. Changing the contents of location A500H alters any code programmed at 2500H because that location has been remapped to A500H. Any bits at 2500H that are zero cannot be changed to one.

Assume that the program is loaded into OTPROM locations A000–A004H. Changing the contents of those locations alters any code programmed at 2000–2004H beca use those locations have been remapped to A000–A004H. Any bits in those locations that are zero cannot be changed to one, so you may get unexpected results. (Internal RAM can always be altered to any value.)

16-43

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