Example 13, Non-Blocking Delay; Example 14, Your Examples - CAI Networks WebControl PLC User Manual

Programmable logic controller
Table of Contents

Advertisement

TM
WebControl
PLC User Guide Version 3.02.17f
Or
TAND 630 VAR3
The result for SIND and COSD is x1000, because we can only have integer on this
processor. The result for TAND is x100.

6.4.13 Example 13, Non-Blocking Delay

Non-blocking delay is expressed in PLC code as [] next to the operators. The
number inside [] is micro-seconds. The [] operation can be on both operators during
TST operations. Each input and output and VAR associated with a non-blocking
delay timer value. That value is set when I/O state is changed or VAR value being
modified. If later PLC instruction using non-blocking delay, that timer value will be
referenced. If current time is less than stored timer time plus the delay period, the
specified operation will not be performed. Reading value with non-blocking delay will
return false if timer value is not meet For example,
TSTGT VAR1[1500] IP1[300] RAM2
If any of those delay not reached, its result will be FALSE.
For SET VAR1[15000] IP1
VAR1 will not be set to IP1 value, unless 15000 milliseconds (15seconds) passed.
6.4.14 Example 14, WEBSET to get server reply
From 3.02.16 version firmware, WebControl allows PLC call WEBSET to do HTTP
GET call to HTTP servers inside another WebControl or other devices, or Apache or
IIS servers. The web server CGI code can process that information. From 3.02.17
version firmware, the web server can also send back to the WebControl a specially
formatted string. When WebControl received that string, it will set an internal variable
for user PLC code to reference. Following is an example CGI code from apache
server that will set the WebControl
in the WebControl. PLC program can
WSRPLY
base on that reply to turn on or off an I/O bit or take any other action.
Because PLC code does not execute WEBSET call immediately, rather WEBSET is
on a scheduler called from queue, user can not expect to get server reply
immediately after WEBSET call. The good practice would to check if the WSRPLY
value is zero, if that is zero, the server reply has not fetched back yet. Server must
return a non-zero value back. If WSRPLY is non-zero, user PLC must read it into
another variable and set it to zero, so that it can be used for next WEBSET call. In
this sense, if PLC logic wants to get multiple values from server reply, it must issue
one call at a time to avoid different WEBSET call return value clashing.
6.4.15 Example 15, Server CGI Handles WEBSET
The code below is for demonstration only, it is written in C on apache server. We do
not provide support for writing server CGI code. Please note to get the best result,
server CGI code should write back the string as early in the reply as possible. In
HTTP server reply processing, server mostly after sending reply will close
connection. If the "SET_WC=2147483647" string sending out too late, it could get
lost because the connection is closed already. Please test and make sure your
server is response fast enough for the WEBSET call.
Copyright(c) 2008,-2013 CAI Networks, Inc.
42

Advertisement

Table of Contents
loading

Table of Contents