Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmNET0 - Driver for communication by the PROMOTIC NET0 protocol

Before using this driver in the PROMOTIC application it is highly recommended to read the chapter: Communication using the PROMOTIC drivers.
 
Basic properties of the driver:
- The communication is done via the computer's serial port (COM1, COM2 ...).
- The driver is incorporated into the PROMOTIC system by means of the PmComm object.

The driver supports to usage of PmCommMsg object. The PmCommData object cannot be used.

For easy integration of this driver into the application it is handy to use: Preconfigurations in group "NET0 communication protocol"

- It is available as the price list item PmNET0, 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 converter LonWorks-NET0 from the SAMO company).
 
The NET0 protocol is the network protocol of the 1Master x nSlave type where max. 253 Slave stations can be used.

The NET0 protocol can serve for example for the following aims:

- for the 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 by the LAN network is simpler and more common.
- for the 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 parameters values:

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-point.
1 .. 253 - identifies this computer in the network communication.
Messages typeThe following types are valid:
Master Only - The driver will be of Master type, it means that this PROMOTIC application will send requests and opposite computers will answer only.
Slave Only - The driver will be of 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.
Acknowledge 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 transfer of the message is terminated (onEndOfTransfer event fires with error 24 or 66).
Description of the PmCommMsg > Parameters > Message parameters configurator:
Opposite computer number (ncp)Opposite computer number
0 - means that it is not a network communication, it is only point-point.
1 .. 253 - identifies the opposite computer in the network communication.
254 - (broadcast) means that message is adressed for all computers in network communication.
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 answer is expected. Determines that the opposite side has to confirm the received data.

Description of the NET0 protocol

 
Message format of the NET0 protocol:
STX: (=02H) code of message start
DST: number of destination computer
SRC: number of source computer
CMD: message attributes set by the 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 message end
SUM: check sum, i.e. mathematical xor of bytes from DST (inclusive) 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 message start
ETX = 03H: code of 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, i.e. there is the number of the computer 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 fields are not included into the protocol at all. If the DST field has the value of 254, then it goes about the "broadcast" message, i.e. is sent to all computers in the network.

 
Note 3:

The format of the "data" field equals to the format of the data types on the PC. 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 check sum or bad content of data) and the acknowledgement is required (bit 80H is set in CMD), then send one NAK char (=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 char (=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 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 chars are missing).

The receiving station receives bytes in the following order:

02H: STX char = message start
80H: CMD char = message requiring acknowledgement
00H: NCO connection number
10H: DLE char = 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 char = 2nd value is the same as ETX
83H: 2nd value + 80H
03H: ETX char = message end
80H: SUM = check sum (80H = 80H xor 00H xor 02H xor 01H xor 03H)
PROMOTIC 8.3.22 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice