In-application programming method – Rainbow Electronics AT89C5131 User Manual

Page 45

Advertising
background image

45

AT89C5131

4136A–USB–03/03

In-application
Programming Method

Several Application Program Interface (API) calls are available for use by an application
program to permit selective erasing and programming of Flash pages. All calls are made
through a common interface, PGM_MTP. The programming functions are selected by
setting up the microcontroller’s registers before making a call to PGM_MTP at FFF0h.
Results are returned in the registers. The API calls are shown in Table 41.

A set of Philips compatible API calls is provided.

When several bytes have to be programmed, it is highly recommended to use the Atmel
API “PROGRAM DATA PAGE” call. Indeed, this API call writes up to 128 bytes in a sin-
gle command.

04

Display Device Data or Blank Check

Record type 04 causes the contents of the entire Flash array to be sent out the serial
port in a formatted display. This display consists of an address and the contents of 16
bytes starting with that address. No display of the device contents will occur if security
bit 2 has been programmed. The dumping of the device data to the serial port is
terminated by the reception of any character.

General Format of Function 04

:05xxxx04sssseeeeffcc

Where:

05 = number of bytes (hex) in record

xxxx = required field, but value is a “don’t care”

04 = “Display Device Data or Blank Check” function code

ssss = starting address

eeee = ending address

ff = subfunction

00 = display data

01 = blank check

cc = checksum

Example:

:0500000440004FFF0069 (display 4000–4FFF)

05

Miscellaneous Read Functions

General Format of Function 05

:02xxxx05ffsscc

Where:

02 = number of bytes (hex) in record

xxxx = required field, but value is a “don’t care”

05 = “Miscellaneous Read” function code

ffss = subfunction and selection code

0000 = read copy of the signature byte – manufacturer id (58H)

0001 = read copy of the signature byte – device ID# 1 (Family code)

0002 = read copy of the signature byte – device ID # 2 (Memories size and type)

0003 = read copy of the signature byte – device ID # 3 (Product name and revision)

0700 = read the software security bits

0701 = read BSB

0702 = read SBV

0704 = read HSB

cc = checksum

Example:

:020000050001F0 read copy of the signature byte – device id # 1

Table 40. Intel-Hex Records Used by In-System Programming (Continued)

Record Type

Command/Data Function

Advertising