Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/29/02 10:50
Read: times


 
#28139 - RE: How to create a NOP in C
unsigned char x;
(...)
x= x;
(...)

the "x= x;" line introduces some delay. The exact amount of time delay has to be determined browsing the machine code the compiler creates.

When I need a little delay after changing the state of an output pin, I use to repeat the last line. For example:

(suppose P1.0 is high here)
P1.0= 0;
P1.0= 0;
P1.1= 1;

generates a low level pulse of 2 machine cycles in P1.0. But I recommend to test the machine code,... imagine your compiler optimizes the code eliminating the redundant P1.1= 0 !!.

List of 10 messages in thread
TopicAuthorDate
How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      
RE: How to create a NOP in C            01/01/70 00:00      

Back to Subject List