EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 481

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 465 -
Please do not modify the program firstly, and download the "UART-EEPROM.hex" directly to test "02-UART 1 reads and writes
EEPROM- using MOVC to read". 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:
E 0 Perform sector erasing operation on EEPROM, E means erasing, the number 0 is 0 sector (decimal, 0~126, see the specific IC).
W 0 Write operation to EEPROM, W means write, number 0 is 0 sector (decimal, 0~126, see the specific IC). Write 64 bytes continuously
from the start address of the sector.
R 0 Perform IAP read operation on EEPROM, R means read out, the number 0 is 0 sector (decimal, 0~126, see the specific IC). Read
64 bytes continuously from the start address of the sector.
M 0 Perform MOVC read operation on EEPROM (operation address is sector*512+offset address), number 0 is sector 0 (decimal,
0~126, see the specific IC). Read 64 bytes continuously from the start address of the sector .
Note: For general purpose, the program does not recognize whether the sector is valid or not, and the user decides according to the
specific model.
Date: 2019-6-10
******************************************/
#include "config.H"
#include "EEPROM.h"
#define Baudrate1 115200L
#define UART1_BUF_LENGTH 10
#define EEADDR_OFFSET (8 * 1024) //Define the offset added when EEPROM is accessed using MOVC
// Equal to the size of the FLASH ROM.
// For IAP or IRC at the beginning, the offset must be 0
#define TimeOutSet1 5
/************* local constant declaration **************/
u8 code T_Strings[]={"
去年今日此门中,人面桃花相映红。人面不知何处去,桃花依旧笑春风。
"};
/************* local variable declaration **************/
u8 xdata tmp[70];
u8 xdata RX1_Buffer[UART1_BUF_LENGTH];
u8 RX1_Cnt;
u8 RX1_TimeOut;
bit B_TX1_Busy;
/************* local function declaration **************/
void UART1_config(void);
void TX1_write2buff(u8 dat); //write send buffer
void PrintString1(u8 *puts); //send a string
/************* External function and variable declarations *****************/
/**********************************************/
u8 CheckData(u8 dat)
{
if((dat >= '0') && (dat <= '9')) return (dat-'0');
if((dat >= 'A') && (dat <= 'F')) return (dat-'A'+10);
if((dat >= 'a') && (dat <= 'f')) return (dat-'a'+10);
return 0xff;
}

Table of Contents

Related product manuals