Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Putdata(&txdata) (http://www.chiefdelphi.com/forums/showthread.php?t=35077)

SpeakerSilenced 20-02-2005 19:59

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
Code:

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

Greg Marra 20-02-2005 20:44

Re: Putdata(&txdata)
 
Quote:

Originally Posted by SpeakerSilenced
Code:

while (movefoward = 1)
                {
                        pwm03 = pwm03;
                        ...
                }


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.

SpeakerSilenced 20-02-2005 20:57

Re: Putdata(&txdata)
 
I dont know really, I thought I would just put it there to keep the same value just incase.

cdawzrd 20-02-2005 21:24

Re: Putdata(&txdata)
 
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
Code:

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.

SpeakerSilenced 20-02-2005 21:51

Re: Putdata(&txdata)
 
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.


All times are GMT -5. The time now is 04:38.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi