I am trying to program my motor using RS-232 to move with the following parameters
speed , S = 20
Acceleration , A = 100
Position , P = 10000
The default resolution is 1000 pulses/revolution the motor will rotate 10 times.
The motor manual url : http://www.rpmechatronics.co.uk/assets/uploads/1286265057cool-muscle-manual.pdf
At the moment it does not work .
Please find my code below . I have also attached the manual to use the motor . I am using Dynamic Mode Command
void setup() {
//Servo drive port setup
//Delay a short ammount before opening the port
delay(100);
Serial.begin(19200); // opens internal port for debug use, sets data rate to 19200 bps
Serial.println("Hello !!!");
Serial.println("Debug Serial port working OK");
//Open Serial port for servo drive (RS-232)
Serial2.begin(19200,SERIAL_8N1);
}
void loop() {
Serial2.print("P=");
Serial2.print(10000);
Serial2.print("S=");
Serial2.print(20);
Serial2.print("A=");
Serial2.print(100);
Serial2.print("^");
}
Hi Paul ,
The code does establish a RS232 communication with the motor . And I was able to move it using the below code :
Changing parameters in the below code didnt change the motor's behavior and I believe it is not correct.
Hence I am trying to debug the problem using the first code I had posted . Would this help you?
//Servo Parameters
//Positions used in the drive
int iPosHome = 0; //home / safe position
int iPosTip = 498; //Mode where a tip is performed and also the uMode
int iPosuMode = 502; //Mode where the uMode moves between to and the iPosTip
void setup() {
//Servo drive port setup
//Delay a short amount before opening the port
delay(100);
Serial.begin(9600); // opens internal port for debug use, sets data rate to 9600 bps
Serial.println("Hello Anish !");
Serial.println("Debug Serial port working OK");
//Open Serial port for servo drive
Serial2.begin(19200,SERIAL_8N1);
}
void loop() {
callReturnToHome();
//send the positions to the drive
SendPositionsToDrive();
}
void SendPositionsToDrive(){
//send the drive positions to the servo drive
Serial2.print("p1=");
Serial2.println(iPosHome);
Serial2.print("p2=");
Serial2.println(iPosTip);
Serial2.print("p3=");
Serial2.println(iPosuMode);
}
void callReturnToHome(){
//tells the servo motor to move back to the home position "0"
Serial2.println("]");
Serial2.println("[3");
}
Hi John ,
The differences are because the one with S , A , P is used for dynamic programming and mostly a quick check to see if the motor is working .
Whereas p1 , p2 ,p3 is what I will be using later on once I get my motor working properly. (And its because this part is someone else code ) - this I will have to change based on the whether I can get the code with S,A,P working .
The differences are because the one with S , A , P is used for dynamic programming and mostly a quick check to see if the motor is working .
Whereas p1 , p2 ,p3 is what I will be using later on once I get my motor working properly.
Why? If the motor expects S, A, and/or P, why would you send it p1, p2, or p3?