CAI Networks WebControl PLC Скачать руководство пользователя страница 45

 WebControl

TM

 PLC User Guide Version 3.02.17f 

Copyright(c) 2008,-2013 CAI Networks, Inc.                                                            42

 

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 

WSRPLY 

in the WebControl.  PLC program can 

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. 

Содержание WebControl PLC

Страница 1: ...WebControlTM Programmable Logic Controller User Guide Version 3 2 17f Hardware Version 2 2 2 Firmware Version 3 02 17f5 Firmware datastamp 10 15 2013 Doc last modified 11 1 2013...

Страница 2: ...6 Notification Setup 12 3 7 General Setup 15 3 8 Reset Setup 16 4 AUX System Inputs 17 4 1 Digital Inputs 17 4 2 Analog Inputs 18 4 3 DS1822 DS18B20 1 Wire Temperature Sensors 18 4 4 Honeywell 4000 Se...

Страница 3: ...Time based Control 36 6 4 9 Example 9 Battery Charger 39 6 4 10 Example 10 RFID reader and browser Control 40 6 4 11 Example 11 Bitwise Operation 41 6 4 12 Example 12 Angle Calculation 41 6 4 13 Examp...

Страница 4: ...3 Figure 3 0 WebControlTM PLC system status 5 Figure 4 0 WebControlTM PLC Network configurable 6 Figure 5 0 I O setup 8 Figure 6 0 WebControlTM X10RF Control 10 Figure 6 0 WebControlTM Output Control...

Страница 5: ...rogramming module and programming guide are provided for a learn on your own experience Assistance in writing or debugging PLC code is not provided as part of the regular technical support for WebCont...

Страница 6: ...oltage greater than 12V applied to this input may require adding heatsink to regulator otherwise it may overheat 2 2 TTL Output Port The TTL logic level output port has 8 TTL outputs that can each be...

Страница 7: ...ire temperature sensors to be connected It also allows one Maxim DS2417 real time clock and one DS2450 4 channel A D converter The temperature and analog input can be displayed via the HTTP browser an...

Страница 8: ...enabled at the router Each WebControlTM PLC board has a unique MAC address Look in the DHCP log to find the matching MAC address then you can find the IP address DHCP assigned to the hardware From a...

Страница 9: ...llowed Limits host IP address from eight to four In addition it added NTP Server section to allow user to enter his local NTP server s IP address to overwrite the default pool ntp org resolved IP addr...

Страница 10: ...bControlTM PLC User Guide Version 3 02 17f Copyright c 2008 2013 CAI Networks Inc 7 access the WebControlTM board over the network Please note that if any entry is 0 0 0 0 all IP addresses can access...

Страница 11: ...ecide if the PLC control will be applicable Figure 5 0 I O setup WebControlTM PLC allows user using browser to directly control the output state If a command line utility or third party control softwa...

Страница 12: ...nt Enable TTL Input Enable are radio buttons that you can only select one of them Those functions sharing the same TTL1 input Please note the Counter is triggered at rising edge after the falling edge...

Страница 13: ...the frequency is 433 MHz WebControl can send all 16 house codes and 16 unit codes controlling total 256 devices X10 RF function is supported in the PLC programming also In PLC programming PLC command...

Страница 14: ...output will change However the display may or may not update depending on the Web pulling enabled in the General Setup screen If you did not enable the Web Pulling to save the bandwidth you will need...

Страница 15: ...for a different event WebControl 3 02 16 firmware also allow HTTP GET to be used to set the VAR or output state to another WebControl board provided the other board does not enable logic If the secur...

Страница 16: ...or server does not respond the WEBSET will fail Figure 7 0 WebControlTM email setup Starting from the 3 2 15 firmware we allow user to configure less I O being report By default all I O status is repo...

Страница 17: ...222 80 www mydomain com Please note ISY99 using port 80 URI example rest vars set 1 15 Base64 encrypted username password Example YWRtaW46cGFzc3dvcmQg Between username and password there is no space I...

Страница 18: ...and update the clock from this screen by typing MM DD YY HH MM SS format in the Set Date Time input field then click Send button If a DS2417 chip is discovered on 1 wire bus the real time clock will b...

Страница 19: ...duce bounced signals from stub wire and far end of the bus instead of change the timing When Web polling enabled WebControlTM PLC building active Java code will constantly update the browser display f...

Страница 20: ...onnector Figure 9 0 WebControlTM J12 Input pins 4 1 Digital Inputs WebControlTM has eight digital TTL inputs each of which can be configured to be inverted upon input to the system The PLC engine will...

Страница 21: ...ure sensor terminal In PLC code user can reference to the fourth analog input value AIP4 which is the reading from humidity sensor 4 3 DS1822 DS18B20 1 Wire Temperature Sensors WebControlTM supports u...

Страница 22: ...ing varies a lot which is an indication your power supply is not providing enough voltage to the board 4 5 Timers WebControlTM PLC is different from BRE engine User must write PLC code to implement ti...

Страница 23: ...geta3 cgi to query analog input values geth1 cgi to query the humidity sensor readings geti1 cgi geti2 cgi geti8 cgi to query each digital input values geto1 cgi geto2 cgi geto8 cgi to query each TTL...

Страница 24: ...stence during power up Once it finds the DS2417 it will get its clock synced with DS2417 every 10 minutes User can update the clock in DS2417 by manually go to General Setup screen put the date and ti...

Страница 25: ...rom one section of logic to another without call stack to return CALLSUB instruction is for unconditional logic flow that may return to the original call stack BNZ and BZ are conditional GOTO to branc...

Страница 26: ...put value is only set for the period specified in the brackets All delay periods are specified in milliseconds Note that accuracy and timer resolution is approximately 100ms even though the delay oper...

Страница 27: ...AND a b d Logical AND s a with b and optionally puts Boolean result into d Zero bit updated ANDB a b d Bitwise AND s a with b and optionally puts bitwise AND result into d Zero bit updated OR a b d L...

Страница 28: ...the result TAND a b a degree b VAR or RAM to store the result ROTL a b c a source register b number of bits c result register rotate to the left overflow bits will be feed into right ROTR a b c a sou...

Страница 29: ...WebControlTM PLC User Guide Version 3 02 17f Copyright c 2008 2013 CAI Networks Inc 26...

Страница 30: ...TTL input as IP1 IP8 IPINV3 except is inverted for filter short pulse purpose IPINV4 its usage is like IPINV1 1000 to filter 1 0 IPINV5 pulse shorter than 1000ms If 1 0 pulse is shorter than IPINV6 1...

Страница 31: ...hour of day CM Current minute of hour CS Current second of minute CDAY Current day of month CMONTH Current month of year CYEAR Current year CTS Current total seconds since 1 1 2000 based on local cloc...

Страница 32: ...lay RAM20 operator is not valid on these Not displayed anywhere RAM30 store in the SAME RAM location as RAM1 8 byte 0 location RAM40 RAM50 RAM60 RAM70 RAM80 RAM11 8 bit signed integer general purpose...

Страница 33: ...All 8 TTL as a byte Only in 3 02 17a firmware ALLOUTS read write All 8 TTL output as a byte only in 3 02 17a firmware 6 4 WebControl PLC Examples For best understanding how PLC logic working you can t...

Страница 34: ...HEAT_OFF END HEAT_ON SET OP1 1 RET HEAT_OFF SET OP1 0 RET What if the heater relay stuck or the heater elements burn out You can add additional function in this PLC program to send you email notice or...

Страница 35: ...utton The better way to handle the case is like Example 10 later in this manual However if TTL OIP1 connected to a clean signal source this example does work well 6 4 4 Example 4 Send EMAIL To send em...

Страница 36: ...re of the PLC logic Although in this case GOTO can do same thing as CALLSUB CALLSUB can help program more readable In certain logic you have to use CALLSUB instead of GOTO depending on the logic flow...

Страница 37: ...and down In reality you have to add consideration to it 6 4 6 Example 6 Sequential I O The following simple program shows how to set up sequential I O OP1 is set when IP1 rises from 0 to 1 OP4 is cle...

Страница 38: ...he can cross the street safely IP1 hooks up to the pedestrian crossing button If someone pushed cross button the street will have amber light on for 10 seconds then red light to stop all the cars all...

Страница 39: ...HTS_GO RET 6 4 8 Example 8 Time based Control WARNING For time critical application please make sure to check CYEAR correct before taking action based on system clock When WebControlTM boot up it will...

Страница 40: ...ensor AIP3 on the water softener and send email notice 2 The YEARLY routing will ring the New Year s bell connected to OP6 on each and every New Year s Day for the whole day START CALLSUB HOURLY CALLS...

Страница 41: ...TLE CM 45 GOTO ZONE3 SET OP4 0 ZONE4 SET OP5 1 TSTLE CM 50 GOTO ZONE4 SET OP5 0 SET RAM5 1 W_DONE RET Please note in DAILY subroutine we call another subroutine watering In this place we have to use s...

Страница 42: ...ime based logic please make sure the time being used in different part of the program having no conflict between all the subroutines If you want two things to happen at the same time you should consid...

Страница 43: ...der as well as allowing operator remote browser control the following program provided the example RFID reader s NC normally connect output connects to IP1 on WebControl digital input A 2 2K pull up r...

Страница 44: ...o that not being set over and over again For gate opening device this will make sure the gate will not left open all the time 6 4 11 Example 11 Bitwise Operation There are ANDB ORB and XORB operator o...

Страница 45: ...rver 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...

Страница 46: ...REMOTE_ADDR fp fopen tmp webcontrol txt w fwrite buffer 1 strlen buffer fp if data NULL fwrite data 1 unsigned int strlen data fp fwrite buffer 1 strlen buffer fp if remote_host NULL fwrite remote_ho...

Страница 47: ...WebControlTM PLC User Guide Version 3 02 17f Copyright c 2008 2013 CAI Networks Inc 44 printf to push up to 10 bytes to WebControl SET_WC 2147483647 n printf close connection n fclose fp return 0...

Страница 48: ...with your ISP to make sure the DNS server IP address is valid If you have Linux computer you can use dig command to make sure that DNS server IP can resolve the ntp org Please note that many ISPs res...

Страница 49: ...1 wire bus Please check out Maxim IC AppNote148 You do not have to add external power if you do not experience any problem 6 7 Turn on off TTL output from another programming language 3 1Q I want to...

Страница 50: ...ely to the ground also Any anlog input channel should have 1K input resistor to block some the incoming noise 6 9 Power Supply Requirement 5 1Q What kind of power required to run WebControl 5 1A WebCo...

Отзывы: