STC8A8K64D4 Series Manual
ISP_ADDRL = EE_address % 256;
ISP_DATA = *DataAddress;
changes.
ISP_TRIG();
_nop_();
_nop_();
_nop_();
EE_address++;
DataAddress++;
}while(--number);
DisableEEPROM();
EA = 1;
}
16.4.5 Password erasing and writing - multi-sector backup - UART1
operation
C language code (main.c)
//Operating frequency for test is 11.0592MHz
/*
This program is completely normal after testing, and does not provide telephone technical support. If you cannot understand it,
please supplement the relevant basis yourself. */
/************* Function description of this program
STC8G family, STC8H family and STC8C family's EEPROM general test program to demonstrate multi-sector backup, writing with
correct sector data if there is a sector error, and writing the default value for all sector errors (such as the first time the program is run).
Each writting writes 3 sectors, that is, redundant backup.
Write a record in each sector, after the writing is completed, read the saved data and check value and compare it with the source data
and check value, and return the result (correct or wrong) from UART1 (P3.0 P3.1) .
Each record is self-checked, 64-byte data, 2-byte check value, check value = 64 bytes data's cumulative sum ^ 0x5555. ^0x5555 is to
ensure that the written 66 data are not all 0.
If there is a sector error, the data of the correct sector will be written to the wrong sector, and if all three sectors are wrong, the default
value will be written.
A password needs to be set before erasing, writing, and reading operations. If the password is incorrect, the operation will be exited,
and the password will be cleared each time when an exit operation is performed.
Please do not modify the program firstly, and download the "UART-EEPROM.hex" directly to test "03-Password erasing and writing-
multi-sector backup-UART 1 operation ". Select the frequency 11.0592MHZ when downloading.
PC serial port setting: baud rate 115200,8,n,1.
Do sector erase, write 64 bytes, and read 64 bytes of EEPROM.
Command example:
Use the serial port assistant to send a single character, both upper and lower case.
E or e: Perform sector erase operation on EEPROM, E means erase, it will erase sectors 0, 1, 2.
W or w: Write operation to EEPROM, W means write, will write to sectors 0, 1, 2, each sector writes 64 bytes continuously, sector 0
writes 0x0000~0x003f, sector 1 writes 0x0200~0x023f , write 0x0400~0x043f in sector 0.
R or r: Read data from the EEPROM, R means read, it will read sectors 0, 1, 2, each sector reads 64 bytes continuously, sector 0 reads
0x0000~0x003f, sector 1 reads 0x0200~0x023f , Sector 0 reads 0x0400~0x043f.
//Send the low byte of the address
//Send data to ISP_DATA, and only need to send it again when the data
//re-enable interrupt
**************
- 472 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?