Code:
int time;
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
i++; // this will increment the 'i' variable by 1.
time = (i * 262)/2500 // if you avoid the decimal, by multiplying the time span by 10, your code will execute faster because it will not use a floatig points.
// I divide the time(in 10000enths of a second) by 2500 so I get a result in 1/4 of a second
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
no problem for the post... im sorta confused.. if the computer cycles at 26.2 ms... will it not cycle rougly 38 times in a second?
if so... your code.. where 'i' is increased by 1 every cycle, when it reaches 1 second.. i == 38.....
if so... time == 4 roughly at 1 second... shouldnt u divide it by 4? to get 1 second??? srry if i confused you
lol srry just trying to understand the logic behind 'time'