Hi all, i have a small problem with delay_ms() and delay_us() functions. I`m trying to control some servomotors with this functions and i need something like "delay_ms(x)" for a smoother controll in which "x" is a variable that increments and decrements.BUT the problem is that function delay_ms() doesn`t support a variable like that(simply don`t work). I tried to make my own delay functions :
Code:
void delay_u(long int u){
long int i;
for(i=0;i<u;i++){
delay_cycles(5); // 20Mhz = 200ns *5 =1us
}
}
void delay_m(long int m){
long int j;
for(j=0;j<m;j++){
delay_u(1000);
}
}
this doesn`t work either.
I`m using a 20Mhz crystal and CCS versions 3.203 or 3.22
Can somebody help me please???
Many thanx,
Vodka
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Wed Oct 03, 2007 7:58 am
Here are two functions for a long delay with a variable parameter (16-bit).
You only need these functions if you have vs. 2.xxx or 3.xxx of the
compiler. In version 4, this feature is included in the delay_us() and
delay_ms() functions.
Vodka
Joined: 13 Sep 2007 Posts: 14
Posted: Wed Oct 03, 2007 11:12 am
Yes indeed it works, very silly of me .
Thanks again PCM programmer very much
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum