標(biāo)題: stm32F4芯片eeprom驅(qū)動(dòng)程序 [打印本頁(yè)]

作者: JAVADSALAR    時(shí)間: 2019-5-15 19:19
標(biāo)題: stm32F4芯片eeprom驅(qū)動(dòng)程序
單片機(jī)源程序如下:
  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. }
復(fù)制代碼

所有資料51hei提供下載:
ub_stm32f4_ee_flash_v100.zip (5.77 KB, 下載次數(shù): 16)






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1