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.

Delay function on CC1110

Other Parts Discussed in Thread: SIMPLICITI

Hi all,

I need to write a delay function for CC1110 (IAR Embedded Workbench). For 1ms delay (CLK is 26MHz), I need to write 26000 asm("NOP"); ?  Writing a FOR cycle, how many times the cycle should executed (for 1ms delay)?

can someone help me please?

  • Emanuele,

    The SimpliciTI code (http://focus.ti.com/docs/toolsw/folders/print/simpliciti.html) has some routines to put in a software delay that might be helpful.  Here's the code for the CC1110 radio:

    bsp_board_defs.h:
    ...
    #elif MRFI_CC1110
      #define __bsp_CLOCK_MHZ__         13  /* MHz uses default CLKCON.TICKSPD and CLKCON.CLOCKSPD */
    ...

    bsp.h:

    #define BSP_CLOCK_MHZ   __bsp_CLOCK_MHZ__

     

    bsp_board.c:

    ...
    * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     *   BSP (Board Support Package)
     *   Target : Texas Instruments CC1110EM/CC2510EM
     *   Top-level board code file.
     * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     */
    ...
    void BSP_InitBoard(void)
    {
    #if defined(SW_TIMER)
    #define MHZ_CLOCKS_PER_USEC      BSP_CLOCK_MHZ
    #define MHZ_CLOCKS_PER_ITERATION 35

      sIterationsPerUsec = (uint8_t)(((MHZ_CLOCKS_PER_USEC)/(MHZ_CLOCKS_PER_ITERATION))+.5);

      if (!sIterationsPerUsec)
      {
        sIterationsPerUsec = 1;
      }
    #endif   /* SW_TIMER */
    }
    ...
    void BSP_Delay(uint16_t usec)
    #if !defined(SW_TIMER)
    ...
    #else   /* !SW_TIMER */
    {
      /* Declared 'volatile' in case User optimizes for speed. This will
       * prevent the optimizer from eliminating the loop completely. But
       * it also generates more code...
       */
      volatile uint16_t repeatCount = sIterationsPerUsec*usec;

      while (repeatCount--) ;

      return;
    }

     

    I hope this gets you started.

    -GrantC