Make the delay less than 1 ms

General discussion on mikroPascal PRO for ARM.
Post Reply
Author
Message
serg1980
Posts: 44
Joined: 19 Mar 2014 05:58

Make the delay less than 1 ms

#1 Post by serg1980 » 20 Oct 2021 07:08

Hi!
How can I make the delay less than 1 ms? The Delay_us() function is not suitable because you need to change the delay value while the program is running

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Make the delay less than 1 ms

#2 Post by filip » 20 Oct 2021 08:43

Hi,

You can make a function that will call Delay_us a variable number of times per an input parameter.

Regards,
Filip.

serg1980
Posts: 44
Joined: 19 Mar 2014 05:58

Re: Make the delay less than 1 ms

#3 Post by serg1980 » 20 Oct 2021 09:41

I would like it to be like this:

Code: Select all

i:=a+ b;
delay_us(i)
but it doesn't work

Code: Select all

Vdelay_ms(); //OK
Vdelay_us();//NO

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Make the delay less than 1 ms

#4 Post by filip » 22 Oct 2021 08:16

Hi,

Something like this :

Code: Select all

for (k = 0; k < i; k++) {
  delay_us(1)
}
Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for ARM General”