14 Haziran 2017 Çarşamba

Modbus

Giriş
Modbus protokolünü hep bir kütüphane aracılığıyla kullandım. Protokol karışık ve kodlaması kolay değil.
PDU
3 çeşit PDU var.
1. ASCII PDU
Serisiletişimde kullanılır.
2. RTU PDU
Seri iletişimde kullanılır. ASCII PDU'dan farklı bir zarf kullanır.
3. TCP PDU
TCP iletişimde kullanılır. RTU PDU TCP ile gönderilemez
Responses
Açıklaması şöyle
Following a request, there are 4 possible outcomes from the slave.
  1. The request is successfully processed by the slave and a valid response is sent.
  2. The request is not received by the slave therefore no response is sent.
  3. The request is received by the slave with a parity, CRC or LRC error. The slave ignores the request and sends no response.
  4. The request is received without an error, but cannot be processed by the slave for another reason. The slave replies with an exception response.
In a normal response, the slave echoes the function code. The first sign of an exception response is that the function code is shown in the echo with its highest bit set. All function codes have 0 for their most significant bit. Therefore, setting this bit to 1 is the signal that the slave cannot process the request.
Negative Ack
4. response tipi için geçerli. Açıklaması şöyle
16 (10 Hex) Return Server NAK Count
The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power–up. Exception responses are described and listed in section 7.
Açıklaması şöyle
So NAK are sent when situation 4 occurs and the counter is incremented accordingly.



Hiç yorum yok:

Yorum Gönder