Hello, I'm rather new to Keil C and just getting geared up to use it on my next project. ATM, I'm overwhelmed with the number of options and extensions that are available. I intend to write a C "library" that consists of 3 functions:
Delay() DelayMS() DelayUS()
Delay(2); // creates a 2 second delay DelayMS(500); // creates 500ms delay DelayUS(10); // creates a 10us delay
Some time ago Jon Ward posted this macro here: http://www.keil.com/forum/docs/thread1940.asp You may find it useful for short delays:
#define NOPS(x) \ (((x) & 1) ? _nop_() : 0),\ (((x) & 2) ? _nop_(),_nop_() : 0),\ (((x) & 4) ? _nop_(),_nop_(),_nop_(),_nop_() : 0),\ (((x) & 8) ? _nop_(),_nop_(),_nop_(),_nop_(),_nop_(),_nop_(),_nop_(),_nop_() : 0)
Oh dear! My post did not do that on preview!