问题描述
我正在使用adxl355并困惑如何更改odr(输出数据速率)的设置。这是代码。如您所见,我在主目录中有set_filter_ctl_reg。但似乎不起作用。我觉得while循环中只有一部分会影响采样率(这里与odr相同)。在数据表中,它确实说要调整滤波器以改变odr。有谁知道?谢谢!
#include "mbed.h"
#include "system_stm32f4xx.h"
#include "ADXL_355Z.h"
void Data_Collect(void);
//The virtual COM port
Serial pc(SERIAL_TX,SERIAL_RX);
//The voltage supply for the accelerator and the sEMG
DigitalOut SC1(PC_9);
DigitalOut SC2(PC_8);
ADXL355 acclA(PC_9,PC_12,PC_11,PC_10); //Set the SPI for the ACC_1
ADXL355 acclB(PC_8,PC_10); //Set the SPI for the ACC_1
Timer Time_up; //The timer for the arrangement
//All the variable here,are global variable
//They will be called by the Ticker function
float ADC_Value;
float xA,yA,zA;
float xB,yB,zB;
void Data_Collect(void) {
xA = acclA.convert(acclA.scanx())*acclA.axis355_sens;
yA = acclA.convert(acclA.scany())*acclA.axis355_sens;
zA = acclA.convert(acclA.scanz())*acclA.axis355_sens;
xB = acclB.convert(acclB.scanx())*acclB.axis355_sens;
yB = acclB.convert(acclB.scany())*acclB.axis355_sens;
zB = acclB.convert(acclB.scanz())*acclB.axis355_sens;
pc.printf("%.6f%.6f%.6f%.6f%.6f%.6f%\n",xA,zA,xB,zB);
}
int main() {
pc.baud(9600);
pc.printf("ADC sEMG demo\r\n");
acclA.reset();
acclB.reset();
wait(0.1); //The waiting is needed
acclA.set_filter_ctl_reg(acclA.HPFOFF,acclA.ODR4000HZ);
acclB.set_filter_ctl_reg(acclB.HPFOFF,acclB.ODR4000HZ);
wait(0.1); //The waiting is needed
acclA.set_power_ctl_reg(acclA.MEASUREMENT);
acclB.set_power_ctl_reg(acclB.MEASUREMENT);
wait(0.1); //The waiting is needed
Time_up.start();
while(1) {
Data_Collect();
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)