5 mac_closeconnection, 6 mac_sendcommand – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 112

Advertising
background image

6.5

MAC_CloseConnection

This function enables the user to close communication

Syntax:

int MAC_CloseConnection

( COMMUNICATION_HANDLE hCommunication )

Input Parameters:

COMMUNICATION_HANDLE hCommunication

Return Value:

int Close connection status:

0 OK;
1

The API library is not initialized;

2

Zero Communication handle;

3

Bad Communication handle;

Use MAC_GetLastError to retrieve the error string.

Sample:

if( !MAC_CloseConnection( hCon ) ) return FALSE;

6.6

MAC_SendCommand

This function enables the user to send commands to, and receive responses from, the
connected Multi-axes supervisor.

Syntax:

Int MAC_SendCommand

( COMMUNICATION_HANDLE hCommunication,

LPCTSTR cszCmd,
LPTSTR

szOut,

WORD

wOutSize /*=1024*/,

DWORD dwTimeout/*=1000*/);

Input Parameters:

COMMUNICATION_HANDLE hCommunication

Multi-axes supervisor communication handle.

LPCTSTR cszCmd

Input string, containing command or
expression, to be sent to the MAS. This string
may be a command to the SimplIQ drive
connected to the Maestro or command to the
Maestro itself.

WORD wOutSize

Size of string for response receiving.

DWORD

dwTimeout

The maximum wait time for receiving a
response from the drive, in milliseconds.

Maestro

Software Manual

The Maestro API

MAN-MASSW (Ver. Q)

6-5

Advertising