
18
Example 1 – Tuning of Controller
This example assigns the PID parameters to Axis A and read back for
confirmation.
CSerial port;
If(port.open(2, 115200))
// Open serial port and configured
{
// to baud 115200 bps
char Kp[7] = “KP 100”;
// Set Proportional gain for Axis A
Kp[6] = 0x0D;
// Terminate it with a Carriage Return
char Ki[7] = “KI 800”;
// Set Integral gain for Axis A
Ki[6] = 0x0D;
// Terminate it with a Carriage Return
char Kd[5] = “KD 2”;
// Set Differential gain for Axis A
Kd[4] = 0x0D;
// Terminate it with a Carriage Return
char query[5] = “KP ?”;
// Query for KP
query[4] = 0x0D;
// Terminate it with a Carriage Return
char readBuf[10];
// Container for reply
port.send(Kp, sizeof(Kp));
// Send KP to controller
port.send(Ki, sizeof(Ki));
// Send KI to controller
port.send(Kd, sizeof(Kd));
// Send KD to controller
port.send(query, sizeof(query));
// Query for KP
port.read(readBuf, sizeof(readBuf));
// KP is stored in readBuf
}
Example 2 – Profiled Move
In this example, Axis B moves a distance of 50,000 counts at the speed of
30,000 counts/sec and an acceleration and deceleration of 100,000
counts/sec
2
. It motor stops once it reaches 50,000 counts.
CSerial port;
If(port.open(2, 115200))
// Open serial port and configured
{
// to baud 115200 bps
char SE[6] = “SE, T”;
// Servo enable for Axis B
Содержание MK-200C
Страница 1: ...M MK K 2 20 00 0C C U Us se er r s s M Ma an nu ua al l Revision 1 1 MOTKA LLP ...
Страница 4: ...4 List of Tables Table 1 MK 200C terminal definitions 9 Table 2 Document revision history 25 ...
Страница 7: ...7 Related documents Command Reference MOTKA Motion Companion User s Manual ...
Страница 22: ...22 3 3 Package Information Figure 12 MK 200C package outline ...
Страница 26: ...26 ...