Sign in

Not a member? | Forgot your Password?



Search Comp.Arch.Embedded



Search tips

Recent Blogs on EmbeddedRelated

How to Analyze a Differential Amplifier
posted by Jason Sachs


Little to no benefit from C based HLS
posted by Christopher Felton


Unit Tests for Embedded Code
posted by Stephen Friederichs


DSPRelated and EmbeddedRelated now on Facebook & I will be at EE Live!
posted by Stephane Boucher


Using a RTLSDR dongle to validate NRF905 configuration
posted by fabien le mentec


Introduction to Microcontrollers

Chapter 1: Beginnings

Chapter 2: Further Beginnings

Chapter 3: Hello World

Chapter 4: More On GPIO

Chapter 5: Interrupts

Chapter 6: More On Interrupts

Chapter 7: Timers

Chapter 8: Adding Some Real-World Hardware

Chapter 9: More Timers and Displays

Chapter 10: Buttons and Bouncing

Chapter 11: Button Matrix & Auto Repeating

Chapter 12: Driving WS2812 RGB LEDs

See Also

ElectronicsDSPFPGA

Find us on Facebook





Discussion Groups | Comp.Arch.Embedded | How to generate delay of 360ns for an embedded application using c

There are 4 messages in this thread.

You are currently looking at messages 1 to 4.


So far in April, you have voted 0 times ou of a total of 0 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.

How to generate delay of 360ns for an embedded application using c - Ravi kumar.N - 2004-12-03 04:12:00

Respected Respects,
                       Iam RaviKumar.N working on intel 386-EX
processor.I have interfaced CF card with this processor.Iam writing
data into a particular sector of CF card and again retrieving the same
from the same sector.


   I want to generate a delay of 360ns between this  writing and
reading operation. I want this function to be written in c.What logic
has to be used.


  Iam using a cross compiler.

   With Regards
     Ravi Kumar.N

_____________________________
 Free pdf download: What Every Programmer Should Know About Memory.

Re: How to generate delay of 360ns for an embedded application using c - Paul Burke - 2004-12-03 04:51:00

Ravi kumar.N wrote:
> Respected Respects,

No one respects ME and gets away with it!

> 
>    I want to generate a delay of 360ns between this  writing and
> reading operation. I want this function to be written in c.What logic
> has to be used.

Less than, more than, exactly equal to?

You can't do exact timing in software. Depending on your clock speed, a 
timing loop, an dummy access to a memory location, an inline assembler 
bit with a few NOPs in it, use your ingenuity. But if you want it to be 
exact-ish you'll have to disable interrupts while you are doing it- 
maybe just disable interrupts, enable interrupts will be enough?

Paul Burke

_____________________________
 Free pdf download: Advanced Linux Programming.

Re: How to generate delay of 360ns for an embedded application using c - moocowmoo - 2004-12-03 06:21:00

"Ravi kumar.N" <r...@sunlux-india.com> wrote in message
news:3...@posting.google.com...
> Respected Respects,
>                        Iam RaviKumar.N working on intel 386-EX
> processor.I have interfaced CF card with this processor.Iam writing
> data into a particular sector of CF card and again retrieving the same
> from the same sector.
>
>
>    I want to generate a delay of 360ns between this  writing and
> reading operation. I want this function to be written in c.What logic
> has to be used.
>
>
>   Iam using a cross compiler.
>
>    With Regards
>      Ravi Kumar.N

This delay is too small for the standard time libraries so you'll have to
make it hardware dependent. If you have a 25MHz processor you'll need to
wait 9 clock cycles. Something simple like this would be a start, then you
can use a scope to fine tune it. Make sure you don't have optimisation
switched on or the code will probably vanish. Also if you change your
processor or clock you'll have to check it again.

// buggy delay loop
int i;
for (i=0;i<5;i++);

Peter



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.779 / Virus Database: 526 - Release Date: 19/10/04



_____________________________
 Free pdf download: Introduction to Embedded Systems.

Re: How to generate delay of 360ns for an embedded application using c - Grant Edwards - 2004-12-03 10:37:00

On 2004-12-03, Ravi kumar.N <r...@sunlux-india.com> wrote:

> on intel 386-EX
> processor.I have interfaced CF card with this processor.Iam writing
> data into a particular sector of CF card and again retrieving the same
> from the same sector.
>
>
> I want to generate a delay of 360ns between this  writing and
> reading operation. I want this function to be written in c.What logic
> has to be used.

Insert a number of noops between the two operations, we'll call
that number N.  

Measure the time between the operations with an
oscilloscope.  

Ajust N.

Repeat.

-- 
Grant Edwards                   grante             Yow!  I will invent "TIDY
                                  at               BOWL"...
                               visi.com            

_____________________________
 Free pdf download: Advanced Linux Programming.