I need to send numerical values to the board rather then #0P1500, is there a way to program the ATMEGA microcontroller of the SSC so when it receives a numerical value such as 2000 it goes true some commands and then calculates what the #0P%d must be according to the new commands I want to add.
What should I use to manipulate the program inside the ATMEGA ?
The SSC-32 is a servo controller. Although it can be modified, the code is very tightly wrapped around some assembly functions and can’t be altered by novice programmers. The kind of questions you are asking, it’s almost as if you haven’t read the users manual for the SSC-32.
In the guide I did not see how I may integrate any additional coding to the original SSC 32 program. Anyways, my problem is this, as you may already know I am having the problem with Simulink data etc… and that characters can not be initialized in simulink, so my only way to solve this problem is to add two additional lines to the coding of the ATMEGA.
What I want is, since I am sending a 16bit undefined integer from Simulink port, I need to grab that value such as 2000 and integrate it in the following program:
temporary=sprintf(’#0P%d’,u);
fprintf(temporary);
where u is the value coming from simulink serial port. I am not sure how the ATMEGA receives the data since I don’t know how to access the code, never mind if its in assembly or C.
I am assuming that I can do this since the ATMEGA used is basically another microcontroller like any other. If I can’t do this in any way, then I’d have to use a PIC18 or ARM9 microcontroller in which I have to manipulate the PWMs myself. (can’t afford more time for delivery and programming them)
I’m sorry, but I just don’t understand why you want to try and alter a firmware for a servo controller (very complicated and difficult) rather than find the proper way to format the data for simulinks serial output.
regards the binary input firmware instead of ascii, I am trying to move only 1 servo, but I still did not understand the hex relationship with the ascii commands. i.e I still dont know how to relate the position of the angle in hex.
In my project I took a relationship between the height of the ball with respect to the servo angle in terms of P2250 to P1850. How can I find the relationship between the P2250 to P1850 in terms of hexadecimal values or binary ?
I don’t know if I understood it well but if I send a value of 128 (decimal) from simulink, the port monitor will show that a value of 80 (hex) is being sent. Does this mean that the servo controller received the information that the #0 channel is selected??
Also does the binary information have to be sent in sequential manner or in a matrix form? I am asking because if this is the case, I will be sending the binary value in the following manner , u=uint8( 128, x, y) where x and y represent a particular decimal number also uint8 means an 8bit output binary . ( assume x = 5 , y= 220) this will show in the port monitor the following result 80 05 DC as an output, Will the servo motor tern to #0P1500 ?
I hope I understood it well.
Thanks again for the help, I really appreciate it.
Somewhere on this forum there is a list of PS2 “strings” that can be sent to the SSC-32 with a terminal program like Docklight.
In the Docklight “shortcut” entry screen, you can enter data either in ASCII, Hex or Decimal values. Switch back and forth to see the conversions, and get a better feel for the data, and how all three representations depict the same binary value.
Sending the bytes (hex) 80 05 DC is the same as #0P1500, but you also need to send the move time when using binary mode. The full command to set servo 0 to 1500 as fast as possible is (hex)
80 05 DC A1 00 00
I will point out that ASCII characters are just bytes like every other byte. So the other way to set servo 0 to 1500 is to send (hex)
23 30 50 31 35 30 30 0D
This is just the string “#0P1500” shown in hex. I am not a Simulink programmer, but I would be very surprised if it did not have the ability to do this.
Is Simulink running on a regular PC or other computer that is connected to the robot? If so, the only way to do what you want to do is add a microcontroller, such as the Bot Board II/Atom PRO combination (programming software is FREE), that will control the SSC-32 on the robot. The microcontroller on the robot would directly control the SSC-32 as well as accept data or other commands from Simulink. Then it would do the processing you need done, create the proper SSC-32 commands, and finally send the correct commands to the SSC-32. This is why our robots have microcontrollers on them.