A problem with my code in Systick

Thread Starter


Joined May 11, 2020


I am trying to create a delay function using SysTick counter.
I am using my own functions ..
SysTick_Init(uint32_t ticks) ; this function takes a parameter that represents the interval that interrupt should be triggered , so if i want to trigger an interrupt each 1mS then SysTick_Init(SystemCoreClock/1000);
I did successfully create a delay with 1 mSec without using the delay_uS function i used the delay_MS function directly that was my first trial ...
the problem is when i try to create a delay with 1uSec , the problem arises..
I have a Global variable called Micro , this variable is initialized with a value passed to function delay_ms(some variable) . then function delay_ms calls function delay_uS .. the implementation is in the first photo .
so when i initialize Micro with 1000000 and the interrupt is triggered every 1 uSec , so i can create a delay with 1 sec .
Micro is initialized with a very random value as stated in the first picture ... .anyone have a suggestion for this problem?