guanjiao
2018-05-12 7bd852c98c52c306e3628acedc33149ebee3cff6
Ô´Âë/ºËÐİå/Src/main.c
@@ -32,7 +32,8 @@
#define RNG_DELAY_MS 100
/* Default communication configuration. We use here EVK1000's default mode (mode 3). */
static dwt_config_t config = {
static dwt_config_t config =
{
    2,               /* Channel number. */
    DWT_PRF_64M,     /* Pulse repetition frequency. */
    DWT_PLEN_1024,   /* Preamble length. */
@@ -322,7 +323,9 @@
                                    dID=ANCHOR_ID;
                                    printf("ANCHOR_ID: %2.0f      ", dID);
                        printf("Distance: %5.0f cm\n", (double)dist[TAG_ID]);
                                 }else{
                    }
                    else
                    {
                                    send[2] = ANCHOR_ID;
                                    send[3] = TAG_ID;
                                    
@@ -343,7 +346,9 @@
                        time32_reset = 0;
                        GPIO_Toggle(GPIOA,LED_PIN);//LED闪烁
                        jumptime = 0;
            }else{
                }
                else
                {
                     jumptime =5;//如果通讯失败,将间隔时间增加5ms,避开因为多标签同时发送引起的冲突。
                  }
        }
@@ -357,7 +362,9 @@
        /* Execute a delay between ranging exchanges. */
        deca_sleep(RNG_DELAY_MS+jumptime);//休眠固定时间
    }
   }else{
    }
    else
    {
      while (1)//接收模式(ANCHOR基站)
    {
        /* Clear reception timeout to start next ranging process. */
@@ -475,7 +482,9 @@
                                    dID=ANCHOR_ID;
                                    printf("ANCHOR_ID: %2.0f      ", dID);
                        printf("Distance: %5.0f cm\n", (double)dist[TAG_ID]);
                                 }else{
                            }
                            else
                            {
                                    send[2] = ANCHOR_ID;
                                    send[3] = TAG_ID;