Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

how to write delays in asm

Status
Not open for further replies.

vortech1

New Member
how do i write delays:seconds,millisecond,microseconds for my macro which i plan to use over and over again.exactness to would be great.someone teach me please.
 
vortech1 said:
how do i write delays:seconds,millisecond,microseconds for my macro which i plan to use over and over again.exactness to would be great.someone teach me please.

Easiest way to do delays is to look on the PICList, they have a delay code generator - enter your required delay and clock speed, and it gives you the code.

If you check my tutorials, many of them include delay routines which originated there.

Using a MACRO isn't a very good idea, it will generate seperate code every time it is called in the source code - far better to use a simple call to a subroutine.
 
Going by instruction counts is tricky, your processor can't be running any other routines unless you know exactly how many cycles they take and then never change them.

Using one of the timers and an interrupt is sometimes a better idea.
 
you can join picoz group at yahoo and you will find a delay file

**broken link removed**
 
Last edited by a moderator:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top