I would like to be able to write code that implements short delays (a few microseconds) but where the code generated automatically adapts to the speed of the processor. i.e. as the processor speed is changed, the delay remains constant. I don't suppose there is a predefined macro constant available (that Keil hasn't told us about) that makes the cycle time available to the source code? I guess this is quite a common problem. uVision seems to know all about time, so would it be difficult for a predefined constant to be provided?
NOTE: Do not use variables with this macro. Use constants only. Using a variable causes actual code to be generated for each ternary operator. Using constants causes the ternary operator to be evaluated by the preprocessor (which is what we want). Jon
I don't know how my formatting screwed up or the reply appeared out of order. But the example does work.
The problem (and I had this, too) is the \ at the end of the line. Aparently, this causes some problems in SQL server. I had to add a space after my \ for it to format correctly. Jon