CAI Networks WebControl PLC User Manual

CAI Networks WebControl PLC User Manual

Programmable logic controller
Table of Contents

Advertisement

Quick Links

WebControl
Programmable Logic
Version:
Hardware Version:
Firmware Version:
Firmware datastamp:
Doc last modified:
Controller
User Guide
3.2.17f
2.2.2
3.02.17f5
10/15/2013
11/1/2013
TM

Advertisement

Table of Contents
loading

Summary of Contents for CAI Networks WebControl PLC

  • Page 1 WebControl 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...
  • Page 2: Table Of Contents

    The Basics of PLC Programming ............... 22 WebControl PLC Instructions ..............23 WebControl PLC I/O Identifiers .............. 27 WebControl PLC Examples ................ 30 6.4.1 Example 1 Set Output based on condition .......... 30 6.4.2 Example 2: Flash TTL output ............. 31...
  • Page 3 PLC FAQ ..................45 Login and Configuration ................45 Temperature Sensor Support ..............45 Turn on/off TTL output from another programming language ..... 46 External Analog Chip DS2450 ..............47 Power Supply Requirement ................ 47 Copyright(C) 2008-2013 CAI Networks, Inc.
  • Page 4 Figure 7.0 WebControl email setup ............... 13 Figure 8.0 Network defaults ..................15 Figure 9.0 WebControl J12 Input pins ..............17 Figure 10.0 WebControl Temperature sensor assignments ........18 Figure 11.0 DS2417 layout ..................21 Copyright(C) 2008-2013 CAI Networks, Inc.
  • Page 5: Introduction

    PLC. It describes the inputs and outputs offered by the PLC version of the WebControl hardware and firmware. The WebControl PLC Programming Guide is found in chapter 6 of this document. Function, usage and syntax as well as many examples are provided there to help you get started. WebControl...
  • Page 6: Webcontrol Tm I/O

    20mA or 100mA for the whole board. TTL 0 level defined as 0-2V and TTL 1 level is define 3-5V with TTL 0 almost 0V and TTL 1 almost 5V depending on the Copyright(c) 2008,-2011 CAI Networks, Inc.
  • Page 7: 1-Wire Sensor Input

    HTTP or be used to control the TTL outputs as an input in the PLC engine. Figure 2.0 WebControl sensor connections Please make sure the temp sensor and humidity sensor connected similar to this picture. Reverse the polarity may cause damage to the board. Copyright(c) 2008,-2011 CAI Networks, Inc.
  • Page 8: Webcontrol Tm Plc Web Gui Configuration

    These are the basic settings that need to be configured in order for WebControl work successfully on a network. It may be necessary to connect the board directly to a PC and access it using its default IP address before connecting directly to a live Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 9: Access Settings

    3.1.2 Access Settings For security purpose, you can decide your own user name and password. For being used over Internet, you may also set the access list, so that only host in the list can Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 10 WebControl PLC User Guide Version 3.02.17f access the WebControl board over the network. Please note that if any entry is 0.0.0.0, all IP addresses can access it. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 11: I/O Setup

    X10 Enable will allow user to send X10RF commands through TTL port7 and TTL port8. Those two ports will not be able to perform any other function, once X10 is enabled. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 12 Please note the Counter is triggered at rising edge after the falling edge. If your counting source TTL level was zero from start with, you may miss count by 1. Frequency measurement is up to 2MHz. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 13: X10 Rf Control

    X10 operation in PLC logic. If the X10 function enabled, TTL7 and TTL8 should not be used for controlling other devices. Please note PLC logic uses 0-15 or 0-0xF for code, web GUI only use 0-F. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 14: Output Control

    Please note “Save States” button will make WebControl store the state in the EEPROM. When power lost and reapplied, the output will remember the states being saved. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 15: Notification Setup

    If the other side does not require login, this field can be left blank. For example, if you want to set a remote WebControl board VAR1 to value 1234, you simple in the PLC logic calling: WEBSET URL1 1234 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 16: Figure 7.0 Webcontrol

    URLs queued for sending. If PLC logic made such a call too fast, the newer email or WEBSET notification will overwrite the older ones in the queue. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 17 CGI code and how to refer to this returned value. To obtain support for email or WEBSET feature, full TCP capture data is required. The captured data must be able to fully display in WireShark software. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 18: General Setup

    EEPROM, so that when power lost, its value will be kept by the EEPROM. When power restored, UROM value will remain whatever they set before. There are two ways to set UROM value. One is to set it on this web GUI page by save modified Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 19: Reset Setup

    Please note reset will wipe out the entire configuration, including the PLC program. Please make sure backup your PLC program before reset. After reset, the login ID and password will be restored to “admin/password”. Default IP address is 192.168.1.15 with DHCP disabled. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 20: Aux System Inputs

    TTL level 0 is defined 0-1.75V; TTL level 1 is defined as 3-5V. When TTL1 being used as counter/frequency measurement purpose, its counts pulses up to 2MHz and max count is 32bit number. Counter starts counts from rising edge after the falling edge. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 21: Analog Inputs

    WebControl will display the state as failed, but keep the last valid sensor value. This is to prevent the PLC logic turn on heater/cooler or motor undesirably. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 22: Honeywell 4000 Series Relative Humidity Sensor

    Boolean expressions. WebControl PLC has calibrated the humidity curve at 11%, 25%, 45%, and 78%. However, due to sensor differences, some sensors may read the humidity value different from actual value.
  • Page 23: Direct Query System Inputs And Outputs

    “getfcounter.cgi” – to query the frequency measurement per second value. “getall.cgi” – to query all sensor and I/O status VAR1-VAR8 can also be set by web UI. Please see FAQ section for how to do that. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 24: Real Time Clock

    3.2.9 supports DS2417 real-time clock. DS2417 takes one 32.768 kHz crystal, EPSON part number C-002RX or C-004R (make sure load capacitance is 6pF). One can easily solder the parts similar to this PCB layout: Figure 11.0 DS2417 layout Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 25: Webcontrol Tm Plc Programming

    #instructions here Subroutines can be called from the main program and from within other subroutines. Note that WebControl PLC has a return program address stack depth of 8 (or call stack 8). The program control block has a zero bit that is updated implicitly on TEST instructions.
  • Page 26: Webcontrol Tm Plc Instructions

    (d). Zero bit updated with result. If test evaluates to false then the next instruction is skipped. TSTGE a[] b[] (d[]) Tests if a is greater than OR equal to b. Boolean result loaded into optional destination (d). Zero bit updated with Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 27 Zero bit updated. Skip next line if zero. (a) b If the optional a operand is specified it is tested for a non- zero value. If a is not specified then the zero bit is tested for Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 28 'sun' 'mon' 'tue' 'wed' 'thu' 'fri' 'sat' • an I/O identifier that is a place holder for the real I/O value that the PLC engine will get at runtime. Valid I/O identifiers are explained in next section. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 29 WebControl PLC User Guide Version 3.02.17f Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 30: Webcontrol Tm Plc I/O Identifiers

    Note that temperature values are specifies in 10's of degrees. So to test for 21.6 degrees C you would use the value 216. Temperature sensor state 1 or 0. 1 == GOOD sensor, 0 == bad sensor Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 31 It will help debug your program, if you store debug VAR5 value in VARx. VAR6 VAR7 VAR8 RAM1 32 bit signed integer general purpose RAM 1...8. Delay RAM2 operator is not valid on these. Not displayed anywhere RAM3 RAM4 RAM5 RAM6 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 32 RAM82 RAM13 8 bit signed integer general purpose RAM 1...8. Delay RAM23 operator is not valid on these. Not displayed anywhere RAM33 store in the SAME RAM location as RAM1-8, byte 3 location RAM43 RAM53 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 33: Webcontrol Plc Examples

    For best understanding how PLC logic working, you can try to copy and paste the examples below into your WebControl PLC program screen to check them out. Please note PLC logic will execute from START to END. Then it will continue from START to END, forever repeating.
  • Page 34: Example 2: Flash Ttl Output

    PLC logic will immediately execute next TSTEQ instruction until the delay is over. START TSTEQ OP2[500] 0 SET OP2 1 TSTEQ OP2[500] 1 SET OP2 0 Another way to implement this is: START XOR OP2 1 OP2 DELAY 500 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 35: Example 3: Push Button Input Control Output

    If you turn on heater or cooler instead of sending email, similar consideration also should be excised: START SET RAM2 0 LOOP: SUB T3 T2 RAM1 TSTGE RAM1 200 RAM1 GOTO SEND SET RAM2 0 GOTO LOOP SEND: Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 36: Example 5, Parallel I/O

    OP4 is cleared if OP1 == 0 The PLC code written for the above scenarios would be as follows: START CALLSUB checkOP1 CALLSUB checkOP2 CALLSUB checkOP3 CALLSUB checkOP4 checkOP1: TSTGT T3 500 OP1 checkOP2: TSTEQ IP1[300] 1 OP2 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 37: Example 6, Sequential I/O

    O4 is set when OP2 == 1 for more than 1 second The assembly language written for the above scenario would be as follows: START BNZ IP1 start TSTEQ IP1 1 BZ l1 SET OP1 1 SET OP4 0 TSTGT T3 250 RAM1 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 38: Example 7, Traffic Lights

    OP1 Red + Pedestrian crossing light OP2 Amber OP3 Green IP1 Pedestrian Push Button START CALLSUB LIGHTS_GO loop: SET VAR1[10000] 1 loop1: TSTEQ IP1 1 BNZ sr BZ VAR1 sr GOTO loop1 CALLSUB STOP GOTO loop LIGHTS_ST: Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 39: Example 8, Time Based Control

    PLC will continuously loop through them. The “HOURLY” routing will compare analog input 1 and analog input 2, if A1 - A2 > 10, send an email notice 1. You can use similar logic to adjust your solar Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 40 TSTGE CH 18 RAM2 TSTLE CH 5 RAM3 OR RAM2 RAM3 OP1 DAILY: TSTEQ CH 7 SET RAM5 0 TSTEQ CH 6 BZ NOTYET TSTGT CM 30 CALLSUB WATERING NOTYET: MONTHLY: TSTNE RAM4 CMONTH GOTO T2 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 41 RAM5 at 7AM. Also, please notice RAM1, RAM4 and RAM5 are holding static value and RAM2 and RAM3 are temporary storage being used by more than one subroutine. You can decide which RAM is for temporary data, which is for static Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 42: Example 9, Battery Charger

    In this way you will not be waked up by email in the midnight. When program WebControl PLC for time based logic, please make sure the time being used in different part of the program having no conflict between all the subroutines.
  • Page 43: Example 10, Rfid Reader And Browser Control

    TESTEQ logic will make sure the OP1 is an 1 second momentary output. “LIGHTS” subroutine is for light control outside the office door; the light is on at 7PM and off at 5AM. START CALLSUB LIGHTS TSTEQ RAM1 0 CALLSUB SET_OP1 CALLSUB CHK4LOW TSTEQ OP1[1000] 1 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 44: Example 11, Bitwise Operation

    First execution will be 123712, if execute next time, VAR1 will be back to 12345. In another word, XORB can toggle the bit. 6.4.12 Example 12, Angle Calculation From 3.02.16c firmware, angle calculation is supported. In PLC program, users can: SIND 91 VAR1 COSD 185 VAR2 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 45: Example 13, Non-Blocking Delay

    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.
  • Page 46 /*************************************************** put your logic here if MAC address not match then do what You can simply return with an error message ****************************************************/ /**************************************************** Now, you can process the data string send in by WebControl ****************************************************/ Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 47 WebControl PLC User Guide Version 3.02.17f printf("to push up to 10 bytes to WebControl SET_WC=-2147483647\n"); printf("close connection\n"); fclose(fp); return 0; Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 48: Webcontrol Plc Faq

    2-1A: WebControl™ can simultaneously connect 8 optional DS18B20/DS1822/DS18S20 based digital temperature sensors. In the past we require 12bit temperature sensor. Now, we lose the requirement to 12bit and 9 bit Maxim-IC temp sensors. We still do not support parasite part. Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 49: Turn On/Off Ttl Output From Another Programming Language

    VAR value from outside, varid from 1 to 8: http://192.168.1.15/api/setvar.cgi?varid=1&value=23456789 from 3.02.17 firmware, WebControl supports manually set a UROM value from outside, uromid from 1 to 4: http://192.168.1.15/api/seturom.cgi?uromid=1&value=23456789 Copyright(c) 2008,-2013 CAI Networks, Inc.
  • Page 50: External Analog Chip Ds2450

    Any noise in the power supply could cause problem during execution of WebControl PLC logic. If a relay board is also used with WebControl, please make sure the power supply has enough reverse current to handle the spike during relay switching.

Table of Contents