84
6 Useful Functions
84
Useful Functions
Chapter
6
Example 2) Changing the upper limit for 32-bit integer data area (address 40009 to 40010) to
99999 (0x0001869F), and the lower limit (address 40011 to 40012) to 5000
(0x00001388).
Note that the relative address is 0x08 when writing in the upper limit.
* In function code 16, an error response is returned when the start address specifies the LO words
from a 32-bit integer data area, or the end of t
he start address + number of registers specifies HI
words from a 32-bit integer data area.
11 (0x0B) Get Comm Event Counter
Every time a request is processed by the slave device, the event counter is incremented by 1.
The counter is not incremented when there is a frame error or when other counters are being read.
The master device reads this counter before and after a request to judge whether the pro
cess has been
executed or not.
The status is generally 0x0000 when the slave device is not busy.
Example) Reading the event counter.
In the example, the slave device is not busy (0x0000) and has processed a total of 264 (0x0108)
commands.
[Request]
Function 10
[Response]
Function 10
Start address (HI) 00 Start address (HI) 00
Start address (LO) 08 Start address (LO) 08
Register (HI) 00 Register (HI) 00
Register (LO) 04 Reg
ister (LO) 04
Data bytes 08
Upper limit (HI) HI 00
Upper limit (HI) LO 01
Upper limit (LO) HI 86
Upper limit (LO) LO 9F
Lower limit (HI) HI 00
Lower limit (HI) LO 00
Lower limit (LO) HI 13
Lower limit (LO) LO 88
[Request]
Function 1 byte 0x0B
[Response]
Function 1 byte 0x0B
Status 2 bytes 0x0000
Event counter 2 bytes 0x0000 to 0xFFFF
[Error response]
Error code 1 byte 0x8B (Function +0x80)
Exception code 1 byte 01
[Request]
Function 0B
[Response]
Function 0B
Status (HI) 00
Status (LO) 00
Event counter (HI) 01
Event counter (LO) 08