微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何更改ADXL355的ODR设置

如何解决如何更改ADXL355的ODR设置

我正在使用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 举报,一经查实,本站将立刻删除。