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.

CC2530协调器可以读到传感器数据,终端不可以

软件模拟IIC读取ADXL345的三轴加速度

初始化部分

  EA = 0;
  Init_ADXL345();  //初始化传感器,不关中断发现读取有问题
  EA = 1;
  osal_start_timerEx( GenericApp_TaskID,
                        0x0010,
                     500 );
  osal_start_system(); // No Return from here




读取数据部分
if ( events & My_EVT )  //My_EVT == 10
  {

    
    char tmp[10]; 
    EA = 0;
    step_counter(); //读取数据
    EA = 1;
    sprintf(tmp,"%d",STEPS);
    LCD_P8x16Str(0,6,tmp);
    
    osal_start_timerEx( GenericApp_TaskID,
                        0x0010,
                     30 );   

终端波形

协调器

  • 关于I/O的初始化是否有冲突的,本身协议栈里面也有相关外设接口的定义的。

    另外在osal系统还没有启动前,调用timer应该没什么效果,可以在应用层的event loop去做传感器采集的事情。

    osal_start_timerEx( GenericApp_TaskID,
                            0x0010,
                         500 );
      osal_start_system(); // No Return from here