最终实现步数测量、距离测量、温度测量,并且在手机和OLED屏幕上实时显示当前的运动信息,心电图由于无心电图模拟设备,无心电测量标准线线,不好调试,但有波在手机上显示,可能需要自己调试
STM32单片机源程序如下:
- //-----------------------------------------------------------------
- // 程序描述:
- // - ADS1292模块测试实验
- // 版 本: V1.0
- // 调试工具: 凌智STM32核心开发板、LZE_ST LINK2、USB转串口模块、ADS1292模块
- // 说 明:
- // (1)接口说明
- // ADS1292模块 核心板
- // PWDN -> PA0
- // START -> PA1
- // CS -> PA2
- // DRDY -> PA3
- // SCLK -> PA5
- // DOUT -> PA6
- // DIN -> PA7
- // 5V -> +5V
- // GND -> GND
- //
- // USB转串口模块 核心板
- // RXD -> PA9
- // TXD -> PA10
- // GND -> GND
- // (2)显示说明
- // 使用串口调试助手显示
- //-----------------------------------------------------------------
- //-----------------------------------------------------------------
- // 头文件包含
- //-----------------------------------------------------------------
- #include "stm32f10x.h"
- #include "Delay.h"
- #include "EXTInterrupt.h"
- #include "LED.h"
- #include "lze_lcd.h"
- #include "usart.h"
- #include "ADS1292.h"
- #include "spi.h"
- #include "PeripheralInit.h"
- #include "usart3.h"
- #include "adc.h"
- #include "exti.h"
- #include "lmt70.h"
- #include "oled.h"
- #include "mpu6050.h"
- #include "mpuiic.h"
- #include "inv_mpu.h"
- #include "inv_mpu_dmp_motion_driver.h"
- #include "algorithm.h"
- s32 p_Temp[2]; //数据缓存(有符号)
- extern int heart_test;
- int read_data(void);
- unsigned long step_num=0;
- extern int meter;
- extern int temp_usart;
- //-----------------------------------------------------------------
- // 主程序
- //-----------------------------------------------------------------
- int main(void)
- {
- NVIC_Configuration();
- uart3_init(115200); // 串口初始化
- GPIO_ADS1292_Configuration(); // ADS1292引脚初始化
- SPI1_Init(); // SPI1初始化
- ADS1292_PowerOnInit();
- OLED_Init(); //=====OLED初始化
- OLED_Clear(); //=====OLED清屏
- MPU_Init(); //=====初始化MPU6050
- mpu_dmp_init(); //=====初始化MPU6050的DMP模式
-
- MPU6050_EXTI_Init();
- Adc_Init();
- OLED_ShowString(0,0,"Pitch:",12);
- OLED_ShowString(0,2,"meter:",12);
- OLED_ShowString(0,4,"temp:",12);
- OLED_ShowString(0,6,"step:",12);
- dmp_set_pedometer_step_count(step_num);
- while (1);
- }
- int read_data()
- {
- static u8 read_data[9]; // 数据缓存区
- static u32 ch1_data;
- static u32 ch2_data;
- static u32 ch1_data_del;
- static u32 ch2_data_del;
-
- int quyu;
-
- ch1_data=0;
- ch2_data=0;
- ADS1292_Read_Data(read_data);
-
- // 计算ADS1292通道1的数据-呼吸阻抗测量
- ch1_data |= (uint32_t)read_data[3] << 16;
- ch1_data |= (uint32_t)read_data[4] << 8;
- ch1_data |= (uint32_t)read_data[5] << 0;
- // 计算ADS1292通道2的数据-心电图测量
- ch2_data |= (uint32_t)read_data[6] << 16;
- ch2_data |= (uint32_t)read_data[7] << 8;
- ch2_data |= (uint32_t)read_data[8] << 0;
-
- ch1_data_del=ch1_data^0x800000;
- ch2_data_del=ch2_data^0x800000;
-
- // ch1_data_del=ch1_data_del%32760;
- // quyu=ch2_data_del%30000;
- p_Temp[0] = get_volt(ch1_data_del); //把采到的3个字节转成有符号32位数 为什么要变成4个字节?
- p_Temp[1] = get_volt(ch2_data_del); //把采到的3个字节转成有符号32位数
-
- x_test();
-
- quyu=heart_test;
-
- return quyu;
- }
- //-----------------------------------------------------------------
- // End Of File
- //-----------------------------------------------------------------
复制代码
所有资料51hei提供下载:
51黑电子.7z
(2.21 MB, 下载次数: 173)
|