![MOTKA MK-200 Скачать руководство пользователя страница 20](http://html1.mh-extra.com/html/motka/mk-200/mk-200_user-manual_1837971020.webp)
20
MR[15] = 0x0D;
// Terminate with Carriage Return
port.send(SL, sizeof(SL));
// Set speed limits
port.send(AL, sizeof(AL));
// Set acceleration limits
port.send(DL, sizeof(DL));
// Set deceleration limits
port.send(SE, sizeof(SE));
// Enable motors
port.send(MR, sizeof(MR));
// Move motors
}
Example 4 – Reading of Position
The position of any axis can be queried with the GP instruction.
CSerial port;
If(port.open(2, 115200))
// Open serial port and configured
{
// to baud 115200 bps
char query[7] = “GP ?,?”;
// Get position – A and B axes
query[6] = 0x0D;
// Terminate with Carriage Return
char readBuf[10];
// Container for reply
char posA[5];
// Buffer for Axis A position
char posB[5];
// Buffer for Axis B position
int i = 0;
port.send(query, sizeof(query));
// Query for position
// Once controller received the command, it will reply the positions.
port.read(readBuf, sizeof(readBuf));
// Read the positions
// Positions replied contained in readBuf are separated by 0x0D
// Read position of Axis A
while(readBuf[i] != 0x0D)
{
posA[i] = readBuf[i];
i++;
}
// Read position of Axis B
while(readBuf[i] != 0x0D)
{
posB[i] = readBuf[i];
i++;
Содержание MK-200
Страница 1: ...M MK K 2 20 00 0 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 200 pin definitions 9 Table 2 Document revision history 26 ...
Страница 7: ...7 Related documents Command Reference MOTKA Motion Companion User s Manual ...
Страница 23: ...23 Figure 14 Recommended PCB footprint ...
Страница 27: ...27 ...