AH500 Programming Manual 
6-422 
API 
Instruction code  Operand 
Function 
1812
  COMRS   
S
1
, S
2
, S
3
, D
1
, D
2
 
Sending and receiving 
communication data 
Device 
X  Y  M  S  T  C  HC  D  L  SM  SR  E  K  16#  “$” 
DF 
  
S
2 
   
   
   
 
   
     
 
D
1
 
   
   
   
 
   
             
D
2
 
   
   
   
 
   
             
 
16-bit instruction (11 steps)
 
32-bit instruction (5 steps) 
-  AH500  - 
Symbol: 
S
1
 
:  Communication port number (1~2)  Word 
S
2
 
:  Source of the data which is sent  Word 
S
3
 
:  Length of the data which is sent  Word 
D
1
 
: 
Initial device in which communication data 
received is stored 
Word 
D
2
 
:  Condition of ending the receiving of data  Word 
Explanation:   
1.  Only applicable for version V1.03 or later versions.   
2.  If a specific character or specific characters are used as the condition of ending the receiving 
of data, it is suggested that the instruction should be applied to ASCII data. If the instruction is 
not applied to ASCII data, it is suggested that a timeout period should be used as the condition 
of ending the receiving of data. 
3.  The instruction COMRS only supports the built-in communication ports of an AH500 series 
CPU module. (COM1 in AHCPU5xx-EN, and COM1 and COM2 in AHCPU5xx-RS2 are 
supported.) 
4.  S
1
: Communication port number 
S
1
=1: COM1 
S
1
=1: COM2 
If the value in S
1
 is neither 1 nor 2, the instruction will not be executed. 
5.  S
2
: Source of the data which is sent 
S
3
: Length of the data which is sent 
If S
2
 is D100 and S
3
 is K10, the values in the low bytes in D100~D109 will be sent through the 
communication port specified by S
1
. 
6.  If the setting value in S
3
 is 0, no string will be sent. The maximum number of characters which 
can be sent is 1000. 
7.  D
1
: Length of the data which has been received. 
D
1
+1~D
1
+n: Devices in which the data received is stored 
If D
1
 is D200, the value in D
2
 is 3, and the value in D
2
+1 is 16#0D0A, the data received will be 
stored in the low bytes in the devices starting from D201 (the high bytes will be unchanged), 
the receiving of data will not stop until the consecutive stop characters 16#0D and 16#0A are 
received, the length of the data received will be written to D200 after 16#0D and 16#0A are 
received, and a completion flag will be set to ON after the receiving of data stops. 
8.  D
2
: Mode of receiving data