標(biāo)題: mpu6050通過引腳高低電平示波器觀察IIC的時序信息 stm32源碼 [打印本頁]

作者: 七星-鄉(xiāng)下人    時間: 2018-1-25 11:50
標(biāo)題: mpu6050通過引腳高低電平示波器觀察IIC的時序信息 stm32源碼
mpu6050 IIC時序觀測程序

單片機(jī)源程序如下:
  1. #include "config.h"
  2. #include "MPU6050.H"
  3. #include "delay.h"       

  4. void init(void);

  5. //該程序功能為:通過引腳高低電平示波器觀察IIC的時序信息
  6. // ===================== 主函數(shù) =====================
  7. void main(void)
  8. {
  9.         init();
  10.         delay_ms(100);
  11.         while(1)
  12.         {
  13.                 InitMPU6050();
  14. //                        SDA = 1;                    //寫應(yīng)答信號
  15. //        SCL = 1;                    //拉高時鐘線
  16.         }
  17. }
  18.                  
  19. void init(void)
  20. {
  21.         //所有I/O口全設(shè)為準(zhǔn)雙向,弱上拉模式
  22.         P0M0=0x00;        P0M1=0x00;
  23.         P1M0=0x00;        P1M1=0x00;
  24.         P2M0=0x00;        P2M1=0x00;
  25.         P3M0=0x00;        P3M1=0x00;
  26.         P4M0=0x00;        P4M1=0x00;
  27.         P5M0=0x00;        P5M1=0x00;
  28.         P6M0=0x00;        P6M1=0x00;
  29.         P7M0=0x00;        P7M1=0x00;
  30. }
復(fù)制代碼

所有資料51hei提供下載:
IIC時序.rar (232.37 KB, 下載次數(shù): 11)







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