Home/Support/Support Forum/How to create a delay in microseconds?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to create a delay in microseconds?

0 votes
Hi Guys

Is there an elegant way of creating a delay of say 20-50us? I can use the MS_TIMER for millisecond delays but wanted to see if there was anything better than just having a dummy loop going around to create a delay in program advancement.

I'm using a RCM6700 and 10.72E

Thanks
asked Dec 10 in Rabbit by 3lionsCT New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
It depends on what you need the delay for.

Does it need to be precise, or is it just a minimal delay before continuing with some action?

Do you want to be doing something else while waiting for the delay to expire?

The simplest solution is to calculate the duration of an assembly loop over some "nop" opcodes, perhaps with a calculation so you can adjust it for different us delays.

None of the code in Dynamic C related to microsecond delays applies to the Rabbit 6000, so you'll be on your own to figure out the necessary timing to get the result you're looking for. I'd recommend toggling an output pin before and after the delay code and measuring the pulse with a scope or logic probe.

It's also possible that Timer B or Timer C could be useful. I know they can pulse output pins with durations in the microsecond range, but you might be able to connect an ISR that sets a global flag when the delay has passed.
answered 3 days ago by TomCollins Veteran of the Digi Community (2,225 points)
...