標(biāo)題: stm32模擬i2c讀寫(xiě)AT24C02程序(有從機(jī)無(wú)響應(yīng)功能)keil5寫(xiě)的 [打印本頁(yè)]

作者: 9983    時(shí)間: 2018-7-10 14:14
標(biāo)題: stm32模擬i2c讀寫(xiě)AT24C02程序(有從機(jī)無(wú)響應(yīng)功能)keil5寫(xiě)的
此程序有IIC讀寫(xiě)功能,有從機(jī)無(wú)響應(yīng)功能

stm32單片機(jī)源程序如下:
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  fire
  5.   * @version V1.0
  6.   * @date    2013-xx-xx
  7.   * @brief   AT24C02測(cè)試(軟件模擬I2C)
  8.   */
  9.   
  10. #include "stm32f10x.h"
  11. #include "./usart/bsp_usart.h"
  12. #include "./led/bsp_led.h"
  13. #include "./i2c/bsp_i2c_ee.h"
  14. #include "./bsp_beep.h"   
  15. void Delay(__IO u32 nCount);


  16. /**
  17.   * @brief  主函數(shù)
  18.   * @param  無(wú)
  19.   * @retval 無(wú)
  20.   */
  21. int main(void)
  22. {
  23.           uint8_t ee_Test(void);
  24.     uint8_t ee_Test(void);
  25.     LED_GPIO_Config();
  26.           BEEP_GPIO_Config();       
  27.   
  28.     /* 串口初始化 */
  29.                 USART_Config();
  30.        
  31.                 i2c_CfgGpio();

  32.                 printf("eeprom 軟件模擬i2c測(cè)試?yán)?\r\n");       
  33.    
  34.     if(ee_Test() ==1)
  35.           {
  36.                   LED_G(ON);
  37.     }
  38.     else
  39.     {
  40.                         while(1)
  41.                         {               
  42.                                 BEEP( ON1 );                           // 響
  43.                                 Delay(0x0FFFFF);       
  44.                         }
  45.     }
  46.     while(1);
  47. }
  48. void Delay(__IO uint32_t nCount)         //簡(jiǎn)單的延時(shí)函數(shù)
  49. {
  50.         for(; nCount != 0; nCount--);
  51. }

  52. /*********************************************END OF FILE**********************/
復(fù)制代碼

所有資料51hei提供下載:
模擬i2c.rar (302.72 KB, 下載次數(shù): 63)



作者: denjackson    時(shí)間: 2019-8-23 14:13
看看,學(xué)習(xí)下
作者: 風(fēng)瀟瀟姿姣姣    時(shí)間: 2019-11-5 15:45
這個(gè)就是dsp的官方例程,沒(méi)有參考價(jià)值,大家注意
作者: 卑微小趙    時(shí)間: 2022-5-17 17:21
玩兒呢

屏幕截圖 2022-05-17 172011.png (5.72 KB, 下載次數(shù): 20)

屏幕截圖 2022-05-17 172011.png

屏幕截圖 2022-05-17 172036.png (4.41 KB, 下載次數(shù): 34)

屏幕截圖 2022-05-17 172036.png





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