Before using this driver in the PROMOTIC application it is highly recommended to watch "
PROMOTIC video tutorial 4 - Communication drivers".
Basic properties of the driver:
- Usage of this driver requires purchase of the
PmChar licence. When developing the application (with
development environment for testing purposes), this component is always functional. This component
is not functional in the freeware mode
PmFree.
It is also necessary to purchase the
corresponding number of PmDataClient licences. This number is indicated in the "
Maximum number of clients" configurator.
- In the
PmFree mode, the number of clients is set to 2.
- When developing and testing the application with the development licence, the number of clients is set to 10.
- The communication is done
for Ethernet (PROMOTIC application is server) (for Ethernet-client or for serial link use the the
PmChar communication driver).
The driver is simple but powerful tool for communication by
user configured protocol. It is determined first of all for the communication where using a special communication protocol doesn't pay in the end.
The usage of the driver is especialy handy for:
- communications by simple protocols.
- both text and binary oriented communications.
- testing purposes.
The
PmCharServer driver is not determined for the emulation of more complex protocols.
We'll be glad
to help you with the decision if the given protocol can be implemented by the
PmCharServer driver; don't hesitate to contact us! (
sw-support@microsys.cz).
Recommended values of the PmaComm object parameters:
Description and recommended values for the Protocol parameters:
Received data will always be in only one packet | If checked, then it is assumed that the entire content of the received message will always fit into a single IP packet.
This setting affects the optimization of the reception rate:
Once the packet is received the reception is terminated and the system does not wait for timeout (defined in the "Timeout of one packet transfer [ms]" configurator).
The packet size is predefined by current network. It can be e.g. 521 bytes, 1024 bytes etc. |
| |
---|
The communication description by means of the PmaCommMsg object of the Slave type
This object type can be placed in the
PmaComm object only once.
This object will receive all incomming messages and can also response.
Message parameters:
There is HexaString in 'Data-sent' | On the "Data-sent" tab there is always the Data variable of the String type.
If checked, then it is presumed that the content of this variable is so-called HexaString that can be used in order to transfer binary values in the String type as follows:
Example: if you are to send 4 bytes with binary values of 01 A0 00 B3 (in hexadecimal), then it is necessary to set into the variable of the String type the value of "01A000B3" - i.e. the text of 2*4=8 characters.
This way you can easily transfer data containing binary zeroes, that are forbidden in the value of the String type.
The Pm.TransformValue(240) method can be used for preparation of the transferred data.
If not checked, then it is not possible to send binary data, only text data sending is allowed - the exact content of the of the String type variable is sent. |
There is HexaString in 'Data-received' | The sane as the previous configurator, only for the "Data-received" tab.
If checked, then the Pm.TransformValue(241) method can be used for processing the received data. |
---|
There are following variables on the "
Data-sent" tab:
Data - (String) Data for sending.
There are following variables on the "
Data-received" tab:
Data - (String) The received data is stored here.
The transfer procedure for this message type is following:
- The object waits for receiving the data from other side.
- After the message is received from the other side it is decided which
Slave object this message belongs to. If there is only a single object of the
Slave type, then the received data is transferred there, otherwise the procedure goes as follows:
The received message length is compared to requested messages (defined on the "
Data-received" tab). The received message is assigned to the object that requested message of equal length (as the received message).
- After the received data is saved into the
Data variable on the "
Data-received" tab of corresponding object, the
onDataReceive event is triggered. The designer can then set the data for sending on the "
Data-sent" tab.
- If on the "
Data-sent" tab the
Data variable contains empty string then the transmission is terminated (the
onEndOfTransfer event is triggered). This is used if the PRMOTIC is not requested to send a response to the other side.
- If on the "
Data-sent" tab the
Data variable contains non-empty string then the content of this variable is modified (e.g. the conversion from
HexaString to binary form) and the modified data is then sent to the other side.
The communication description by means of the PmaCommMsg object of the Master type
This object type can be placed in the
PmaComm object multiple times.
This object is functional only if the "
Ethernet transfer type" configurator is set to
TCP.
This object will send messages to the specified client and will not receive anything. It is handy for situations when the server needs to send data to client by itself, without client request.
The usage of this object is
now limited only for cases when there is a single client connected to the server.
Message parameters:
There is HexaString in 'Data-sent' | On the "Data-sent" tab there is always the Data variable of the String type.
If checked, then it is presumed that the content of this variable is so-called HexaString that can be used in order to transfer binary values in the String type as follows:
Example: if you are to send 4 bytes with binary values of 01 A0 00 B3 (in hexadecimal), then it is necessary to set into the variable of the String type the value of "01A000B3" - i.e. the text of 2*4=8 characters.
This way you can easily transfer data containing binary zeroes, that are forbidden in the value of the String type.
The Pm.TransformValue(240) method can be used for preparation of the transferred data.
If not checked, then it is not possible to send binary data, only text data sending is allowed - the exact content of the of the String type variable is sent. |
---|
There are following variables on the "
Data-sent" tab:
Data - (String) Data for sending.
ClientId - (String) The identifier of the client the message is to be sent to. For now, there can only be a single client and therefore the value of the identifier must be left not set.