Home > other >  Time delay process
Time delay process

Time:09-23

 void delay (uint32_t t) 
{
Uint32_t I;
While (t -)
for(i=0; i<10000; I++);
}


 delay (1000); 



Ask, how long is this delay?

Is there a precise timer? TIM? System system?

CodePudding user response:

Cycle counts than ordinary transfer time, affected by the interruption of, of course, more precise is the external clock chip signal, but it is inevitable that the calibration time timing also for,

CodePudding user response:

It looks like is calculate by CPU clock cycles

CodePudding user response:

This delay is not allowed, you can use the timer, the system tick timer, you can simulation, to see how long does it take to execute a assembly instruction is

CodePudding user response:

Can use the timer, can also use the system clock

CodePudding user response:

reference qq_33571983 reply: 3/f
this delay is not allowed, you can use the timer, system tick timer, you can simulate the simulation to see how long does it take to execute a assembly instruction is

Systick system clock?

CodePudding user response:

The
reference 4 floor hhhh63 reply:
can use timer, can also use the system clock

The system clock I can't use

CodePudding user response:

reference qq_33571983 reply: 3/f
this delay is not allowed, you can use the timer, system tick timer, you can simulate the simulation to see how long does it take to execute a assembly instruction is

I also think use cycle this is not allowed

CodePudding user response:

//start the system clock counts, 9 m 
SysTick - & gt; The LOAD=SysTick_LOAD_RELOAD_Msk;/* set reload register */
SysTick - & gt; VAL=(0 x00);/* the Load the SysTick Counter Value */
SysTick - & gt; CTRL=SysTick_CTRL_ENABLE_Msk;//9 m

While (1)
{
//real-time cycle
M_nMainCycle=((SysTick_LOAD_RELOAD_Msk + 1) - SysTick - & gt; VAL)/9;
SysTick - & gt; VAL=0;
If (m_nMainCycle & gt; M_nMaxCycle)
M_nMaxCycle=m_nMainCycle;

CodePudding user response:

The code above is Lord I use system test cycle

CodePudding user response:

The
refer to the original poster (aim high. Robert) response:
 void delay (uint32_t t) 
{
Uint32_t I;
While (t -)
for(i=0; i<10000; I++);
}


 delay (1000); 



Ask, how long is this delay?

Is there a precise timer? TIM? System system?


Different frequency of different CPU delay time is different, you can write code, using the oscilloscope measurement once know how long delay

The main ()
{
While (1)
{
Delay (100);
P00=~ P00;
}
}

CodePudding user response:

references 9 f hhhh63 response:
I use the code above is the system test main cycle

I have a look, some look not to understand the code

CodePudding user response:

Can use the clock ticking, is relatively quite accurate

CodePudding user response:

refer to 12th floor 'Dear. Reply:
can use the clock ticking, is relatively quite accurate

I'll study, can grant instruction?

CodePudding user response:

reference 13 floor (pure does small white) response:
Quote: refer to 12th floor 'Dear. Reply:

You can use the clock ticking, relatively quite accurate

I'll study, can grant instruction?

  • Related