
14
PROGRAMMER'S GUIDE FOR v01.02.11
3.1 Establishing a connection with a Midra™
3.1.1 usage
This example gives you the proper way to establish the connection with a Midra™ device. It is made of
four recommended steps : socket opening, device type checking, command set version checking and
Midra™ registers read back.
3.1.2 summary of the commands sequence
socket opening initial step, TCP/IP connection and device ready wait for.
device type checking verifying the right expected device.
command set version checking verifying matching of controller commands and machine commands.
Midra™ registers read back machine current state retrieval.
3.1.3 detailed commands sequence
socket opening : As indicated in §CONTROLING MIDRA chapter, TCP/IP must be used to control
Midra™. The device acts as a server. Once the TCP connection is established, the controller shall
check that the device is ready, by reading the READY status, until it returns the value 1.
Syntax : *
Answer : *<value>
C
R
L
F
The controller shall wait and retry until it receives the value 1.
device type checking : This read only command gives the device type.
Syntax : ?
Answer : DEV<value>
C
R
L
F
The numerical <value> gives the
connected device type. Other values match other Analog Way devices.
command set version checking : This read only command gives the
version number of the command set. It is recommended to check that
this value matches the one expected by the controller.
Syntax : VEvar
Answer : VEvar1
C
R
L
F
Meaning that the device is using a command set in version 1.
Midra™ registers read back : This step is recommended to initialize the controller. Various
methods exist, depending on controller software architecture.
To ease this initialization step, the device features the DIESE command, to enumerate (read
back) all its registers current values. This produces a huge amount of data that can saturate the
controller. A command parameter allows reducing this volume by sending only register values
different from their default value. If the volume is still too high, the controller should enumerate
himself all the required registers, at its own rate.
Commenti su questo manuale