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

QQ登錄

只需一步,快速開始

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

STM32單片機(jī)+ADS1292測(cè)溫度心率步數(shù)源程序 2020電賽A題

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:490361 發(fā)表于 2020-10-17 16:56 | 只看該作者 |只看大圖 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
最終實(shí)現(xiàn)步數(shù)測(cè)量、距離測(cè)量、溫度測(cè)量,并且在手機(jī)和OLED屏幕上實(shí)時(shí)顯示當(dāng)前的運(yùn)動(dòng)信息,心電圖由于無(wú)心電圖模擬設(shè)備,無(wú)心電測(cè)量標(biāo)準(zhǔn)線線,不好調(diào)試,但有波在手機(jī)上顯示,可能需要自己調(diào)試


STM32單片機(jī)源程序如下:
  1. //-----------------------------------------------------------------
  2. // 程序描述:
  3. //    - ADS1292模塊測(cè)試實(shí)驗(yàn)
  4. // 版    本: V1.0
  5. // 調(diào)試工具: 凌智STM32核心開發(fā)板、LZE_ST LINK2、USB轉(zhuǎn)串口模塊、ADS1292模塊
  6. // 說(shuō)    明:
  7. //                                         (1)接口說(shuō)明
  8. //                                                ADS1292模塊            核心板
  9. //                                                   PWDN                           ->                           PA0
  10. //                                             START              ->                           PA1
  11. //                                                   CS                                   ->                           PA2
  12. //                                                   DRDY                           ->                           PA3
  13. //                                                   SCLK                           ->                           PA5
  14. //                                                   DOUT                           ->                           PA6
  15. //                                                   DIN                            ->                           PA7
  16. //              5V                                         ->                           +5V
  17. //                                                  GND                                        ->                                 GND
  18. //
  19. //                                         USB轉(zhuǎn)串口模塊           核心板
  20. //                                                        RXD                                        ->                                PA9
  21. //                                                        TXD                                        ->                                PA10
  22. //                                                        GND                                        ->                                GND
  23. //                                   (2)顯示說(shuō)明
  24. //                                                使用串口調(diào)試助手顯示
  25. //-----------------------------------------------------------------

  26. //-----------------------------------------------------------------
  27. // 頭文件包含
  28. //-----------------------------------------------------------------
  29. #include "stm32f10x.h"
  30. #include "Delay.h"
  31. #include "EXTInterrupt.h"
  32. #include "LED.h"
  33. #include "lze_lcd.h"
  34. #include "usart.h"         
  35. #include "ADS1292.h"        
  36. #include "spi.h"
  37. #include "PeripheralInit.h"
  38. #include "usart3.h"
  39. #include "adc.h"
  40. #include "exti.h"
  41. #include "lmt70.h"
  42. #include "oled.h"
  43. #include "mpu6050.h"
  44. #include "mpuiic.h"
  45. #include "inv_mpu.h"
  46. #include "inv_mpu_dmp_motion_driver.h"
  47. #include "algorithm.h"


  48. s32        p_Temp[2];        //數(shù)據(jù)緩存(有符號(hào))

  49. extern int heart_test;

  50. int read_data(void);

  51. unsigned long step_num=0;
  52. extern int meter;
  53. extern int temp_usart;
  54. //-----------------------------------------------------------------
  55. // 主程序
  56. //-----------------------------------------------------------------
  57. int main(void)
  58. {        
  59.   NVIC_Configuration();
  60.   uart3_init(115200);                                                        // 串口初始化
  61.   GPIO_ADS1292_Configuration();                // ADS1292引腳初始化
  62.   SPI1_Init();                                                                                // SPI1初始化
  63.   ADS1292_PowerOnInit();
  64.   OLED_Init();                   //=====OLED初始化
  65.   OLED_Clear();                                                                         //=====OLED清屏
  66.         MPU_Init();                                                                     //=====初始化MPU6050
  67.         mpu_dmp_init();                                                                 //=====初始化MPU6050的DMP模式        
  68.    
  69.    MPU6050_EXTI_Init();
  70.     Adc_Init();
  71.         OLED_ShowString(0,0,"Pitch:",12);
  72.         OLED_ShowString(0,2,"meter:",12);
  73.         OLED_ShowString(0,4,"temp:",12);
  74.         OLED_ShowString(0,6,"step:",12);
  75.     dmp_set_pedometer_step_count(step_num);

  76.   while (1);
  77. }
  78. int read_data()
  79. {
  80.   static u8 read_data[9];                                                                          // 數(shù)據(jù)緩存區(qū)  
  81.   static u32 ch1_data;
  82.   static u32 ch2_data;
  83.   static u32 ch1_data_del;
  84.   static u32 ch2_data_del;
  85.    
  86.   int quyu;
  87.   
  88.   ch1_data=0;  
  89.   ch2_data=0;
  90.    ADS1292_Read_Data(read_data);
  91.                
  92.                 // 計(jì)算ADS1292通道1的數(shù)據(jù)-呼吸阻抗測(cè)量
  93.     ch1_data |= (uint32_t)read_data[3] << 16;
  94.     ch1_data |= (uint32_t)read_data[4] << 8;
  95.     ch1_data |= (uint32_t)read_data[5] << 0;

  96.                 // 計(jì)算ADS1292通道2的數(shù)據(jù)-心電圖測(cè)量
  97.     ch2_data |= (uint32_t)read_data[6] << 16;
  98.     ch2_data |= (uint32_t)read_data[7] << 8;
  99.     ch2_data |= (uint32_t)read_data[8] << 0;
  100.    
  101.     ch1_data_del=ch1_data^0x800000;  
  102.     ch2_data_del=ch2_data^0x800000;
  103.    
  104. //    ch1_data_del=ch1_data_del%32760;      
  105. //    quyu=ch2_data_del%30000;

  106.         p_Temp[0] = get_volt(ch1_data_del);        //把采到的3個(gè)字節(jié)轉(zhuǎn)成有符號(hào)32位數(shù)  為什么要變成4個(gè)字節(jié)?
  107.         p_Temp[1] = get_volt(ch2_data_del);        //把采到的3個(gè)字節(jié)轉(zhuǎn)成有符號(hào)32位數(shù)
  108.               
  109.     x_test();
  110.    
  111.     quyu=heart_test;
  112.    
  113.     return quyu;
  114. }
  115. //-----------------------------------------------------------------
  116. // End Of File
  117. //-----------------------------------------------------------------
復(fù)制代碼

所有資料51hei提供下載:
51黑電子.7z (2.21 MB, 下載次數(shù): 173)


評(píng)分

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

查看全部評(píng)分

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

使用道具 舉報(bào)

沙發(fā)
ID:851926 發(fā)表于 2020-11-30 19:16 | 只看該作者
樓主,您能幫忙弄一套ads1292的51單片機(jī)的A/D代碼
回復(fù)

使用道具 舉報(bào)

板凳
ID:851926 發(fā)表于 2020-11-30 19:24 | 只看該作者
樓主,您好,您能幫忙弄一套ads1292的51單片機(jī)A/D代碼 嗎?
回復(fù)

使用道具 舉報(bào)

地板
ID:650653 發(fā)表于 2020-12-22 18:39 | 只看該作者
文件里有PCB的相關(guān)文件嗎
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

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