any body knows how to generate microsecond delay plz post all the code
Generally, I agree. I've marked the non-working code as such.
In the future, please mark code jokes so that a casual browser won't get confused and try to make it work.
Jon
So, I suppose the mnemonic "RTS" stands for "Return To Somewhere"...?
I'm a bit against posting of intentionally broken code since there always exists people who think it is working.
In this case, there is mismatch of push count. And the popped register is different from the pushed. There is a question about regsiter size contra constant size, the loop reloads inside the loop, ... The problem is that the list may get a new thread sometime in the future linking to this code and asking why it doesn't work.
"One can't do anything but get an infinite delay."
Which may be preferable to pushing more than is popped and returning to oblivion.
One can't do anything but get an infinite delay.
The interesting thing here is what to do to get 1us delay and what to do to get 12,000,000us delay, and how long 1us is for the specific processor when relating to clock freqiencies, cycle counts, ...
I think Jaff's routine is meant to be taken as a joke.
Please expand on this comment.
CJNE A, # 0, LOOP ; goto loop if regista a is zero
DELAY: PUSH B ;push regista b PUSH R0 ;push regista r0 LOOP: MOV A, # 1000 ;load regista a with 100 DEC A ; decrament regista a CJNE A, # 0, LOOP ; goto loop if regista a is zero POP R1 ; pop regista ? RTS ; return to the code
Note The above code definitely does not work. I'm sure it was intended as a joke.
Just count 1000 nanoseconds!
View all questions in Keil forum