SLAA476B February 2011 – July 2019 BQ2040 , BQ2040 , BQ2060A , BQ2060A , BQ2063 , BQ2063 , BQ2083-V1P3 , BQ2083-V1P3 , BQ2084-V143 , BQ2084-V143 , BQ2084-V150 , BQ2084-V150 , BQ2085-V1P3 , BQ2085-V1P3 , BQ20Z40-R1 , BQ20Z40-R1 , BQ20Z70-V160 , BQ20Z70-V160 , BQ20Z80A-V110 , BQ20Z80A-V110 , BQ28400 , BQ28400 , BQ78PL114 , BQ78PL114 , BQ78PL116 , BQ78PL116 , LM5145 , LM5145 , MSP430F5500 , MSP430F5500 , MSP430F5501 , MSP430F5501 , MSP430F5502 , MSP430F5502 , MSP430F5503 , MSP430F5503 , MSP430F5504 , MSP430F5504 , MSP430F5505 , MSP430F5505 , MSP430F5506 , MSP430F5506 , MSP430F5507 , MSP430F5507 , MSP430F5508 , MSP430F5508 , MSP430F5509 , MSP430F5509 , MSP430F5510 , MSP430F5510 , TPS40057 , TPS40057 , TPS40170 , TPS40170
This function implements a fixed delay in the program. It halts program execution and places the CPU in low-power mode. Rather than consume CPU cycles, it uses a Timer running in the background to count delay. This delay function acts like a software virtual counter where one count for the virtual counter is equivalent to TIMER_TICK counts of the hardware timer. TIMER_TICK is a definition in the misc.h that can be easily modified. It is set to default of 25 ms as it is used to implement SMBus time-out and LED refresh blink period. When the function reaches the desired delay, it wakes up the CPU and program execution resumes.
Function Definition
void Delay_Timer(int number_of_ticks) {...}
Inputs
Name | Type | Description | Example Value |
---|---|---|---|
number_of_ticks | unsigned char | Amount of delay required. Delay is a multiple of the TIMER_TICK duration. | 1, 2, 3 |
Return
None
Example Function Call
To have a 100 ms delay where TIMER_TICK has been defined for 25-ms delay:
Delay_Timer(4);