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

8XC196Kx, Jx, CA USER’S MANUAL

16.8.4 Slave Programming Routines

The slave programming mode algorithm consists of three routines: the address/command decoding routine, the program word routine, and the dump word routine.

The address/command decoding routine (Figure 16-7) reads the PBUS and transfers control to the program word or dump word routine based on the value of P3.0. A one on P3.0 selects the program word command and the remaining bits specify the address. For example, a PBUS value of 3501H programs a word of data at location 3500H. A zero on P3.0 selects the dump word command and the remaining bits specify the address. For example, a PBUS value of 3500H places the word at location 3500H on the PBUS.

The program word routine (Figure 16-8) checks the CCB security-lock bits. If either security lock bit (CCB0.6 or CCB0.7) has been programmed, you must provide a matching security key to gain access to the device. Using the program word command, write eight consecutive words to the device, starting at location 2020H and continuing to 202FH. The routine stores these eight words in an internal register and compares their value with the internal key. If the keys match, the routine allows you to program individual or sequential OTPROM locations; otherwise, the device enters an endless loop.

The dump word routine (Figure 16-10) also checks the CCB security-lock bits, but it has no provision for security key verification. If the lock bits are unprogrammed, the routine fetches a word of data from the OTPROM and writes that data to the PBUS. If either lock bit is programmed, the routine performs a write cycle without first getting data from the OTPROM.

16-20

PROGRAMMING THE NONVOLATILE MEMORY

 

 

Other

 

No

 

PMODE = 05H

 

 

Modes

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

 

 

 

No

 

PALE#

 

 

 

 

 

 

(P2.1) = 0

 

 

 

 

 

?

 

 

 

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Read Data

 

 

 

 

 

 

From PBUS

 

 

 

 

 

 

 

 

 

 

No

 

PVER

Deassert CPVER

 

 

Assert PVER

 

 

 

(P2.0) = 1

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

PALE# Yes (P2.1)= 0

?

No

Check Address

Dump Word

No

P3.0 = 1

Routine

 

 

?

 

 

Yes

 

 

Program Word

 

 

Routine

A0193-02

Figure 16-7. Address/Command Decoding Routine

16-21

8XC196Kx, Jx, CA USER’S MANUAL

From Address/

Command Decoder

No

 

 

PROG#

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(P2.2)=0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Lock Bits

Yes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Read Data

 

 

 

 

 

 

 

 

 

Verify

 

 

 

 

 

 

 

 

 

 

from PBUS

 

 

 

 

 

 

Enabled

 

 

 

 

 

 

Security Key

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Execute Modified

Yes

 

 

 

Keys

 

 

 

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Loop

 

 

 

 

 

 

 

 

 

 

 

Quick-Pulse Algorithm

 

 

 

 

 

Match

 

 

 

 

 

 

Forever

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

then Return

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Programming

 

No

 

 

Deassert

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Verifies

 

 

 

 

 

PVER (P2.0 = 0)

 

 

 

 

 

 

 

 

 

 

Read

Data

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

from

PBUS

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Assert

 

 

 

PVER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(P2.0

 

 

= 1)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

PROG#

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(P2.2) = 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To Address/

 

 

PALE#

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Command Decoder

 

 

 

 

 

 

(P2.1) = 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AINC#

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(P2.4) = 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

 

 

 

 

No

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Increment

 

 

 

 

 

 

 

 

PVER

 

 

Deassert CPVER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Address by 2

 

 

 

 

 

 

 

 

(P2.0) = 1

 

 

 

 

 

 

Assert PVER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

A0194-03

Figure 16-8. Program Word Routine

16-22

PROGRAMMING THE NONVOLATILE MEMORY

Figure 16-9 shows the timings of the program word command with a repeated programming pulse and auto increment. Asserting PALE# latches the command and address on the PBUS. Asserting PROG# latches the data on the PBUS and starts the programming sequence. The PROG# signal controls the programming pulse width. (Slave programming mode does not use the PPW.) After the rising edge of PROG#, the routine verifies the contents of the location that was just programmed and asserts PVER to indicate successful programming. AINC# is optional and can automatically increment the address for the next location. If you do not use AINC#, you must send a new program word command to access the next word location.

RESET#

 

TDVPL

 

 

 

TAVLL

 

ADDR2

 

 

ADDR1

 

PBUS

ADDR/COMMAND

DATA1

 

DATA2

(Ports 3/4)

TSHLL

 

 

 

 

 

T

 

 

TLLAX

 

PLDX **

 

PALE#

 

 

 

TLLLH

 

 

 

 

TLHPL

 

 

 

 

TPLPH

TPHPL

TILPL

PROG#

 

 

 

*

 

 

Pulse 1

 

 

PVER

 

 

 

TILVH

 

 

TPHVL

*

 

 

 

 

AINC#

 

 

 

TILIH

 

 

 

 

TPHIL

*Additional program pulses and verifications.

**Measure from falling edge of last PROG# pulse in sequence.

A0121-01

Figure 16-9. Program Word Waveform

16-23

8XC196Kx, Jx, CA USER’S MANUAL

 

 

From Address/

 

 

 

Command Decoder

 

 

Yes

Lock Bits

 

 

 

Enabled

 

 

 

?

 

 

 

No

 

 

 

Get Data

 

 

 

from OPTROM

 

 

 

PROG#

No

 

 

(P2.2) = 0

 

 

 

?

 

 

 

Yes

 

 

 

Write Data

 

 

 

to PBUS

 

 

No

PROG#

 

 

 

(P2.2) = 1

 

 

 

?

 

 

 

Yes

 

 

 

Write 0FFFFH

 

 

 

to PBUS

 

To Address/

Yes

PALE#

 

Command Decoder

 

(P2.1) = 0

 

 

 

?

 

 

 

No

 

 

 

AINC#

No

 

 

(P2.4) = 0

 

 

 

?

 

 

 

Yes

 

 

 

Increment

 

 

 

Address by 2

 

A0189-03

Figure 16-10. Dump Word Routine

16-24

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