This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LAUNCHXL-CC1310:使用 CC1310解码传感器和#39;s 脉冲

Guru**** 2473260 points
Other Parts Discussed in Thread: CC1310

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1402474/launchxl-cc1310-decoding-sensor-s-pulse-with-cc1310

器件型号:LAUNCHXL-CC1310
Thread 中讨论的其他器件:CC1310

工具与软件:

您好!

我的这个传感器正在向 CC1310 DIO7发送0和1的脉冲。 我必须测量每个0或1保持高电平或低电平的时间、以便我可以在代码中进行转换。 我使用的传感器为:

每个 λ 大约为330~360 μ s。 因此、要设为0、它需要 保持低电平340秒左右、然后在高电平时保持两倍的时间。 该光学元件为1。  在低频时、试点为27个 λ(约9.7毫秒)。 为了将数据包转换为0和1、我需要测量每个脉冲的时间。 我已经尝试使用  gpiointerrupt、pinInterrupt 和 GPTimer 对它进行测量、但有时会向我提供不一致的值。 这是我使用的代码:

 *  ======== mainThread ========
 */
void *mainThread(void *arg0)
{
    /* Call driver init functions */
    GPIO_init();

    /* Configure the LED and button pins */
    GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_LED1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_BUTTON0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING);

    /* Turn on user LED */
    GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);

    /* install Button callback */
    GPIO_setCallback(Board_GPIO_BUTTON0, gpioButtonFxn0);

    /* Enable interrupts */
    GPIO_enableInt(Board_GPIO_BUTTON0);

    /*
     *  If more than one input pin is available for your device, interrupts
     *  will be enabled on Board_GPIO_BUTTON1.
     */
    if (Board_GPIO_BUTTON0 != Board_GPIO_BUTTON1) {
        /* Configure BUTTON1 pin */
        GPIO_setConfig(Board_GPIO_BUTTON1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING);

        /* Install Button callback */
        GPIO_setCallback(Board_GPIO_BUTTON1, gpioButtonFxn1);
        GPIO_enableInt(Board_GPIO_BUTTON1);
    }


    return (NULL);
}

 *  ======== gpioButtonFxn0 ========
 *  Callback function for the GPIO interrupt on Board_GPIO_BUTTON0.
 */
void gpioButtonFxn0(uint_least8_t index)
{
    ticks = (Clock_getTicks());

    buffer[i] = ticks;
    buffer1[i] = ticks - savedTicks;
    i++;
    if(i>=50)
        i = 0;

    savedTicks = ticks;
    /* Clear the GPIO interrupt and toggle an LED */
    //GPIO_toggle(Board_GPIO_LED0);
}

每次 发生中断时,我都在使用 Clock_getTicks() 并测量时间,但没有成功。 我曾想、中断连续进入两次、或者系统需要花费很多时间(或开销)、我喜欢说背靠背输入相同的中断。 有什么理想如何解决它? 系统是否可能进入睡眠状态的时间过长且需要大量时间才能唤醒?

在行[0]和[1]中可以看到、3和12个周期不是我所期望的。