increment doesn't work in a systick function
Hello,
Now I'm testing a systick work on STM32L0538-DISCO.
The aim in my project is to make 100Hz, 10Hz, 6Hz, 5Hz, 2Hz and 1Hz systick functions.
In the project, 100Hz, 10Hz, 6Hz and 5Hz systick functions worked, but 2Hz and 1Hz systick functions didn't work.
In my main.c code, 10Hz systick driver ( deci_sec_systick_Driver()) could drive 5Hz systick driver (vigesimal_sec_systick_Driver()) but couldn't drive 2Hz systick driver (demi_sec_systick_Driver()).
I found by debugging that a local static variable (demi_sec_systick_count) reached to 4 but it was reset before reaching 5.
Of course there are nowhere the local static variable is cleared but didn't reach to 5 it's really incredible phenomenon.
Are there someone who experienced like this?
If you know the cause and how to fix it tell me about it.
as reference I'll attach the project.
Thanks,
// 10 Hz systick driver
static void deci_sec_systick_Driver()
{
static uint32_t vigesimal_systick_count = 0;
static uint32_t demi_sec_systick_count = 0;
// 5 Hz systick driver
vigesimal_systick_count += 1;
if(vigesimal_systick_count >= 2)
{
vigesimal_sec_systick_Driver();
vigesimal_systick_count = 0;
}
// 2 Hz systick driver
demi_sec_systick_count += 1;
if(demi_sec_systick_count >= 5)
{
demi_sec_systick_Driver();
demi_sec_systick_count = 0;
}
}
