找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2630|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

stm32F4芯片eeprom驅(qū)動(dòng)程序

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:263845 發(fā)表于 2019-5-15 19:19 | 只看該作者 回帖獎(jiǎng)勵(lì) |正序?yàn)g覽 |閱讀模式
單片機(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)

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表