EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019) - page 36

 

  Index      Manuals     EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019)

 

Search            copyright infringement  

 

   

 

   

 

Content      ..     34      35      36      37     ..

 

 

 

EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019) - page 36

 

 

User Manual 

Chapter 24 

GFK-1645M 

Dec 2019 

 

Service Request Function 

530 

24.26.1

 

Input Parameter Block for SVCREQ 53 

The input parameter block for SVCREQ 53 contains the following 5 input words. 

Address 

Memory type (number) of the PLC memory location of the first byte or word of 
data to be written. Numbers are: 

Memory 

Decimal 

Hex 

%I (byte) 

16 

10 

%Q (byte) 

18 

12 

%T (byte) 

20 

14 

%M (byte) 

22 

16 

%G (byte) 

56 

38 

%R (word) 

08 

%AI (word) 

10 

0A 

%AQ (word) 

12 

0C 

address + 1 

Offset of the requested data within the memory type in PLC memory  

address + 2 

Length of data to be read, 1 

 10 bytes or words. 

address + 3 

Memory type of the PLC reference memory type for the completion status. See 
the numbers above. For example, %R1 = memory type 8. 

address + 4 

Offset in PLC Memory to write completion status (zero based).  
For example, %R1 = offset 0.  

24.26.2

 

Status Data for SVCREQ 53 

SVCREQ 53 returns one of the following status indications: 

Word 1 

Hex 

Dec  Status 

Definition 

0x0001 

Full Success 

All requested data was successfully written 

0x0101 

257 

Partial Success 

Less than requested data length was written. Can 
occur if some requested data is already in flash.  

0x0102 

258 

Insufficient 
Destination Memory 

Flash memory area full, connect with the programmer 
and write all data to flash in order to erase and store 
latest values. 

0x0202 

514 

Invalid Length 

Length is beyond minimum 1 and maximum 10 

0x0302 

770 

Source/Dest 
Mem Wrong 

Wrong source or destination reference memory 
specified in the SVCREQ. 

Word 2 

Number of bytes written 

Word 3 

Number of bytes remaining in flash 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

531 

Chapter 25:

 

Serial I/O, SNP & RTU Protocols 

This  chapter  describes  the  VersaMax  Micro  PLC  Serial  I/O  feature,  which  can  be  used  to 
control the read/write activities of one of the Micro PLC ports directly from the application 
program. 

This  chapter  also  contains  instructions  for  using  COMMREQs  to  configure  the  CPU  serial 
ports for SNP, RTU, or Serial I/O protocol. 

 

Format of the COMMREQ Function 

 

Configuring Serial Ports Using the COMMREQ Function 

 

RTU Slave/SNP Slave Operation with a Programmer Attached 

 

COMMREQ Command Block for Configuring SNP Protocol 

 

COMMREQ Command Block for Configuring RTU Protocol 

 

COMMREQ Command Block for Configuring Serial I/O 

 

Serial I/O COMMREQ Commands 

 

Initialize Port 

 

Set Up Input Buffer 

 

Flush Input Buffer 

 

Read Port Status 

 

Write Port Control 

 

Cancel Operation 

 

Autodial 

 

Write Bytes 

 

Read Bytes 

 

Read String  

Details of RTU and SNP protocol are described in the Serial Communications User’s Manual 

(GFK-0582). For additional information about Modbus Master communications, please refer 
to the document Modbus RTU Master Communications (GFK-2220). 

At  higher  sweep  times,  serial  communication  throughput  is  less  and  response  times  are 
larger. As a result of this, a communication request takes longer to complete. 

 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

532 

25.1

 

Format of the Communication Request 
Function 

Serial  I/O  is  implemented  through  the  use  of  Communication  Request  (COMMREQ) 
functions.    The  operations of  the  protocol,  such  as  transmitting  a  character  through  the 
serial  port  or  waiting  for  an  input  character,  are  implemented  through  the  COMMREQ 
function block. 

The  COMMREQ  requires  that  all  its  command  data  be  placed  in  the  correct  order  (in  a 
command  block)  in  PLC  memory  before  it  is  executed.  The  COMMREQ  should  then  be 
executed by a contact of a one-shot coil to prevent sending the data multiple times. A series 
of Block Move (BLKMV) commands should be used to move the words to create a command 
block in the Register tables. 

The  COMMREQ  function  has  three  inputs  and  one  output.  When  the  function  receives 
power flow, a command block of data is sent to the specified module. 

Figure 371 

 

25.1.1

 

Parameters of the COMMREQ Function 

Input/ 
Output 

Choices 

Description 

enable 

flow 

When the function is energized, the communications request is 
performed.  

IN 

R, AI, AQ 

IN contains the first word of the command block. 

SYSID 

I, Q, M, T, G, R, AI, 
AQ, constant 

SYSID contains the rack number (most significant byte) and slot 
number (least significant byte) of the target device. For the CPU, 
SYSID must specify rack/slot 0. 

TASK 

R, AI, AQ, constant  TASK specifies the port for which the operation is intended: 

 

task 19 for port 1  

 

task 20 for port 2   

FT 

flow, none 

FT is energized if an error is detected processing the COMMREQ: 

 

The specified target address is not present (SYSID).  

 

The specified task is not valid for the device (TASK).  

 

The data length is 0.  

 

The device’s status pointer address (in the command block) 

does not exist. (applies only to HSC COMMREQs) 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

533 

25.1.2

 

Command Block for the COMMREQ Function  

The  Command  Block  starts  at  the  reference  specified  in  COMMREQ  parameter  IN.  The 
length of the Command Block depends on the amount of data sent to the device. 

The  Command  Block  contains  the  data  to  be  communicated  to  the  other  device,  plus 
information  related  to  the  execution  of  the  COMMREQ.  The  Command  Block  has  the 
following structure:  

address 

Length (in words) 

address + 1 

Wait/No Wait Flag 

address + 2 

Status Pointer Memory 

address + 3 

Status Pointer Offset 

address + 4 

Idle Timeout Value 

address + 5 

Maximum Communication Time 

address + 6 to 
address + 133 

Data Block 

Example of the COMMREQ Function 

In the example, when %M0021 is ON, a Command Block located starting at %R0032 is sent 
to port 2 (communications task 20) of the CPU (rack 0, slot 0).  If an error occurs processing 
the COMMREQ, %Q0110 is set. 

Figure 372 

 

 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

534 

25.2

 

Configuring Serial Ports Using the COMMREQ 
Function 

The following tables list the command block values required for setting up a Serial Port for 
SNP,  RTU,  and  Serial  I/O.  All  values  are  in  hexadecimal  unless  otherwise  indicated.  The 
BLKMV  commands  that  are  used  to  create  the  command  block  are  described  in  the 
example. 

25.2.1

 

Timing 

If a port configuration COMMREQ is sent to a serial port that currently has an SNP/SNPX 
master  (for  example,  the  programmer)  connected  to  it,  the  serial  port  configuration 
specified by the COMMREQ does not take effect until the Micro PLC detects a loss of the 

SNP/SNPX  master.  This  occurs  after  the  configured  T3’  times  out,  once  the  master 

disconnects. The COMMREQ status word for the port configuration COMMREQ is updated 
as soon as the CPU verifies that the specified configuration is valid. That means a COMMREQ 
Successful value may be returned by the Port Configuration COMMREQ before the specified 
configuration is actually installed. 

25.2.2

 

Sending Another COMMREQ to the Same Port 

The  application  program  must  wait  at  least  2  seconds  after  a  new  serial  port  protocol  is 
installed before sending any COMMREQs specific to that protocol to the port. This applies 
to  a  new  protocol  installed  by  Storing  a  new  hardware  configuration  or  by  a  port 
configuration COMMREQ. If the port is configured for Serial I/O, this waiting period must 
also follow any Stop to Run mode transition of the Micro PLC. 

25.2.3

 

Invalid Port Configurations 

COMMREQs  to  configure  protocols  for  the  port(s)  of  the  Micro  PLC  are  limited  to  the 
supported  protocols  for  the  given  port.    Any  COMMREQs  that  request  invalid  port 
configurations will be rejected. 

Note: 

For all Nano and Micro PLC CPUs, care must be taken setting timeouts and message lengths when 
operating  at  4800  bps  or  lower.  Messages  at  this  rate  are  longer  in  duration  and  may  cause 
various timeouts within a system. This can become worse on the Micro-64 CPU because the scan 
times on this unit are typically slightly longer. 

 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

535 

25.2.4

 

RTU Slave/SNP Slave Operation with Programmer 
Attached 

A programmer (an SNP/SNPX master device) can be attached to port 1 or port 2 while RTU 
Slave mode is active on the port. For multi-drop connections, the Micro PLC must have been 
configured to use an appropriate PLC ID. Note that for a multi-drop SNP connection with the 
port currently configured for RTU Slave, the SNP ID associated with the Micro PLC settings 
must match the multi-drop ID. 

The programmer must use the same serial communications parameters (baud rate, parity, 
stop bits, etc.) as the currently active RTU Slave protocol for it to be recognized.  

When  the  Micro  PLC  recognizes  the  programmer,  the  Micro  PLC  removes  the  RTU  Slave 
protocol from the port and installs SNP Slave as the currently active protocol. The SNP ID, 
modem turnaround time, and default idle time for this new SNP Slave session are obtained 
from the configured Micro PLC settings, not the port 1 or port 2 configurations. Connection 
should  be  established  within  12  seconds.  When  the  programmer  connection  has  been 
enabled, normal programmer communications can take place.  (Failure of the programmer 
to  establish  communications  within  12-seconds  is  treated  as  a  Loss  of  Programmer 
Communications). 

The  programmer  may  send  a  new  protocol  via  configuration  or  a  Serial  Port  Setup 
COMMREQ.  (COMMREQs  not  supported  by  SNP  Slave  protocol  are  rejected).  If  a  new 
protocol is received, it will not take effect until the programmer is disconnected. 

After the programmer is removed, there is a slight delay (equal to the configured SNP T3’ 

timeout) before the Micro PLC recognizes its absence. During this time, no messages are 
processed on the port. The Micro PLC detects removal of the programmer as an SNP Slave 
protocol timeout. Therefore, it is important to be careful when disabling timeouts used by 
the SNP Slave protocol. 

When the Micro PLC recognizes the disconnect, it reinstalls the RTU Slave protocol, unless a 
new  protocol  has  been  received.  In  that  case,  the  Micro  PLC  installs  the  new  protocol 
instead. 

Note: 

If an RTU slave receives a message with length greater than 265 bytes it responds with an error 
code 0x03 indicating "Invalid Data Field" 

Example 

1.

 

Port 1 is running RTU Slave protocol at 9600 baud. 

2.

 

A programmer is attached to port 1. The programmer is using 9600 baud. 

3.

 

The  Micro  PLC  installs  SNP  Slave  on  port  1  and  the  programmer  communicates 
normally. 

4.

 

The programmer stores a new configuration to port 1. The new configuration sets 
the  port  for  SNP  Slave  at  4800  baud  (it  will  not  take  effect  until  the  port  loses 
communications with the programmer).  

5.

 

When  the  Micro  PLC  loses  communications  with  the  programmer,  the  new 
configuration takes effect. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

536 

25.2.5

 

COMMREQ Command Block for Configuring SNP 
Protocol 

 

Values 

Meaning 

Address 

10H 

Data Block Length 

Address + 1 

0 = No Wait 

WAIT/NOWAIT Flag 

Address + 2 

0008 = %R, register memory 

Status Word Pointer Memory Type 

Address + 3 

Zero-based number that gives the address 
of the COMMREQ status word (for 
example, a value of 99 gives an address of 
100 for the status word) 

Status Word Pointer Offset 

Address + 4 

0 (Only used in Wait/No Wait mode) 

Idle Timeout Value 

Address + 5 

0 (Only used in Wait/No Wait mode) 

Maximum Communication Time 

Address + 6 

FFF0H 

Command Word (serial port setup) 

Address + 7 

0001 

Protocol: 1=SNP  

Address + 8 

0000=Slave, 0001=Master 

Port Mode 

Address + 9 

10=175000, 7=38400, 6=19200, 5=9600, 
4=4800, 3=2400, 2=1200, 1=600, 0=300 

Data Rate (bps) 

Address + 10 

0 = None, 1 = Odd, 2 = Even 

Parity 

Address + 11 

1 = None 

Flow Control 

Address + 12 

0 = None, 1 = 10ms, 2 = 100ms, 3 = 500ms  Turnaround Delay  

Address + 13 

0 = Long, 1 = Medium, 2 = Short, 3 = None  Timeout  

Address + 14 

1 = 8 bits 

Bits Per Character 

Address + 15 

0 = 1 Stop Bit, 1 = 2 Stop bits 

Stop Bits 

Address + 16 

not used 

Interface 

Address + 17 

not used 

Duplex Mode 

Address + 18 

user-provided

17

 

Device identifier bytes 1 and 2 

Address + 19 

user-provided

17

 

Device identifier bytes 3 and 4 

Address + 20 

user-provided

17

 

Device identifier bytes 5 and 6 

Address + 21 

user-provided

17

 

Device identifier bytes 7 and 8 

 

 

 

 

17

 The device identifier for SNP Slave ports is packed into words with the least significant character in the least significant byte of the word. 

For example, if the first two characters are “A” and “B,” the Address

 + 18 will contain the hex value 4241. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

537 

25.2.6

 

COMMREQ Command Block for Configuring RTU 
Protocol 

 

Values 

Meaning 

First 6 words 

 

Reserved for COMMREQ use. 

Address + 6 

FFF0H 

Command 

Address + 7 

Protocol:  0003=RTU  

Address + 8 

Port Mode:  0000=Slave 

Address + 9 

10=175000, 7=38400, 
6=19200, 5=9600, 4=4800, 
3=2400, 2=1200, 1=600, 
0=300 

Data Rate  

Address + 10 

0 = None, 1 = Odd, 2 = Even 

Parity 

Address + 11 

0 = Hardware, 1 = None 

Flow Control 

Address + 12 

0-255 (units of 10ms.  
For example, 10=100ms) 

Turnaround delay. For release 2.02 and later 
CPUs only.  
0 for all other CPUs. 

Address + 13 

not used 

Timeout 

Address + 14 

not used 

Bits per Character 

Address + 15 

0 = 1, 1 = 2 

Stop Bits 

Address + 16 

not used 

Interface 

Address + 17 

0 = 2-wire, 1 = 4-wire 

Duplex Mode 

Address + 18 

Station Address (1-247) 

Device Identifier 

Address + 19 - 21 

not used 

Device Identifier 

Address + 22

18

 

255 (units of 10ms) 

Receive to Transmit Delay 

Address + 23

18

 

0-255 (units of 10ms) 

RTS Drop Delay 

 

 

 

 

18

 

Release 2.02 and later Micro PLC CPUs support Receive to Transmit Delay and RTS Drop Delay functionality for RTU and Serial IO through 

the Serial Port Setup COMMREQ. Both of these optional parameters are described in Receive to Transmit Delay and RTS Drop Delay. When 
configuring the protocol, these two optional parameters can be added to the port setup COMMREQ. The data block length (Address + 0) 
for a COMMREQ that includes the Receive to Transmit Delay and RTS Drop Delay parameters should be 12H, not 10H. Either length (10H 
or 12H) is valid for this COMMREQ. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

538 

Receive to Transmit Delay and RTS Drop Delay 

Release  2.02  and later Micro PLC CPUs support  Receive to Transmit Delay and RTS Drop 
Delay functionality for RTU and Serial IO through the Serial Port Setup COMMREQ. 

When configuring the protocol, these two optional parameters can be added to the port 
setup COMMREQ. The data block length (Address + 0) for a COMMREQ that includes the 
Receive to Transmit Delay and RTS Drop Delay parameters should be 12H, not 10H. Either 
length (10H or 12H) is valid for this COMMREQ. 

Receive to transmit delay - This is the time interval that defines the end of each received 
response message. It is measured from the end of the last received character. RTS is off and 
the transmitter is silent during this interval. If a new query is ready for transmission, RTS is 
asserted no earlier than the end of this interval. 

Zero  specifies  the  default,  defined  as  3.5  character  times  at  the  specified  data  rate, 
assuming 11 bits per character. 

Data Rate 

Default (10ms Units) 

Data Rate 

Default (10ms Units) 

1200 
2400 
4800 
9600 

322 
161 
80 
40 

19200 
38400 
57600 
115200 

21 
10 

If the required delay is greater than the default value at the current data rate, increase the 
specified value to required delay in 10ms units. If the required delay is less than the default 
at the current data rate, no additional delay is necessary. 

RTS Drop Delay -This is the time from the end of the last transmitted character to the time 
when RTS is turned off (dropped). The RTS Drop Delay is also specified in 10ms units. The 
receiver is disabled during transmission and remains disabled during the RTS drop delay 
time. 

Data Rate 

Default (10ms Units) 

Data Rate 

Default (10ms Units) 

1200 
2400 
4800 
9600 

92 
46 
23 
12 

19200 
38400 
57600 
115200 




 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

539 

25.2.7

 

COMMREQ Command Block for Configuring Serial I/O 
Protocol 

 

Values 

Meaning 

First 6 words 

 

Reserved for COMMREQ use. 

Address + 6 

FFF0H 

Command 

Address + 7 

0005 

Protocol:  0005=Serial IO 

Address + 8 

0 = Slave 

Port Mode 

Address + 9 

10=175000, 7=38400, 
6=19200, 5=9600, 4=4800, 
3=2400, 2=1200, 1=600, 0=300 

Data Rate (bps) 

Address + 10 

0 = None, 1 = Odd, 2 = Even 

Parity 

Address + 11 

0 = Hardware, 1 = None 

Flow Control 

Address + 12 

0-255 (units of 10ms). For 
example, 10 = 100ms). 

Turnaround Delay. For release 2.02 and 
later CPUs only. 0 for all other CPUs. 

Address + 13 

0 = Long 

Timeout  

Address + 14 

0=7 bits, 1=8 bits 

Bits per Character 

Address + 15 

0 = 1 stop bit, 1 = 2 stop bits 

Stop Bits 

Address + 16 

must be set to 0 

Interface 

Address + 17 

0 = 2-wire, 1 = 4-wire 

Duplex Mode 

Address + 18

21 

not used 

Device Identifier 

Address + 22

19

 

0-255 (units of 10ms) 

Receive to transmit delay / RTS Drop Delay 

 

 

 

 

19

 Release 2.02 and later Micro PLC CPUs support Receive to Transmit Delay and RTS Drop Delay functionality for RTU and Serial IO through 

the Serial Port Setup COMMREQ. Both of these optional parameters are described in Receive to Transmit Delay and RTS Drop Delay. When 
configuring the protocol, these two optional parameters can be added to the port setup COMMREQ. The data block length (Address + 0) 
for a COMMREQ that includes the Receive to Transmit Delay and RTS Drop Delay parameters should be 12H, not 10H. Either length (10H 
or 12H) is valid for this COMMREQ. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

540 

25.3

 

Calling Serial, I/O COMMREQs from the PLC 
Sweep 

Implementing a serial protocol using Serial I/O COMMREQs may be restricted by the Micro 
PLC sweep time.  For example, if the protocol requires that a reply to a certain message from 
the remote device be initiated within 5ms of receiving the message, this method may not 
be successful if the sweep time is 5mS or longer, since timely response is not guaranteed. 

When using Serial, I/O protocol with a VersaMax Nano or 14 point Micro PLC, the user switch 
must be configured.  A Nano PLC requires an external switch connection.  When a Nano PLC 
or  14-Point  Micro  PLC  is  in  Run  mode,  Serial  I/O  protocol  is  active;  after  a  Run-to-Stop 
transition, the Nano PLC or 14-Point Micro PLC automatically reverts to SNP.  An SNP master 
device  (VersaPro,  for  instance)  is  not  able  to  communicate  with  a  Nano  PLC  or  14-Point 
Micro PLC that is configured for Serial I/O when it is in Run mode.  

Since the Serial I/O is completely driven by the application program, in STOP mode a port 
configured  as  Serial  I/O  automatically  reverts  to  SNP  slave,  to  facilitate  programmer 
communication. Therefore, while in Stop mode, Serial I/O protocol is not active; it is only 
active when the PLC is in Run mode. 

Calling the Serial, I/O from a Timed Interrupt Block 

The protocol can also be implemented from within a timed interrupt block.  Whenever the 
interrupt block executes, the status of the previous COMMREQ or the status of the port is 
queried to determine if the last requested action is complete. It if is, a new port command 
can be initiated with a COMMREQ function block. 

25.3.1

 

Compatibility 

The COMMREQ function blocks supported by Serial I/O are not supported by other currently 
existing protocols (such as SNP slave, SNP master, and RTU slave).  Errors are returned if they 
are attempted for a port configured for one of those protocols 

 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

541 

25.3.2

 

Status Word for Serial I/O COMMREQs 

A value of 1 is returned in the COMMREQ status word upon successful completion of the 
COMMREQ. Any other value returned is an error code where the low byte is a major error 
code and the high byte is a minor error code. 

Major Error 
Code 

Description 

 1 (01h) 

Successful Completion (the expected completion value in the COMMREQ status word). 

12 (0Ch) 

Local error 

Error processing local command. Minor error code identifies the specific error. 

 

1 (01h) 

Wait-type command is not permitted. Use No-Wait command. 

 

2 (02h) 

COMMREQ command is not supported. 

 

5 (05h) 

Error writing COMMREQ status word to PLC memory. 

 

6 (06h) 

Invalid PLC memory type specified. 

 

7 (07h) 

Invalid PLC memory offset specified. 

 

8 (08h) 

Unable to access PLC memory. 

 

12 (0Ch) 

COMMREQ data block length too small. 

 

14 (0Eh) 

COMMREQ data is invalid. 

13 (0Dh) 

Remote error 

 Error processing a remote command. Minor error code identifies the error. 

 

2 (02h) 

Number of bytes to read exceeds input buffer size, or more than 250 bytes requested to be 
written. 

 

3 (03h) 

COMMREQ data block length is too small. String data is missing or incomplete. 

 

4 (04h) 

Receive timeout awaiting serial reception of data 

 

8 (08h) 

Unable to access PLC memory. 

 

12 (0Ch) 

COMMREQ data block length too small. 

 

48 (30h) 

Serial output timeout. The port was unable to transmit the string. (Could be missing CTS signal 
when the serial port is configured to use hardware flow control.) 

 

50 (32h) 

COMMREQ timeout. The COMMREQ did not complete within 20-second time limit. 

14 (0Eh) 

Autodial Error 

 An error occurred while attempting to send a command string to an attached external 

modem. The minor error code identifies the specific error. 

 

2 (02h) 

The modem command string length exceeds end of reference memory type. 

 

3 (03h) 

COMMREQ Data Block Length too small. Output command string data missing or incomplete. 

 

4 (04h) 

Serial output timeout. The port was unable to transmit the modem autodial output.  

 

5 (05h) 

Response was not received from modem. Check modem and cable. 

 

6 (06h) 

Modem responded with BUSY. Modem is unable to complete the requested connection. The 
remote modem is already in use; retry the connection request later. 

 

7 (07h) 

Modem responded with NO CARRIER. Modem is unable to complete the requested connection. 
Check the local and remote modems and the telephone line. 

 

8 (08h) 

Modem responded with NO DIALTONE. Modem is unable to complete the requested connection. 
Check the modem connections and the telephone line. 

 

9 (09h) 

Modem responded with ERROR. Modem is unable to complete the requested command. Check 
the modem command string and modem. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

542 

Major Error 
Code 

Description 

 

10 (0Ah) 

Modem responded with RING; the modem is being called by another modem. Modem is unable 
to complete the requested command. Retry the command later. 

 

11 (0Bh) 

Unknown response from modem.  Modem unable to complete the command. Check modem 
command string and modem. Response should be CONNECT or OK. 

 

50 (32h) 

COMMREQ timeout. The COMMREQ did not complete within 20 seconds. 

25.4

 

Serial I/O COMMREQ Commands 

The following COMMREQs are used to implement Serial I/O: 

 

Local COMMREQs - do not receive or transmit data through the serial port. 

 

Initialize Port (4300) 

 

Set Up Input Buffer (4301) 

 

Flush Input buffer (4302) 

 

Read port status (4303) 

 

Write port control (4304) 

 

Cancel Operation (4399) 

 

Remote COMMREQs - receive and/or transmit data through the serial port. 

 

Autodial (4400) 

 

Write bytes (4401) 

 

Read bytes (4402) 

 

Read String (4403) 

25.4.1

 

Overlapping COMMREQs 

Some of the Serial I/O COMMREQs must complete execution before another COMMREQ can 
be processed. Others can be left pending while others are executed. 

COMMREQS that Must Complete Execution 

 

Autodial (4400) 

 

Initialize Port (4300) 

 

Set Up Input Buffer (4301) 

 

Flush Input buffer (4302) 

 

Read port status (4303) 

 

Write port control (4304) 

 

Cancel Operation (4399) 

 

Serial Port Setup (FFF0) 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

543 

COMMREQs that Can be Pending While Others Execute 

The table below shows whether Write Bytes, Read Bytes and Read String COMMREQs can 
be pending when other COMMREQs are executed. 

 

New COMMREQ 

Currently-
pending 
COMMREQs 

Autodial 
(4400) 

Write 
bytes 
(4401) 

Initialize 
Port 
(4300) 

Set Up 
Input 
Buffer 
(4301) 

Flush 
Input 
buffer 
(4302) 

Read 
port 
status 
(4303) 

Write 
port 
control 
(4304 

Read 
bytes 
(4402) 

Read 
String 
(4403) 

Cancel 
Operation 
(4399) 

Serial 
Port 
Setup 
(FFF0) 

Write bytes 
(4401) 

No 

No 

Yes 

Yes 

Yes 

Yes 

Yes 

Yes 

Yes 

Yes 

No 

Read bytes 
(4402) 

No 

Yes 

Yes 

No 

No 

Yes 

Yes 

No 

No 

Yes 

No 

Read String 
(4403) 

No 

Yes 

Yes 

No 

No 

Yes 

Yes 

No 

No 

Yes 

No 

25.4.2

 

Initialize Port Function (4300) 

This function causes a reset command to be sent to the specified port.  It also cancels any 
COMMREQ currently in progress and flushes the internal input buffer.  RTS is set to 
inactive. 

Example Command Block for the Initialize Port Function 

 

Value 
(decimal) 

Value 
(hexadecimal) 

Meaning 

address 

0001 

0001 

Data block length 

address +1  0000 

0000 

NOWAIT mode 

address +2  0008 

0008 

Status word memory type (%R) 

address +3  0000 

0000 

Status word address minus 1 (%R0001) 

address +4  0000 

0000 

Not used 

address +5  0000 

0000 

Not used 

address +6  4300 

10CC 

Initialize port command 

Operating Notes 

Note: 

COMMREQs  that  are  cancelled  due  to  this  command  executing  do  not  have  their  respective 
COMMREQ status words updated. 

CAUTION 

If this COMMREQ is sent when a Write Bytes (4401) COMMREQ is transmitting a string from 
a serial port, transmission is halted. The position within the string where the transmission is 
halted is indeterminate. In addition, the final character received by the device the Micro PLC 
is sending to is also indeterminate. 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

544 

25.4.3

 

Set Up Input Buffer Function (4301) 

This function can be used to change the size of the internal memory buffer where input data 
will be placed as it is received. By default, the buffer is set to a maximum of 2K bytes.  As data 
is received from the serial port it is placed in the input buffer.  If the buffer becomes full, any 
additional data received from the serial port is discarded and the Overflow Error bit in the 
Port Status word (See Read Port Status Function) is set.  

Retrieving Data from the Buffer 

Data can be retrieved from the buffer using the Read String or Read Bytes function. It is not 
directly accessible from the application program.   

If data is not retrieved from the buffer in a timely fashion, some characters may be lost. 

Example Command Block for the Set Up Input Buffer 
Function 

 

Value 
(decimal) 

Value(hexadeci
mal) 

Meaning 

address 

0002 

0002 

Data block length 

address +1 

0000 

0000 

NOWAIT mode 

address +2 

0008 

0008 

Status word memory type (%R) 

address +3 

0000 

0000 

Status word address minus 1 (%R0001) 

address +4 

0000 

0000 

Not used 

address +5 

0000 

0000 

Not used 

address +6 

4301 

10CD 

Setup input buffer command 

address +7 

0064 

0040 

Buffer length (in words) 

Operating Notes 

It is not possible to set the buffer length to zero. If zero is entered as the buffer length, the 
buffer size will be set to the 2K bytes default. 

If a length greater than 2K bytes is specified, an error is generated. 

 

 

 

User Manual 

Chapter 25 

GFK-1645M 

Dec 2019 

 

Serial I/O, SNP & RTU Protocols 

545 

25.4.4

 

Flush Input buffer Function (4302) 

This operation empties the input buffer of any characters received through the serial port 
but not yet retrieved using a read command.  All such characters are lost. 

Example Command Block for the Flush Input Buffer Function 

 

Value 
(decimal) 

Value 
(hexadecimal) 

Meaning 

address 

0001 

0001 

Data block length 

address +1 

0000 

0000 

NOWAIT mode 

address +2 

0008 

0008 

Status word memory type (%R) 

address +3 

0000 

0000 

Status word address minus 1 (%R0001) 

address +4 

0000 

0000 

Not used 

address +5 

0000 

0000 

Not used 

address +6 

4302 

10CE 

Flush input buffer command 

25.4.5

 

Read port status Function (4303) 

This function returns the current status of the port. The following events can be detected: 

1.

 

A read request was initiated previously, and the required number of characters has 
now been received or the specified time-out has elapsed. 

2.

 

A write request was initiated previously and transmission of the specified number of 
characters is complete or a time-out has elapsed. 

The  status  returned  by  the  function  indicates  the  event  or  events  that  have  completed.  
More than one condition can occur simultaneously, if both a read and a write were initiated 
previously. 

Example Command Block for the Read Port Status Function 

 

Value 
(decimal) 

Value 
(hexadecimal) 

Meaning 

address 

0003 

0003 

Data block length 

address +1 

0000 

0000 

NOWAIT mode 

address +2 

0008 

0008 

Status word memory type (%R) 

address +3 

0000 

0000 

Status word address minus 1 (%R0001) 

address +4 

0000 

0000 

Not used 

address +5 

0000 

0000 

Not used 

address +6 

4303 

10CF 

Read port status command 

address +7 

0070 

0046 

Port status memory type (%I) 

address +8 

0001 

0001 

Port status memory offset (%I0001) 

 

 

 

 

 

 

 

 

 

 

Content      ..     34      35      36      37     ..