TaterLi's LazyBlog

自言自语,不喜绕路,科学上网,远离天国.

@TaterLi2月前

12/29
15:49
技术控

STM8S EEPROM 编程好简单

从来没想过,竟然如此简单!简直是超快的开发啊.

#include "stm8s.h"

uint8_t val = 0;

void main(void)
{ 
  
  FLASH_Unlock(FLASH_MEMTYPE_DATA);
  
  FLASH_ProgramByte(FLASH_DATA_START_PHYSICAL_ADDRESS,0xAA);
  val = FLASH_ReadByte(FLASH_DATA_START_PHYSICAL_ADDRESS);

  FLASH_ProgramByte(FLASH_DATA_START_PHYSICAL_ADDRESS,0x55);
  val = FLASH_ReadByte(FLASH_DATA_START_PHYSICAL_ADDRESS);  
  
  while (1); 
}

 

STM8S EEPROM 编程好简单