Creating 1uS delay

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Creating 1uS delay

Post by Ron »

Hi,

I want to create a 1uS delay while running at 19.6608MHz.

I know I how to use delay_10us(1); and I think there is delay_100us(1);.

I do not think there is a 1us delay function.

How do I calculate how long an instruction takes to execute?

I imagine NOP can be used so please start with this.

How many NOP statements are required for 1us delay?

Can you provide example with different commands that take up different number of clock cycles please.

How/where can I find out how many cycles each command takes?


Thank you,

Ron

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Creating 1uS delay

Post by medelec35 »

Hi Ron,
You can try

Code: Select all

delay_us(1);
Martin
Martin

Post Reply