Skip to content

Commit

Permalink
finish CRC value fixmes in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aldas committed Apr 5, 2021
1 parent 03b4c8d commit cb1e647
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions packet/readcoilsrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ type ReadCoilsRequestTCP struct {

// ReadCoilsRequestRTU is RTU Request for Read Coils function (FC=01)
//
// Example packet: 0x10 0x01 0x00 0x6B 0x00 0x03 0xFF 0xFF
// Example packet: 0x10 0x01 0x00 0x6B 0x00 0x03 0x0e 0x96
// 0x10 - unit id (0)
// 0x01 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x00 0x03 - coils quantity to return (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x0e 0x96 - CRC16 (6,7)
type ReadCoilsRequestRTU struct {
ReadCoilsRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readcoilsresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadCoilsResponseTCP struct {

// ReadCoilsResponseRTU is RTU Response for Read Coils (FC=01)
//
// Example packet: 0x03 0x01 0x02 0xCD 0x6B 0xFF 0xFF
// Example packet: 0x03 0x01 0x02 0xCD 0x6B 0xd5 0x43
// 0x03 - unit id (0)
// 0x01 - function code (1)
// 0x02 - coils byte count (2)
// 0xCD 0x6B - coils data (2 bytes = 2 // 8 coils) (3,4, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0xd5 0x43 - CRC16 (n-2,n-1)
type ReadCoilsResponseRTU struct {
ReadCoilsResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readdiscreteinputsrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ type ReadDiscreteInputsRequestTCP struct {

// ReadDiscreteInputsRequestRTU is RTU Request for Read Discrete Inputs (FC=02)
//
// Example packet: 0x10 0x02 0x00 0x6B 0x00 0x03 0xFF 0xFF
// Example packet: 0x10 0x02 0x00 0x6B 0x00 0x03 0x4a 0x96
// 0x10 - unit id (0)
// 0x02 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x00 0x03 - discrete inputs quantity to return (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x4a 0x96 - CRC16 (6,7)
type ReadDiscreteInputsRequestRTU struct {
ReadDiscreteInputsRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readdiscreteinputsresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadDiscreteInputsResponseTCP struct {

// ReadDiscreteInputsResponseRTU is RTU Response for Read Discrete Inputs (FC=02)
//
// Example packet: 0x03 0x02 0x02 0xCD 0x6B 0xFF 0xFF
// Example packet: 0x03 0x02 0x02 0xCD 0x6B 0xd5 0x07
// 0x03 - unit id (0)
// 0x02 - function code (1)
// 0x02 - inputs byte count (2)
// 0xCD 0x6B - inputs data (2 bytes = 2 // 8 inputs) (3,4, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0xd5 0x07 - CRC16 (n-2,n-1)
type ReadDiscreteInputsResponseRTU struct {
ReadDiscreteInputsResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readholdingregistersrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadHoldingRegistersRequestTCP struct {

// ReadHoldingRegistersRequestRTU is RTU Request for Read Holding Registers (FC=03)
//
// Example packet: 0x01 0x03 0x00 0x6B 0x00 0x01 0xFF 0xFF
// Example packet: 0x01 0x03 0x00 0x6B 0x00 0x01 0xf5 0xd6
// 0x01 - unit id (0)
// 0x03 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x00 0x01 - holding registers quantity to return (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0xf5 0xd6 - CRC16 (6,7)
type ReadHoldingRegistersRequestRTU struct {
ReadHoldingRegistersRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readholdingregistersresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadHoldingRegistersResponseTCP struct {

// ReadHoldingRegistersResponseRTU is RTU Request for Read Holding Registers (FC=03)
//
// Example packet: 0x01 0x03 0x02 0xCD 0x6B 0xFF 0xFF
// Example packet: 0x01 0x03 0x02 0xCD 0x6B 0xad 0x3b
// 0x01 - unit id (0)
// 0x03 - function code (1)
// 0x02 - returned registers byte count (2)
// 0xCD 0x6B - holding registers data (1 register) (3,4, ... 2 bytes for each register)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0xad 0x3b - CRC16 (n-2,n-1)
type ReadHoldingRegistersResponseRTU struct {
ReadHoldingRegistersResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readinputregistersrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadInputRegistersRequestTCP struct {

// ReadInputRegistersRequestRTU is RTU Request for Read Input Registers (FC=04)
//
// Example packet: 0x01 0x04 0x00 0x6B 0x00 0x01 0xFF 0xFF
// Example packet: 0x01 0x04 0x00 0x6B 0x00 0x01 0x40 0x16
// 0x01 - unit id (0)
// 0x04 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x00 0x01 - input registers quantity to return (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x40 0x16 - CRC16 (6,7)
type ReadInputRegistersRequestRTU struct {
ReadInputRegistersRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readinputregistersresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadInputRegistersResponseTCP struct {

// ReadInputRegistersResponseRTU is RTU Request for Read Input Registers (FC=04)
//
// Example packet: 0x01 0x04 0x02 0xCD 0x6B 0xFF 0xFF
// Example packet: 0x01 0x04 0x02 0xCD 0x6B 0xac 0x4f
// 0x01 - unit id (0)
// 0x04 - function code (1)
// 0x02 - returned registers byte count (2)
// 0xCD 0x6B - input registers data (1 register) (3,4, ... 2 bytes for each register)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0xac 0x4f - CRC16 (n-2,n-1)
type ReadInputRegistersResponseRTU struct {
ReadInputRegistersResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readwritemultipleregistersrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ReadWriteMultipleRegistersRequestTCP struct {

// ReadWriteMultipleRegistersRequestRTU is RTU Request for Read / Write Multiple Registers (FC=23)
//
// Example packet: 0x11 0x17 0x04 0x10 0x00 0x01 0x01 0x12 0x00 0x02 0x04 0x00 0xc8 0x00 0x82 0xFF 0xFF
// Example packet: 0x11 0x17 0x04 0x10 0x00 0x01 0x01 0x12 0x00 0x02 0x04 0x00 0xc8 0x00 0x82 0x64 0xe2
// 0x11 - unit id (0)
// 0x17 - function code (1)
// 0x04 0x10 - read registers start address (2,3)
Expand All @@ -37,7 +37,7 @@ type ReadWriteMultipleRegistersRequestTCP struct {
// 0x00 0x02 - write quantity (8,9)
// 0x04 - write bytes count (10)
// 0x00 0xc8 0x00 0x82 - write registers data (2 registers) (11,12, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0x64 0xe2 - CRC16 (n-2,n-1)
type ReadWriteMultipleRegistersRequestRTU struct {
ReadWriteMultipleRegistersRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/readwritemultipleregistersresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type ReadWriteMultipleRegistersResponseTCP struct {

// ReadWriteMultipleRegistersResponseRTU is RTU Response for Read / Write Multiple Registers request (FC=23)
//
// Example packet: 0x11 0x17 0x02 0xCD 0x6B 0xFF 0xFF
// Example packet: 0x11 0x17 0x02 0xCD 0x6B 0x69 0x08
// 0x11 - unit id (0)
// 0x17 - function code (1)
// 0x02 - registers bytes count (2)
// 0xCD 0x6B - write registers data (1 registers) (3, 4, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0x69 0x08 - CRC16 (n-2,n-1)
type ReadWriteMultipleRegistersResponseRTU struct {
ReadWriteMultipleRegistersResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writemultiplecoilsrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ type WriteMultipleCoilsRequestTCP struct {

// WriteMultipleCoilsRequestRTU is RTU Request for Write Multiple Coils (FC=15)
//
// Example packet: 0x11 0x0F 0x04 0x10 0x00 0x03 0x01 0x05 0xFF 0xFF
// Example packet: 0x11 0x0F 0x04 0x10 0x00 0x03 0x01 0x05 0x8e 0x1f
// 0x11 - unit id (0)
// 0x0F - function code (1)
// 0x04 0x10 - start address (2,3)
// 0x00 0x03 - count of coils to write (4,5)
// 0x01 - coils byte count (6)
// 0x05 - coils data (7, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0x8e 0x1f - CRC16 (n-2,n-1)
type WriteMultipleCoilsRequestRTU struct {
WriteMultipleCoilsRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writemultiplecoilsresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type WriteMultipleCoilsResponseTCP struct {

// WriteMultipleCoilsResponseRTU is RTU Response for Write Multiple Coils (FC=15)
//
// Example packet: 0x11 0x0F 0x04 0x10 0x00 0x03 0xFF 0xFF
// Example packet: 0x11 0x0F 0x04 0x10 0x00 0x03 0x17 0xaf
// 0x11 - unit id (0)
// 0x0F - function code (1)
// 0x04 0x10 - start address (2,3)
// 0x00 0x03 - count of coils written (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x17 0xaf - CRC16 (6,7)
type WriteMultipleCoilsResponseRTU struct {
WriteMultipleCoilsResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writemultipleregistersrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ type WriteMultipleRegistersRequestTCP struct {

// WriteMultipleRegistersRequestRTU is RTU Request for Write Multiple Registers (FC=16)
//
// Example packet: 0x11 0x10 0x04 0x10 0x00 0x03 0x06 0x00 0xC8 0x00 0x82 0x87 0x01 0xFF 0xFF
// Example packet: 0x11 0x10 0x04 0x10 0x00 0x03 0x06 0x00 0xC8 0x00 0x82 0x87 0x01 0x2f 0x7d
// 0x11 - unit id (0)
// 0x10 - function code (1)
// 0x04 0x10 - start address (2,3)
// 0x00 0x03 - count of register to write (4,5)
// 0x06 - registers byte count (6)
// 0x00 0xC8 0x00 0x82 0x87 0x01 - registers data (7,8, ...)
// 0xFF 0xFF - CRC16 (n-2,n-1) // FIXME: add correct crc value example
// 0x2f 0x7d - CRC16 (n-2,n-1)
type WriteMultipleRegistersRequestRTU struct {
WriteMultipleRegistersRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writemultipleregistersresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type WriteMultipleRegistersResponseTCP struct {

// WriteMultipleRegistersResponseRTU is RTU Response for Write Multiple Registers (FC=16)
//
// Example packet: 0x11 0x10 0x04 0x10 0x00 0x03 0xFF 0xFF
// Example packet: 0x11 0x10 0x04 0x10 0x00 0x03 0x82 0x6d
// 0x11 - unit id (0)
// 0x10 - function code (1)
// 0x04 0x10 - start address (2,3)
// 0x00 0x03 - count of registers written (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x82 0x6d - CRC16 (6,7)
type WriteMultipleRegistersResponseRTU struct {
WriteMultipleRegistersResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writesinglecoilrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ type WriteSingleCoilRequestTCP struct {
// For example: coil at address 1 is turned on '0x00 0x01 0xFF 0x00'
// For example: coil at address 10 is turned off '0x00 0x0A 0x00 0x00'
//
// Example packet: 0x11 0x05 0x00 0x6B 0xFF 0x00 0xFF 0xFF
// Example packet: 0x11 0x05 0x00 0x6B 0xFF 0x00 0xff 0x76
// 0x11 - unit id (0)
// 0x05 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0xFF 0x00 - coil data (true) (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0xff 0x76 - CRC16 (6,7)
type WriteSingleCoilRequestRTU struct {
WriteSingleCoilRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writesinglecoilresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ type WriteSingleCoilResponseTCP struct {
// For example: coil at address 1 is turned on '0x00 0x01 0xFF 0x00'
// For example: coil at address 10 is turned off '0x00 0x0A 0x00 0x00'
//
// Example packet: 0x03 0x05 0x00 0x02 0xFF 0x00 0xFF 0xFF
// Example packet: 0x03 0x05 0x00 0x02 0xFF 0x00 0x2c 0x18
// 0x03 - unit id (0)
// 0x05 - function code (1)
// 0x00 0x02 - start address (2,3)
// 0xFF 0x00 - coil data (true) (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x2c 0x18 - CRC16 (6,7)
type WriteSingleCoilResponseRTU struct {
WriteSingleCoilResponse
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writesingleregisterrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type WriteSingleRegisterRequestTCP struct {

// WriteSingleRegisterRequestRTU is RTU Request for Write Single Register (FC=06)
//
// Example packet: 0x11 0x06 0x00 0x6B 0x01 0x01 0xFF 0xFF
// Example packet: 0x11 0x06 0x00 0x6B 0x01 0x01 0x3a 0xd6
// 0x11 - unit id (0)
// 0x06 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x01 0x01 - register data (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x3a 0xd6 - CRC16 (6,7)
type WriteSingleRegisterRequestRTU struct {
WriteSingleRegisterRequest
}
Expand Down
4 changes: 2 additions & 2 deletions packet/writesingleregisterresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ type WriteSingleRegisterResponseTCP struct {

// WriteSingleRegisterResponseRTU is RTU Response for Write Single Register (FC=06)
//
// Example packet: 0x11 0x06 0x00 0x6B 0x01 0x01 0xFF 0xFF
// Example packet: 0x11 0x06 0x00 0x6B 0x01 0x01 0x3a 0xd6
// 0x11 - unit id (0)
// 0x06 - function code (1)
// 0x00 0x6B - start address (2,3)
// 0x01 0x01 - register data (4,5)
// 0xFF 0xFF - CRC16 (6,7) // FIXME: add correct crc value example
// 0x3a 0xd6 - CRC16 (6,7)
type WriteSingleRegisterResponseRTU struct {
WriteSingleRegisterResponse
}
Expand Down

0 comments on commit cb1e647

Please sign in to comment.