SingleRequest vs. CyclicRequest
When accessing data points on an S7 Controller via an I/O mapping (see chapter about Mapping vs. PLC library), various access types can be configured. Their mode of operation is described in more detail below. The following table shows both access types in comparison first of all.
Request | Trigger |
---|---|
Single | via SendRequest variable |
Cyclic | via configurable CycleTime |
SingleRequest
In the case of SingleRequest, the data points are configured and added to the process image. The read or write access takes place “on demand”, however, i.e. when a certain condition occurs. This condition can be produced using the status and control variables. A request is exactly executed, for example, if SendRequest is one bigger than the ReceiveCounter. The overflow of the variables with the data type BYTE also need to be observed here, i.e. 0 > 255.
The following table provides an overview of this:
Variable | Data type | Description |
---|---|---|
Control.SendRequest | BYTE | By incrementing these variables from the application code, a read/write command (request) is triggered. As soon as the associated response has been received from the S7 Controller, the input variable, Status.ReceiveCounter is also incremented by 1 accordingly. The application thus knows that the read/write operation was successful. |
Control.WriteToS7Enable | BIT | Write commands are only executed if this variable was set to TRUE. |
Status.ReceiveCounter | BYTE | see Control.SendRequest above |
Status.Error | WORD | When an error occurs whilst working through a command, the error code associated with this is displayed here. A description of the error codes is stored in the comment box. |
CyclicRequest
In the case of a CyclicRequest, the read or write command is worked through cyclically. The cycle time can be configured via a parameter. If the cycle time is set faster than the realtime task of the system, then the request runs as quickly as possible, i.e. a new request is sent as soon as the previous one has been answered by the remote system.