AH500 Programming Manual 
6-416 
API 
Instruction code
Operand  Function 
1808    MODRW   
S
1
, S
2
, S
3
, S, n 
Reading/Writing the MODBUS data 
Device 
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#  “$” 
DF 
  Pulse instruction
16-bit instruction (11 steps)  32-bit instruction
  -  AH500  - 
Symbol: 
S
1
:
Unit address  Word 
S
2
:
Function code  Word 
S
3
:
Device address  Word 
S 
:
Register involved in the reading/writing of the data  Bit/Word 
n 
:
Data length  Word 
Explanation: 
1.  The operand S
1
 should be within the range between 0 and 255. 
2.  S
2
: The function code 
For example: 
1 (16#01): The AH500 series PLC reads the data from several bit devices which are not 
discrete input devices.   
2 (16#02): The AH500 series PLC reads the data from several bit devices which are discrete 
input devices.   
3 (16#03): The AH500 series PLC reads the data from several word devices which are not 
input registers.   
4 (16#04): The AH500 series PLC reads the data from several word devices which are input 
registers.   
5 (16#05): The AH500 series PLC writes the state into a bit device.   
6 (16#06): The AH500 series PLC writes the data into a word device. 
15 (16#0F): The AH500 series PLC writes the states into several bit devices.   
16 (16#10): The AH500 series PLC writes the data into several word devices.   
Only the function codes mentioned above are supported, and other function codes can not be 
executed. Please refer to the examples below. 
3.  S
3
: The device address 
If the device address is illegal, the error occurs. The error code is stored in the error log.   
4.  S: The register involved in the reading/writing of the data 
The data which will be written into the external equipment is stored in the register in advance.   
The data which is read from the external equipment is stored in the register.   
5.  n: The length of the data 
The size of the data can not be larger than 240 bytes. For the communication commands 
related to the coils, the unit of the data is the bit, and n should be within the range between 1 
and 1920. For the communication commands related to the registers, the unit of the data is the