找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2570|回复: 0
打印 上一主题 下一主题
收起左侧

stm32F4芯片eeprom驱动程序

[复制链接]
跳转到指定楼层
楼主
ID:263845 发表于 2019-5-15 19:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
单片机源程序如下:
  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)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表