标题: STM8读取Flash_eeprom程序 [打印本页]

作者: weixingcui    时间: 2018-5-29 10:03
标题: STM8读取Flash_eeprom程序
STM8读取Flash_eeprom单片机源程序如下:
  1. /******************** (C) COPYRIGHT  风驰iCreate嵌入式开发工作室 ********************
  2. * 文件名  :main.c
  3. * 描述    :Flash_eeprom读写实验   
  4. * 实验平台:iCreate STM8开发板
  5. * 库版本  :V2.0.0
  6. * 作者    :ling_guansheng
  7. **********************************************************************************/

  8. /* Includes ------------------------------------------------------------------*/
  9. /* Includes ------------------------------------------------------------------*/
  10. #include "stm8s.h"
  11. #include "stm8s_clk.h"
  12. #include "intrinsics.h"
  13. #include "stm8s_uart1.h"
  14. #include "uart.h"
  15. #include "flash_eeprom.h"

  16. void Delay(u16 nCount);


  17. /* Private defines -----------------------------------------------------------*/
  18. /* Private function prototypes -----------------------------------------------*/
  19. /* Private functions ---------------------------------------------------------*/

  20. int main(void)
  21. {

  22.   /* Infinite loop */
  23.   
  24.   /*设置内部时钟16M为主时钟*/

  25.     Flash_eeprom_readwrite_Init();
  26.    /*!<Set High speed internal clock  */
  27.     CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
  28.     Uart_Init();
  29.     Flash_eeprom_readwrite_Test();
  30.     Flash_eeprom_Erase_Test();
  31.    
  32.    __enable_interrupt();

  33.    while (1);
  34. }

  35. void Delay(u16 nCount)
  36. {
  37.   /* Decrement nCount value */
  38.   while (nCount != 0)
  39.   {
  40.     nCount--;
  41.   }
  42. }



  43. #ifdef USE_FULL_ASSERT

  44. /**
  45.   * @brief  Reports the name of the source file and the source line number
  46.   *   where the assert_param error has occurred.
  47.   * @param file: pointer to the source file name
  48.   * @param line: assert_param error line source number
  49.   * @retval : None
  50.   */
  51. void assert_failed(u8* file, u32 line)
  52. {
  53.   /* User can add his own implementation to report the file name and line number,
  54. ……………………

  55. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
STM8Flash_eeprom.rar (246.27 KB, 下载次数: 41)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1