Propeller and SSC-32 servo controller
moomoo
Posts: 27
I'm loving the Propeller Chip so far!
I just got the propeller to communicate to an SSC-32 servo controller, finally, using the full delux object, like this...
ssc.str(string("#0 P1500 S1000",13))·· 'servo #0, 1500uS(center), speed 1000
Now my problem is, if I have an accelerometer input and want the servo to change according to the input(what ever that might be), how do I change that "P1500" to something that's changing all the time.
I'm have a hard time figuring out how to do this. I know there is another way to go about this.
Any help would be greatly appreciate!
Tony
I just got the propeller to communicate to an SSC-32 servo controller, finally, using the full delux object, like this...
ssc.str(string("#0 P1500 S1000",13))·· 'servo #0, 1500uS(center), speed 1000
Now my problem is, if I have an accelerometer input and want the servo to change according to the input(what ever that might be), how do I change that "P1500" to something that's changing all the time.
I'm have a hard time figuring out how to do this. I know there is another way to go about this.
Any help would be greatly appreciate!
Tony
Comments
Now create a method which will take the servo number as an argument and send the string message to the controller:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I'm going to try this right now, this really helps alot!
After scatching my head for too long, it starts to hurt.
Thanks Paul.
I tried some things and I can't seem to get it to work. I attached my code so you or somebody can see what I'm doing wrong. I'm missing something somewhere?
I'm trying to center all 32 servos at 1500uS and speed of 1000ms. Is "num" the array for the pin number on the servo controller? And for now, I just set pos at 1500 and speed at 1000.
NUM is not an array, it's the index value into the arrays.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I am a bit new to propeller, so I apologize in advance if I'm doing something trivially wrong. I've looked at the FullSerialDuplex code and I noticed that it's an object of the above code, but I'm not quite sure how it's being included.
Basically all I'm trying to do at the moment is to get a serial tx output going any ideas?
Btw. I'm puzzled by the above code using the same pin for transmit and receive, unless the mode parameter would be 2 (iirc), but that would not be full duplex and I'm guessing the SSC-32 does not work this way. I think you can only transmit with that code, i.e. you'd have to connect the receiving end (SSC-32 RX pin) to propeller pin 7. To receive anything, you'd need a second pin (unless you like to receive only the same bits that you transmit).
Post Edited (_Mark) : 9/24/2007 12:45:21 PM GMT
That's my problem. Oh and I'm sure that I'm using pin 7.
Also in the code above, what do the first three numbers in the parentheses specify (7,7,0)
The first two parameters (rxpin and txpin) are used to tell the object which pins to use for receiving and transmitting, resp. In the code above, it apparently uses pin 7 for both, which is what puzzles me. But since you're only trying to transmit for now, it should be fine. Just don't connect the SSC-32 TX pin to it (if I understand things right, this could cause a short-circuit and result in permanent damage). So, make sure only the SSC-32's RX pin is connected to the propeller, for now.
The third parameter (mode) is documented to mean the following:
mode bit 0 = invert rx
mode bit 1 = invert tx
mode bit 2 = open-drain/source tx
mode bit 3 = ignore tx echo on rx
I.e. the first 4 bits each toggle a specific feature of the object. Paul Baker apparently indicates with the code above that all bits should be zero. I can't test this because I don't have an SSC-32, but it makes sense, and it works for my ASC16 which (I think) is one of its predecessors.
The bit I'm not sure about is bit 2 (open-drain/source the tx output). If my interpretation of the assembly code in FullDuplexSerial is correct, then a 0 for this bit means source TX, and a 1 means open drain. This is opposite from what the documentation would suggest, however it makes sense to have sourcing as default behaviour (i.e. when mode is zero). I'm guessing that's what it is, because, as far as I can tell, the serial comms tests I have done with the propeller so far do not involve open drains nor the pull-up/down resistors that go with it, and I have used mode 0 in each case.
If my ranting about that mode parameter makes no sense to you, don't worry about it. In short, using 0 should work. One thing left to check, is whether or not pin 7 on your propeller is already connected to anything else. This may be the case depending on the circuit board your propeller is on (if any). I'm not intimately familiar with all available ones, so I couldn't tell you without looking it up. Let me know what you find out.
Post Edited (_Mark) : 9/24/2007 6:48:22 PM GMT