Delays


Functions

void delay_msec (unsigned int ms)
void delay_sec (unsigned int seconds)

Function Documentation

void delay_msec ( unsigned int  ms  ) 

Spin delay about ms milliseconds, up to a maximum of 65,536.

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.

void delay_sec ( unsigned int  seconds  ) 

Spin delay about seconds seconds, up to a maximum of 65,536.

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.


Generated on Sat May 23 08:43:58 2009 for LibVexBot by  doxygen 1.5.8