Skip to main content
Mike Bounds
Associate
Feb 16, 2018 10:38 AM UTC
Solved

What does sim() function do

Posted on February 16, 2018 at 11:38

I am trying to understand what 'sim()' does in the example code that comes on the STM8L-DISCOVERY eval board (Introduction to STM8L15x power saving modes using the STM8L-DISCOVERY IDD measurement feature) where the source can be downloaded from 

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm8-embedded-software/stsw-stm8009.html

In the Project/Discover/src/icc_measure.c file in function ADC_Icc_Test it runs 'sim()' and I cannot find a definition anywhere what this function does - example:

/* Low power mode */

case MCU_LPR:

Halt_Init();

sim();

/* To prepare to start counter */

GPIO_HIGH(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);

/* To configure Low Power */

LPR_init();

break;

I guess this must be some built-in C function as I can't find it in any of the source or Library files, but I can't find definition on Google

Thanks

Mike

#stm8l-discovery #sim #stm8 #stm8l
    This topic has been closed for replies.
    henry.dick
    henry.dickBest answer
    Associate II
    Feb 16, 2018 11:27 AM UTC
    Posted on February 16, 2018 at 12:27

    It's the c version of assembly sim instruction, opposite of rim. To disable and enable interrupts. The device header files or intrinsically should have it.

    2 replies

    henry.dick
    henry.dickBest answer
    Associate II
    Feb 16, 2018 11:27 AM UTC
    Posted on February 16, 2018 at 12:27

    It's the c version of assembly sim instruction, opposite of rim. To disable and enable interrupts. The device header files or intrinsically should have it.

    Mike Bounds
    Associate
    Feb 16, 2018 12:49 PM UTC
    Posted on February 16, 2018 at 12:49

     ,

     ,

    Thanks - I had looked in .c files in 'user' and libraries and .h files in 'user', but forgot .h files in libraries - so with your help, I have now located in ,Libraries/STM8L15x_StdPeriph_Driver/inc/stm8l15x.h :

    ♯ define rim() _rim_() /*!<,enable interrupts */

     ,

    ♯ define sim() _sim_() /*!<,disable interrupts */

    Thanks again

    Mike