Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to use delay in ASM language

Status
Not open for further replies.

020170

Full Member level 4
Joined
Jan 31, 2005
Messages
231
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
2,221
I want to use delay function in assembly language because I'll use DRAM.

DRAM of mine have refresh time of 2ms.

how to use delay function in ASM language?

just use "NOP" operand ?

or "WAIT" operand?

how to know how long these operand were taken?

thanks.
 

The best way depends on what processor you are using and if you are using a multitasking
operating system or a scheduler and the structure of your software.

You may have hardware timers that you could use instead of relying on a delay routine
taking a certin number of machine cycles to execute. It might be best to have the
refresh done by an interrupt routine triggered by a timer.

Since you DRAM may loose it's contents if it is not refreshed you need to make sure
your refresh delay doe not exceed the maximum time. If you have interupt processing
interrupting the delay routine you need to consider how much that can extend the delay.

>just use "NOP" operand ?
If your processor is running at a few megahertz then you may need more NOP's than
you have program memory to hold so you would have to use a loop.

>"WAIT" operand?

Depends what the wait instruction does on your paticular processor.

>how to know how long these operand were taken?

Read the datasheet or programming manual for your processor/microcontroller.
 

    020170

    Points: 2
    Helpful Answer Positive Rating
The best delay procedure can be used in the microcontrollers is the hardware timers, read about these timer, TMR0, TMR1, TMR... etc. and you can find about it from the datasheet.

Believe me :D
 

Agree with the last two replies. Use if possible the µc timers, try to avoid sitting in a waiting loop. Setup a timer to run in the backgroung and go do some other useful things, and have the timer interrupt you.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top