EEPROM.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __EEPROM_H
  2. #define __EEPROM_H
  3. #include "config.h"
  4. #define STC8X1K08 8
  5. #define STC8X1K16 16
  6. #define STC8XxK32 32
  7. #define STC8XxK60 60
  8. // 选择MCU型号
  9. #define MCU_Type STC8XxK32 //STC8X1K08, STC8X1K16, STC8XxK32, STC8XxK32, STC8XxK60
  10. /************************** ISP/IAP *****************************
  11. 型号 大小 扇区数 开始地址 结束地址 MOVC读偏移地址
  12. STC8X1K08 4K 8扇区 0x0000 ~ 0x0FFF 0x2000
  13. STC8X1K16 12K 24扇区 0x0000 ~ 0x2FFF 0x4000
  14. STC8XxK32 32K 64扇区 0x0000 ~ 0x7FFF 0x8000
  15. STC8XxK60 4K 8扇区 0x0000 ~ 0x0FFF 0xF000
  16. */
  17. #if (MCU_Type == STC8X1K08)
  18. #define MOVC_ShiftAddress 0x2000
  19. #elif (MCU_Type == STC8X1K16)
  20. #define MOVC_ShiftAddress 0x4000
  21. #elif (MCU_Type == STC8XxK32)
  22. #define MOVC_ShiftAddress 0x8000
  23. #elif (MCU_Type == STC8XxK60)
  24. #define MOVC_ShiftAddress 0xF000
  25. #else
  26. #define MOVC_ShiftAddress 0xC000 //用户自定义
  27. #endif
  28. void DisableEEPROM(void);
  29. void EEPROM_read_n(u16 EE_address,u8 *DataAddress,u16 number);
  30. void EEPROM_write_n(u16 EE_address,u8 *DataAddress,u16 number);
  31. void EEPROM_SectorErase(u16 EE_address);
  32. #endif