标题: stm32F4芯片eeprom驱动程序 [打印本页]

作者: JAVADSALAR    时间: 2019-5-15 19:19
标题: stm32F4芯片eeprom驱动程序
单片机源程序如下:
  1. #include "main.h"
  2. #include "stm32_ub_led.h"
  3. #include "stm32_ub_ee_flash.h"

  4. int main(void)
  5. {
  6.   ErrorStatus check;
  7.   int32_t ee_wert;

  8.   SystemInit(); // Quarz Einstellungen aktivieren

  9.   // init der LEDs
  10.   UB_Led_Init();

  11.   // init vom virtuellen EEProm
  12.   check=UB_EE_FLASH_Init();
  13.   if(check==SUCCESS) {
  14.           // gr黱e LED einschalten
  15.           UB_Led_On(LED_GREEN);

  16.           // EEprom Adresse 0x00 auslesen
  17.           ee_wert=UB_EE_FLASH_Read(0x00);
  18.           // test ob Inhalt stimmt
  19.           if(ee_wert==0x3AC4) {
  20.                   // Inhalt ist richtig
  21.                   UB_Led_On(LED_BLUE);
  22.           }
  23.           else {
  24.                   // wenn Inhalt nicht stimmt
  25.                   UB_Led_On(LED_ORANGE);
  26.                   // Adresse 0x00 mit Wert 0x3AC4 beschreiben
  27.                   UB_EE_FLASH_Write(0x00,0x3AC4);
  28.           }
  29.   }
  30.   else {
  31.           // Fehler
  32.           UB_Led_On(LED_RED);
  33.   }

  34.   while(1)
  35.   {

  36.   }
  37. }
复制代码

所有资料51hei提供下载:
ub_stm32f4_ee_flash_v100.zip (5.77 KB, 下载次数: 16)






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