program Modbus on C?
p02osmaj
Posts: 14
Hello everyone, first I'm spanish, so my english is not very good and if you want to correct me anything .. great for me
Ok, I want to do a program that control 8 servos of a robot, and I want to do it in C because is the only language that I know. I need to do a Modbus comunication, but I don't see any library about it (for Modbus).
I want to ask you if I can do it,
and if I can not: if I can do that part of program in SPIN (part of Modbus comunication), and programme in C the rest of the program that control the servos and so on.
I don't know if exist any "linker" to be able me to programme in two different languages an unique program.
Thank you !
Ok, I want to do a program that control 8 servos of a robot, and I want to do it in C because is the only language that I know. I need to do a Modbus comunication, but I don't see any library about it (for Modbus).
I want to ask you if I can do it,
and if I can not: if I can do that part of program in SPIN (part of Modbus comunication), and programme in C the rest of the program that control the servos and so on.
I don't know if exist any "linker" to be able me to programme in two different languages an unique program.
Thank you !
Comments
There are two objects in the OBEX for ModBus:
http://obex.parallax.com/search/Modbus
I'm not sure these will help as I do not know ModBus or C.
Make sure to unzip first. Then, use SimpleIDE to open ModBus Slave Test.side. It should compile, but I do not have hardware to test it. If you do not have SimpleIDE, get it here:
http://learn.parallax.com/propeller-c-set-simpleide
To get more familiar with other Propeller C libraries and features, I recommend going through these tutorials:
http://learn.parallax.com/propeller-c-tutorials
Andy
If these are hobby servos, you can also use the Propeller to control them directly. It would only take one of the Propeller chip's eight processors. Code running in that one processor would control all eight servos. An example of one servo is here:
http://learn.parallax.com/propeller-c-simple-devices/standard-servo
That example can be modified like this:
...
servo_angle(14, 900); // P14 servo to 90-degrees
servo_angle(15, 1200); // P15 servo to 120 degrees
servo_angle(16, 300); // P16 servo to 30 degrees
...
The servo library launches code into another processor that takes care of the servo signalling. The library also keeps track of which I/O pins are sending which signals.
Industrial servos need one cog each one? or can be used one cog for all of them?
I do not know the control signal protocol for the servos you are using. If it is identical to the hobby servos (probably not), it would take just one processor. How many processors it would take depends on the signaling. I'm assuming it could all be fit into a single processor, but it might take some custom code, which can be time consuming to develop.
Since you already have Modbus code, might as well give it a try first.
Andy
The servors are Panasonic Minas Liqi