OpenVex
0.5.0
|
Functions | |
void | delay_msec (unsigned int ms) |
void | delay_sec (unsigned int seconds) |
These functions provide a convenient interface for pausing the program for a given amount of time before proceeding.
void delay_msec | ( | unsigned int | ms | ) |
Spin delay about ms milliseconds, up to a maximum of 65,536 ms.
ms | Delay in milliseconds |
The current implementation will actually go slightly over since it doesn't account for function call, loop, and computational overhead. Each overhead instruction adds an additional 1/10 microsecond, so typical delays should be accurate to within a few microseconds.
If you want more accurate delays, use the delay*cty() functions directly. Since the VEX delay timer runs at 10MHz, they will produce the following delays:
delay10tcy() 1 us
delay100tcy() 10 us
delay1kcth() 100 us
delay10ktcy() 1 ms
delay100ktcy() 10 ms
delay1mtcy() 100 ms
However, be aware that all the delay*tcy() functions take an unsigned char argument, so they are limited to a maximum of 255 time units.
void delay_sec | ( | unsigned int | seconds | ) |
Spin delay about seconds seconds, up to a maximum of 65,536.
seconds | Delay in seconds |
The current implementation will actually go slightly over since it doesn't account for function call, loop, and computational overhead. Each overhead instruction adds an additional 1/10 microsecond, so typical delays should be accurate to within a few microseconds.
If you want more accurate delays, use the delay*cty() functions directly. Since the VEX delay timer runs at 10MHz, they will produce the following delays:
delay10tcy() 1 us
delay100tcy() 10 us
delay1kcth() 100 us
delay10ktcy() 1 ms
delay100ktcy() 10 ms
delay1mtcy() 100 ms
However, be aware that all the delay*tcy() functions take an unsigned char argument, so they are limited to a max of 255.