For easy integration of this driver into the application it is handy to use: Preconfigurations in group "PmChar configurable protocol"
|Response receipt timeout||Only for serial link. It is meaningful only for messages of the Master type. The time (in milliseconds) the driver is waiting for the response on sending the message. If no response comes during this time, then the transfer of the message is terminated (onEndOfTransfer event fires with error 24 or 66).|
|Received data will always be in only one packet||Only for Ethernet. |
If checked, then it is assumed that the entire contents of the received message will always fit into a single IP packet. This setting affects the optimization of the reception rate if ETX can not be used: Once the packet is received the reception is terminated and the system does not wait for timeout (defined in 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.
|Use STX||Determines if the protocol uses a special char for starting the transmission. If the usage of the char for starting the transmission is enabled, then it is put automatically before the user data prepared for the transmission. On the other hand the fact if the char for starting the transmission finds itself at the beginning, is tested for each data receipt. If it does not, the communication message is terminated with an error.|
|STX value||Determines the ASCII value of the char for starting the transmission (it has usually the value of 2).|
|Use ETX||Determines if the protocol uses a special char for ending the transmission. If the usage of the char for ending the transmission is enabled, then it is put automatically after the user data prepared for the transmission. On the other hand the fact if the char for ending the transmission finds itself at the end, is tested for each data receipt. If it does not, the communication message is terminated with an error. The usage of the ETX signal optimizes the speed rate of the receipt when a message with a variable length is received (into the String data type). Immediately after receiving the ETX signal, the system regards the message as completed (eventually it expects only check sum chars) and it ends the receipt instead of waiting for the timeout between receiving two chars.|
|ETX value||Determines the ASCII values of the char for ending the transmission (it has usually the value of 3).|
|Check sum||Determines the method of the check sum calculation: |
- none: communication without the check sum.
- XOR 1 byte: The check sum of the XOR type is used (it goes about so called vertical parity). It has the size of 1 byte and mathematically it is the XOR of all bytes that are included into the check sum.
- SUM 1 byte: The check sum of the sum type is used. It has the size of 1 byte and mathematically it is the arithmetic sum of all bytes that are included into the check sum (cut to 1 byte).
- SUM 2 byte: the same as the "SUM 1 byte" but it has the size of 2 bytes (cut to 2 bytes).
- CRC 2 byte CCITT [polynom 0x1021 = x16+x12+x5+1, use SBUS]: (Cyclical Redundancy Check) - Special check calculation, that is used for example in PmSBUS communication.
- CRC 2 byte IBM [polynom 0xA001 = x16+x15+x2+1, use Modbus]: (Cyclical Redundancy Check) - Special check calculation, that is used for example in Modbus protocol.
- CRC 2 byte IBM [polynom 0x8005 = x16+x15+x2+1, use DF1]: (Cyclical Redundancy Check) - Special check calculation, that is used for example in PmABradleyDF1 communication.
- at the end of message (after ETX)
- before ETX
- All data before the check sum
- All data before the check sum except the first char (except STX)
- All data before the check sum except the last char (except ETX)
- All data before the check sum except the first and the last char (except STX and ETX)
Checksum calculation can also be done by the Pm.ArrayOper method.
|Enable character replacement in received data||can be enabled if we want to replace the really accepted char with another one in the received data. It is used most often when we want to save the received data into the String data type but in the received data the char 00hex (binary zero) can appear. In this case we must replace the char 00hex by another one because the char 00hex is regarded as the end of the text. See the description further. |
The character value can be entered deciamly, see The ASCII table.
|There is HexaString only in 'Data-sent'||If checked, then it is presumed that there is only a single String type variable on the Data-sent page. The content of this variable is so called HexaString that can be used in order to transfer binary values in the String type as folows: |
For example if you are to send 4 bytes with binary values of 01 A0 00 B3 (hexadecimaly), then you put into the String variable 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 String variables.
The Pm.TransformValue(240) method can be used for preparation of the transferred data.
|There is HexaString only in 'Data-received'||The sane as the previous configurator, only for the Data-received page. |
The Pm.TransformValue(241) method can be used for processing the received data.
|This message will use next parameters (replace protocol parameters)||(only for messages of the Master type) If checked, then the same configurators are displayed as for protocol parameters, (whetherto use the STX, ETX characters, the checksum). These parameters overrule the protocol parameters during the message transfer.|
The received message lenght is compared to requested messages defined on Data-received pages. The received message is assigned to the object that requested message of equal lenght (as the received message). If there are two objects requesting the same message lenght, then it is assigned to the first object - this object is then moved to the end and the next message (of the same lenght)is assigned to the second object, etc.
For the item of String type on the Data-received page, it is necessary to define the lenght (in order to let the driver know what lenght is expected to be received). This can be done:
If the item of the String type is the last item on the page, then the variable number of chars is received up to the string length set by the above mentioned method.
If the item of the String type isn't the last item on the page, then the number of chars that corresponds exactly to the string length set by the above mentioned method, is received into this item.
The common problem is receiving the data including the binary value 0 (further 00hex). Direct receiving of such data into the String data type does not work well because the String is always interpreted as a text terminated by the 00hex character. The data is received, but only the characters before the 00hex value are accessible. There are the following ways to solve this problem: