Hi Team
How can i generate a delay in nano seconds my clock is 40Mhz and using a 18f4620
Thanks
Wayne
delay
Moderator: Benj
-
saschech@gmx.de
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
Re: delay
Hello wayne
I think you can not do these:
http://www.sprut.de/electronic/pic/8bit ... ht8720.htm
at 20mhz =
Almost all commands of a PIC take a cycle, where a cycle is 4 external PIC bars. A 20-MHz PIC creates so 5 million instructions per second, as in a second 5 million cycles or 20 million external clocks. A cycle is here 0,2 microsecond (0.2 µs) long.
at 40mhz = 0,2ys : 2 = 0,1ys = 100ns........
1 Pikosekunde = 0,000 000 000 001 Sekunden = 10-12 Sekunden
1 Nanosekunde = 1000 Pikosekunden = 0,000 000 001 Sekunden = 10-9 Sekunden
1 Mikrosekunde = 1000 Nanosekunden = 0,000 001 Sekunden = 10-6 Sekunden
1 Millisekunde = 1000 Mikrosekunden = 0,001 Sekunden = 10-3 Sekunden
1 Sekunde = 1000 Millisekunden
Regards Wolfgang
I think you can not do these:
http://www.sprut.de/electronic/pic/8bit ... ht8720.htm
at 20mhz =
Almost all commands of a PIC take a cycle, where a cycle is 4 external PIC bars. A 20-MHz PIC creates so 5 million instructions per second, as in a second 5 million cycles or 20 million external clocks. A cycle is here 0,2 microsecond (0.2 µs) long.
at 40mhz = 0,2ys : 2 = 0,1ys = 100ns........
1 Pikosekunde = 0,000 000 000 001 Sekunden = 10-12 Sekunden
1 Nanosekunde = 1000 Pikosekunden = 0,000 000 001 Sekunden = 10-9 Sekunden
1 Mikrosekunde = 1000 Nanosekunden = 0,000 001 Sekunden = 10-6 Sekunden
1 Millisekunde = 1000 Mikrosekunden = 0,001 Sekunden = 10-3 Sekunden
1 Sekunde = 1000 Millisekunden
Regards Wolfgang
Last edited by saschech@gmx.de on Wed Mar 09, 2011 6:48 pm, edited 1 time in total.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: delay
Dear Wayne,
As far as I know, the minimum delay is one NOP (no-operation program step). You can put that in a C-macro as:
{
nop
}
The delay depend on the crystal frequency divided by a factor 4. Thus with a 40 Mhz crystal the delay will be 10 Mhz or 100 nsec. This is the minimum delay which is possible.
Regrads
Jan Lichtenbelt
As far as I know, the minimum delay is one NOP (no-operation program step). You can put that in a C-macro as:
{
nop
}
The delay depend on the crystal frequency divided by a factor 4. Thus with a 40 Mhz crystal the delay will be 10 Mhz or 100 nsec. This is the minimum delay which is possible.
Regrads
Jan Lichtenbelt