Sign in

Not a member? | Forgot your Password?


Search Comp.Arch.Embedded

Search tips

Free PDF Downloads

Advanced Linux Programming

What Every Programmer Should Know About Memory

Introduction to Embedded Systems

C++ Tutorial

Embedded Systems - Theory and Design Methodology

Microcontroller Programming and Interfacing

Introduction to Microcontrollers


More Free PDF Downloads

Recent Blogs on EmbeddedRelated

Introduction to Microcontrollers - 7-segment displays & Multiplexing
posted by Mike Silva


OOKLONE: a cheap RF 433.92MHz OOK frame cloner
posted by Fabien Le Mentec


Someday We’ll Find It, The Kelvin Connection
posted by Jason Sachs


Short Circuit Execution vs. Unit Testing
posted by Stephen Friederichs


Practical protection against dust and water (i.e. IP protection)
posted by Dr Cagri Tanriover


Specifying the Maximum Amplifier Noise When Driving an ADC
posted by Rick Lyons


Introduction to Microcontrollers

1 - Beginnings

2 - Further Beginnings

3 - Hello World

4 - More On GPIO

5 - Interrupts

6 - More On Interrupts

7 - Timers

8 - Adding Some Real-World Hardware

9 - More Timers and Displays

10 - Buttons and Bouncing

11 - Button Matrix & Auto Repeating

12 - Driving WS2812 RGB LEDs

13 - 7-segment displays & Multiplexing

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 August, 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

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

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



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