Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 487

Advertisement

STC8A8K64D4 Series Manual
*DataAddress = ISP_DATA;
EE_address++;
DataAddress++;
}while(--number);
DisableEEPROM();
EA = 1;
}
/******************** Sector Erase Function *****************/
//========================================================================
// Function: void EEPROM_SectorErase(u16 EE_address)
// Description: Erase the EEPROM sector at the specified address.
// Parameters:EE_address: The address of the sector EEPROM to be erased.
// Return: non.
// Version: V1.0, 2013-5-10
//========================================================================
void EEPROM_SectorErase(u16 EE_address)
{
EA = 0;
ISP_ADDRH = EE_address / 256;
when the address needs to be changed)
ISP_ADDRL = EE_address % 256;
ISP_CONTR = ISP_EN;
IAP_TPS = (u8)(MAIN_Fosc / 1000000L);
ISP_ERASE();
changed, it is not necessary to send the command again
ISP_TRIG();
_nop_();
_nop_();
_nop_();
DisableEEPROM();
EA = 1;
}
//========================================================================
// Function: void EEPROM_write_n(u16 EE_address,u8 *DataAddress,u16 number)
// Description: Write the buffered n bytes into the EEPROM of the specified first address.
// Parameters:EE_address: Write the first address of the EEPROM.
//
DataAddress: The first address of the buffer where the source data is written.
//
number:
The length of bytes written.
// Return: non.
// Version: V1.0, 2012-10-22
//========================================================================
void EEPROM_write_n(u16 EE_address,u8 *DataAddress,u16 number)
{
EA = 0;
ISP_CONTR = ISP_EN;
IAP_TPS = (u8)(MAIN_Fosc / 1000000L);
ISP_WRITE();
changed, no need to send the command again
do
{
ISP_ADDRH = EE_address / 256;
the address needs to be changed)
//Data be read
//re-enable interrupt
//Disable interrupts
//Only sector erase, no byte erase, 512 bytes per sector.
//Any byte address in a sector is sector address.
//Send the high byte of the sector address (the address needs to be re-sent
//Send the low byte of the sector address
//Allow ISP/IAP operation
//Working frequency setting
//Send sector erase command. When the command does not need to be
//re-enable interrupt
//Disable interrupts
//Allow ISP/IAP operation
//Working frequency setting
//Send byte write command. When the command does not need to be
//Send the high byte of the address (the address needs to be re-sent when
- 471 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin