Putdata(&txdata)

Do I need to call Putdata(&txdata); everytime I want a PWM value (1-7) to move the motor? and can I call it anytime it changes or are there specific times i can only call it?

I have various loops inside the autonomous loop
Here is a small one

while (movefoward = 1)
		{
			pwm03 = pwm03;
			pwm01=130;
			pwm02=130;
			Putdata(&txdata);
			fowardcounter++;
			if (fowardcounter > amountfoward) //If this has moved for amountfoward loops then stop
			{
				movefoward = 0;
			}
		}

can I do that in order to have those values executed? or do i need to do it another way

I don’t know the answer to your question, but I suspect it might be ‘no’. May I just ask what ‘pwm03 = pwm03;’ is there for? It seems kind of redundant.

I dont know really, I thought I would just put it there to keep the same value just incase.

while (movefoward = 1)
this is an infinite loop!
you want
while(moveforward == 1). “==” checks for equality. “=” assigns a variable.

I belive you have to call PutData all the time, it lets the master processor know the user processor is still alive. Someone who knows more about the IFI stuff can tell you for sure. I would call it every loop.

Edit: Call the PutData function once per loop. So, you have


void User_Autonomous_Code(void)
{
Getdata(&rxdata); 
//do whatever
Putdata(&txdata);
}

So every loop, you get data and put it. The master processor will not let the system work if you don’t execute Getdata and Putdata once every loop, but only once! Only call putdata at the very end of every Autonomous loop, so you edit your pwm values and do your calculations, then the very last thing is to Putdata.

Oh, alright… that is going to require a lot of code editing then -_- thanks for finding that error on the assignment I forgot about that.