Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
67
RECORD TYPE COMMAND/DATA FUNCTION
03 Miscellaneous Write Functions
:nnxxxx03ffssddcc
Where:
nn = number of bytes (hex) in record
xxxx = required field, but value is a “don’t care”
03 = Write Function
ff = subfunction code
ss = selection code
dd = data input (as needed)
cc = checksum
Subfunction Code = 01 (Erase Blocks)
ff = 01
ss = block code as shown below:
block 0, 0k to 8k, 00H
block 1, 8k to 16k, 20H
block 2, 16k to 32k, 40H
block 3, 32k to 48k, 80H
block 4, 48k to 64k, C0H
Example:
:0200000301C03C erase block 4
Subfunction Code = 04 (Erase Boot Vector and Status Byte)
ff = 04
ss = don’t care
Example:
:020000030400F7 erase boot vector and status byte
Subfunction Code = 05 (Program Security Bits)
ff = 05
ss = 00 program security bit 1 (inhibit writing to Flash)
01 program security bit 2 (inhibit Flash verify)
02 program security bit 3 (disable external memory)
Example:
:020000030501F5 program security bit 2
Subfunction Code = 06 (Program Status Byte or Boot Vector)
ff = 06
ss = 00 program status byte
01 program boot vector
Example:
:030000030601FCF7 program boot vector with 0FCH
Subfunction Code = 07 (Full Chip Erase)
Erases all blocks, security bits, and sets status and boot vector to default values
ff = 07
ss = don’t care
dd = don’t care
Example:
:0100000307F5 full chip erase
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. Data to the serial port is
initiated by the reception of any character and 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
Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
68
RECORD TYPE COMMAND/DATA FUNCTION
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 signature byte – manufacturer id (15H)
0001 = read signature byte – device id # 1 (C2H)
0002 = read signature byte – device id # 2
0700 = read security bits
0701 = read status byte
0702 = read boot vector
cc = checksum
Example:
:020000050001F8 read signature byte – device id # 1
06 Direct Load of Baud Rate
General Format of Function 06
:02xxxx06hhllcc
Where:
02 = number of bytes (hex) in record
xxxx = required field, but value is a “don’t care”
06 = ”Direct Load of Baud Rate” function code
hh = high byte of Timer 2
ll = low byte of Timer 2
cc = checksum
Example:
:02000006F500F3
Philips Semiconductors Product data
P89C660/P89C662/P89C664/
P89C668
80C51 8-bit Flash microcontroller family
16KB/32KB/64KB ISP/IAP Flash with 512B/1KB/2KB/8KB RAM
2002 Oct 28
69
In Application Programming Method
Several In Application Programming (IAP) calls are available for use
by an application program to permit selective erasing and
programming of Flash sectors. 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. The oscillator frequency is an integer number
rounded down to the nearest megahertz. For example, set R0 to 11
for 11.0592 MHz. Results are returned in the registers. The IAP calls
are shown in Table 15.
Using the Watchdog Timer (WDT)
The 89C66x devices support the use of the WDT in IAP. The user
specifies that the WDT is to be fed by setting the most significant bit
of the function parameter passed in R1 prior to calling PGM_MTP.
The WDT function is only supported for Block Erase when using the
Quick Block Erase. The Quick Block Erase is specified by
performing a Block Erase with register R0 = 0. Requesting a WDT
feed during IAP should only be performed in applications that use
the WDT since the process of feeding the WDT will start the WDT if
the WDT was not working.
Table 15. IAP calls
IAP CALL PARAMETER
PROGRAM DATA BYTE Input Parameters:
R0 = osc freq (integer)
R1 = 02h
R1 = 82h (WDT feed, Rx2 & 66x only)
DPTR = address of byte to program
ACC = byte to program
Return Parameter
ACC = 00 if pass, !00 if fail
Sample routine:
;***** Program Device Data (DData) *****
;***** ACC holds data to write
;***** DPTR holds address of byte to write *****
;***** Returns with ACC = 00h if successful, else ACC NEQ 00h
WRData:
MOV AUXR1,#20H ;set the ENBOOT bit
MOV R0, #11 ;FOSC
MOV R1,#02H ;program data function
MOV A,Mydata ;data to write
MOV DPTR,Address ;specify address of byte to read
CALL PGM_MTP ;execute the function
RET
ERASE BLOCK Input Parameters:
R0 = osc freq (integer)
R0 = 0 (QUICK ERASE, Rx2 & 66x only)
R1 = 01h
R1 = 81h (WDT feed, Rx2 & 66x only; can only be used with Quick Erase)
DPH = block code as shown below:
block 0, 0k to 8k, 00H
block 1, 8k to 16k, 20H
block 2, 16k to 32k, 40H
block 3, 32k to 48k, 80H
block 4, 48k to 64k, C0H
DPL = 00h
Return Parameter
none
Sample routine:
;***** Erase Code Memory Block *****
;***** DPH (7:5) indicates which of the 5 blocks to erase
;***** DPTR values for the blocks are:
; 0000h = block 0
; 2000h = block 1
; 4000h = block 2
; 8000h = block 3
; C000h = block 4
ERSBLK:
MOV AUXR1,#20H ;set the ENBOOT bit
MOV R0, #11 ;FOSC
MOV R1,#01H ;erase block
MOV DPTR,#BLk_NUM ;specify which block
CALL PGM_MTP ;execute the function
RET

P89C662HBA/00,512

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC MCU 8BIT 32KB FLASH 44PLCC
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union