STM8读取Flash_eeprom单片机源程序如下:
- /******************** (C) COPYRIGHT 风驰iCreate嵌入式开发工作室 ********************
- * 文件名 :main.c
- * 描述 :Flash_eeprom读写实验
- * 实验平台:iCreate STM8开发板
- * 库版本 :V2.0.0
- * 作者 :ling_guansheng
- **********************************************************************************/
- /* Includes ------------------------------------------------------------------*/
- /* Includes ------------------------------------------------------------------*/
- #include "stm8s.h"
- #include "stm8s_clk.h"
- #include "intrinsics.h"
- #include "stm8s_uart1.h"
- #include "uart.h"
- #include "flash_eeprom.h"
- void Delay(u16 nCount);
- /* Private defines -----------------------------------------------------------*/
- /* Private function prototypes -----------------------------------------------*/
- /* Private functions ---------------------------------------------------------*/
- int main(void)
- {
-
- /* Infinite loop */
-
- /*设置内部时钟16M为主时钟*/
- Flash_eeprom_readwrite_Init();
- /*!<Set High speed internal clock */
- CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
- Uart_Init();
- Flash_eeprom_readwrite_Test();
- Flash_eeprom_Erase_Test();
-
- __enable_interrupt();
-
- while (1);
- }
- void Delay(u16 nCount)
- {
- /* Decrement nCount value */
- while (nCount != 0)
- {
- nCount--;
- }
- }
- #ifdef USE_FULL_ASSERT
- /**
- * @brief Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * @param file: pointer to the source file name
- * @param line: assert_param error line source number
- * @retval : None
- */
- void assert_failed(u8* file, u32 line)
- {
- /* User can add his own implementation to report the file name and line number,
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
STM8Flash_eeprom.rar
(246.27 KB, 下载次数: 41)
|