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.
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.