I want to make an increment(++) to a variable initially slowly then speed up linearly. For example, using a timer interrupt(every 1 sec) in increase the variable x by 1.so at first variable get incremented by 1 in 1 sec. Then it should get incremented by 1 in 0.9 sec, then it should get incremented by 1 in 0.8 sec and so on linearly. who to do it?
Fact is that I have a switch case loop function for bldc motor.
switch(step)
{
case 0:
{
commutation 1
}
break;
case 1:
{
commutation 2
}
break;
case 2:
{
commutation 3
}
break;
case 3:
{
commutation 4
}
break;
case 4:
{
commutation 5
}
break;
case 5:
{
commutation 6
}
break;
}
}
I want so run commutation steps one by one inside a timer interrupt.
void Handle_T13()// every 10000ms
{
step++;
if(step==6)
{step=0;}
}
It works fine. But now I want to increase the speed gradually. so I need to increase the increment of steps gradually. !!!