(A lot of) Questions about PSC class
bulkhead
Posts: 405
First, I'd like to say thanks, Peter, for making the psc class, it really simplifies the use of the PSC with the Javelin. Now for the questions...
1. What's the difference between the one/two pin connections? Pros/cons?
2. If I have values that position my servos from the PWM class (ex: 173), what is the conversion factor to convert it to the values used in the psc class? My values range from 60 to 300, and the examples in the psc class have values ranging from 0-2000.
3. If ramp rate = a high number (like 60) will the PSC wait until the servo is in position before executing the next command? Can I get two servos to move simultaneously or no?
4. The getAngle() is assuming the travel from min to max = 180deg, correct? otherwise it would be inaccurate?
5. If I don't need to know the angle, can I just give it any number (and avoid ACF altogether)? Or is it used for positioning?
6. Finally, where do I place unsignedintmath and psc class so that it downloads to the Javelin when I upload my main program?
Sorry if some of these questions are obvious. I'm trying to move all my servo controls from the Javelin (its done with the PWM class now) to a PSC, and I have no experience with either of these two.
Thanks again.
1. What's the difference between the one/two pin connections? Pros/cons?
2. If I have values that position my servos from the PWM class (ex: 173), what is the conversion factor to convert it to the values used in the psc class? My values range from 60 to 300, and the examples in the psc class have values ranging from 0-2000.
3. If ramp rate = a high number (like 60) will the PSC wait until the servo is in position before executing the next command? Can I get two servos to move simultaneously or no?
4. The getAngle() is assuming the travel from min to max = 180deg, correct? otherwise it would be inaccurate?
5. If I don't need to know the angle, can I just give it any number (and avoid ACF altogether)? Or is it used for positioning?
6. Finally, where do I place unsignedintmath and psc class so that it downloads to the Javelin when I upload my main program?
Sorry if some of these questions are obvious. I'm trying to move all my servo controls from the Javelin (its done with the PWM class now) to a PSC, and I have no experience with either of these two.
Thanks again.
Comments
The twopin uses seperate pins for transmit and receive and requires 2 uarts.
2.Values in the PWM class are timing values lowtime and hightime. The dutycycle
then equals hightime/(lowtime+hightime). If hightime = lowtime then the dutycycle
is 50%. The PSC uses values 250 to 1250 and 750 equals 50% dutycycle.
To convert from PWM to PSC use
pscvalue = (hightime/(lowtime+hightime))*1500
3. Check the PSC manual. I think it will allow concurrent operation.
4. Yes, Pmin value corresponds to 0 degrees, Pmax value corresponds to 180 degrees.
5. You can use setAngle() or setPosition(). setAngle() converts an angle to a position
and then calls setPosition(). The advantage of angles is·that it gives you a clear indication
of the servo position that is easy to check visually. Also, other servo controllers may
use other value ranges, but the servos still move from 0 to 180 degrees. If you write
your main application using angles you are independent of any value that a servo
controller happens to use. The class for that controller can hide that all (as does PSC class).
6. The classes go into the directory specified in the package directive.
That is the same folder you also find on the yahoogroup javelinCode for the classes.
regards peter
Also, couldn't the "acf" value in the psc class's init method be calculated within the method? It says to "Calculate as value = fraction(1800/(Pmax-Pmin)) * 65536"
Since Pmin and Pmax are given, why not just calculate it in the method?
Thanks.
of an unsigned divide. I recently updated UnsignedIntMath class and now
acf can be calculated on the javelin.
acf = UnsignedIntMath.ufrac(1800,Pmax-Pmin);
I have uploaded a new psc class that calculates acf internally.
This means the initChannel() method no longer has an acf parameter.
Please update your application for this.
http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/peripheral/servo/psc/
The advantage of using two pins is that there is no need to restart a uart everytime
the datadirection changes. This is not a real disadvantage because you must wait for
the psc reply, with either 1 or 2 uarts.
regards peter
when two psc boards are networked.
http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/peripheral/servo/psc/
regards peter