Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Keil Compiler timer.h Include Function

The Microchip Atmega328 compiler provides a timer function, i.e. #include <Timerone.h>, which allows for simple delay coding such as delay (XXX) for millisecond delays or delayMicroseconds(XXX) for delays of microseconds. Does the Keil Compiler for the Silabs EFM8BB1 provide a timer.h function?

Parents
  • Here is the SiLabs reply;

    No, you have to write your own delay_ms(), delay_ms(), functions! If it's just delay func.(controller do nothing, just stay in some loop) here is sample functions:
    void delay_us(unsigned int usec){
     unsigned int i;
        for(i = 0; i < usec; i++){        
            ;//j++;
        }
    }
    void delay_ms(unsigned int msec){
     unsigned int i, j;
        
        for(i = 0; i < msec; i++){        
            for(j = 0; j < 2400; j++){        
                ;// Wait!
            }
        }
    }
    , which are valid for "SYSCLK=24Mhz"!
    If you don't want controller to stay in 'delay loop', you have to use any  timer as systick timer with or without using interrupt!
     

Reply
  • Here is the SiLabs reply;

    No, you have to write your own delay_ms(), delay_ms(), functions! If it's just delay func.(controller do nothing, just stay in some loop) here is sample functions:
    void delay_us(unsigned int usec){
     unsigned int i;
        for(i = 0; i < usec; i++){        
            ;//j++;
        }
    }
    void delay_ms(unsigned int msec){
     unsigned int i, j;
        
        for(i = 0; i < msec; i++){        
            for(j = 0; j < 2400; j++){        
                ;// Wait!
            }
        }
    }
    , which are valid for "SYSCLK=24Mhz"!
    If you don't want controller to stay in 'delay loop', you have to use any  timer as systick timer with or without using interrupt!
     

Children