Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   What is the Limit_Mix function (http://www.chiefdelphi.com/forums/showthread.php?t=51304)

brennerator 08-01-2007 21:33

What is the Limit_Mix function
 
Can someone describe this function to me?

Im trying to reduce the speed of the motors; how would I edit this:

pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);

jgannon 08-01-2007 21:41

Re: What is the Limit_Mix function
 
The limit mix function is a bit of software that takes the two axes from one joystick, and calculates the corresponding PWM outputs. In order to adjust a PWM value by a constant factor, try something like this:

Code:

pwm01 = (pwm01-127)*0.75+127
There may be a typecasting issue there, so you'll need to play around with it. However, the idea is that you need to recenter the value around 0 (by subtracting 127), lessen the magnitude (by multiplying by less than 1), and then shift back to the normal range (by adding the 127 back). In this case, this code would reduce a motor to 75% of its original speed. If that doesn't make sense, feel free to ask for more clarification.

brennerator 08-01-2007 21:44

Re: What is the Limit_Mix function
 
Thats perfect; THank you so much!

Also one problem; when I try to edit the MPLab code and build it it says no source files in teh project.

How do I get around this?

Eclipse 08-01-2007 22:10

Re: What is the Limit_Mix function
 
I believe that means you set up MPLab wrong when you were installing it. However, I'm not sure exactly what the problem is. Did you install the compiler first and then MPLab or the other way around?

brennerator 08-01-2007 22:14

Re: What is the Limit_Mix function
 
the other way around. I set up MP lab then the compiler


All times are GMT -5. The time now is 01:30.

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