Promotic

PmNET0 - Driver for communication by the NET0 protocol

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:
- The communication is done for serial link (COM1, COM2 ...).
- The driver is incorporated into the PROMOTIC system by means of the PmaComm object.
The driver supports the usage of the PmaCommMsg object. The PmaCommGroup object cannot be used.
For easy integration of this driver into the application it is handy to use: Preconfigurations in group "NET0"
- It is available as the price list item, which is free.


The NET0 protocol can serve as a cheap connection of two PROMOTIC applications via the computer's serial port. Some HW producers implemented this protocol into their devices and in this case it is possible to communicate with these devices very easily and cheaply (see for example LonWorks-NET0 converter by the SAMO company).

The NET0 protocol is the network protocol of the 1Master x nSlave type where maximum 253 Slave stations can be used.
The NET0 protocol can serve for example for the following aims:
- for communication via the computer's serial port between PCs where PROMOTIC application are ran. This method is not quite common because the connection of separate computers in the network is simpler and more common.
- for communication between the PC station with running PROMOTIC application and the other HW device where the NET0 protocol was implemented. This method is perhaps the most common and the Description of the NET0 protocol is designed for those who want to implement this protocol.


Recommended values of the PmaComm object parameters:

Description and recommended values for the Protocol parameters:
This computer number (ncp)This computer number
0 - means that it is not a network communication, it is only point-to-point type.
1 .. 253 - Identifies this computer in the network communication.
Messages typeThe following types are valid:
Master Only - The driver will be of the Master type, it means that this PROMOTIC application will send requests and opposite computers will answer only.
Slave Only - The driver will be of the Slave type, it means that one of the opposite side computers will send requests, and if the request is addressed to this computer, then it just answers.
Max. length of received data in bytesThe maximum possible length of the received message.
Confirmation timeoutThe time (in milliseconds) the driver is waiting for the message acknowledgement (for messages where no data answer is expected but only acknowledgement)
Response receipt timeoutThe time (in milliseconds) the driver is waiting for the response on sending the message.
If no response comes during this time, then the transmission of the message is terminated (the onEndOfTransfer event is triggered with error 24 or 66).
Description of the "PmaCommMsg > Parameters > Message parameters" configurator:
Opposite computer number (ncp)Opposite computer number
0 - means that it is not a network communication, it is only point-to-point.
1 .. 253 - identifies the opposite computer in the network communication.
254 - (broadcast) means that message is adressed for all computers in the network.
Message connection number (nco)The message identifier. Value in the range from 0 to 255.
Acknowledge messageOnly for Master messages. For messages that send data, but no data response is expected. Specifies whether the opposite side has to confirm the received data.

Description of the NET0 protocol



Message format of the NET0 protocol:
STX: (=02H) code of the message start
DST: destination computer number
SRC: source computer number
CMD: message properties in the form of bitmask values:
08H: network communication used
20H: response to request for sending data
40H: request for sending data
80H: message requiring acknowledgement (ACK)
NCO: connection number (to distinguish separate message types)
data: transmitted data themselves
ETX: (=03H) code of the message end
SUM: checksum, i.e. mathematical xor of bytes from DST (including) to the last "data" byte (inclusive). Xor is made over values that are not encoded by DLE char (see Note 1)


Note 1:
DST, SRC, CMD, NCO, data and SUM values can be of any values except:
STX = 02H: code of the message start
ETX = 03H: code of the message end
ACK = 06H: positive acknowledgement
DLE = 10H: change prefix
NAK = 15H: negative acknowledgement

If the transmitted data contains one of the above mentioned characters then this character is encoded into two characters in the protocol:
(DLE) and (X+80H)

It means that the protocol has a variable length of the message depending on message values!
Example:
We want to transfer 1 byte of the value 02H in the data. Instead of that we send 2 bytes: DLE and then 82H. By this encoding using the DLE character we can achieve that STX, ETX, ACK, DLE and NAK occur only on those positions of the message where its real function is.

Note 2:
In general it goes about the network protocol, it means that there is the computer number in the message that receives the message (DST=destination) and the computer that sends the message (SRC=source), in the message. DST and SRC fields can hold values from 1 to 253. If the DST and SRC fields have the value of 0, then it goes about the non-network protocol that differs from the network one the rather that the DST and SRC bytes are not included into the protocol at all. If the DST field has the value 254, then it goes about the "broadcast" message, it means that is sent to all computers in the network.

Note 3:
The format of the "data" field equals to the format of data types on the computer. It means that for example Integer is transferred on 2 bytes (at first LOW and then HIGH byte). Boolean is transferred on 1 byte (value 0 and 1). Values in the "data" field are in such order, in which the message variables were specified in the PROMOTIC system.

Note 4:
After the data receipt the receiving station has to do the following:
- if the message was received wrong (e.g. bad checksum or bad content of data) and the acknowledgement is required (bit 80H is set in CMD), then send one NAK character (=15H) as the negative acknowledgement.
- if the message was received all right and:
- a) it is the "response to sending data" (bit 20H is set in CMD), then don't response
- b) it isn't the "request for sending data" (bit 40H isn't set in CMD) and the acknowledgement is required (bit 80H is set in CMD), then send one ACK character (=06H).
- c) it is the "request for sending data" (bit 40H is set in CMD), then send the response in the same (described above) format.

In other situations there is no answer to the receipt.

Example:
We send two values: integer with the value 258 (=0102H) and byte with value 3 (=03H). The message has to be acknowledged, the connection number NCO = 0 and it goes about the non-network protocol (i.e. DST and SRC characters are missing).
The receiving station receives bytes in the following order:
02H: STX character = message beginning
80H: CMD character = message requiring confirmation
00H: NCO connection number
10H: DLE character = low byte of the 1st value is the same as STX
82H: low byte of the 1st value + 80H
01H: high byte of the 1st value
10H: DLE character = 2nd value is the same as ETX
83H: 2nd value + 80H
03H: ETX character = message end
80H: SUM = checksum (80H = 80H xor 00H xor 02H xor 01H xor 03H)
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.