With the use of jQuery, Phonegap and my jQuery plugin I have build a simple app for devices running Android. After entering a few basic configuration data you should be able to change values of PLC variables and read states of inputs and outputs. My goal was to show how simple it might be to control a PLC with a small program build with open-source technology.
After the first installation you will be asked to enter basic configuration data:
Before you start testing please check if your device is connected to the same network as your PLC controller.
'Tap Buttons' can be used to control lights. In the field 'Name' enter the name you want to see on the button. In 'Read' enter the address of the output controlling the given light circuit ('QX0.0'). In the filed 'Write' enter the address of the variable, used to control a given function block ('MB0').
in the PLC program, in variable definition (for example):
VAR VARIABLE1 AT %MB0 : BOOL; LIGHT1 : Fb_LatchingRelay; (*z biblioteki Building_common.lib*) END_VAR
Where ‘MB0’ is the address used for communication with VARIABLE1.
In the PLC_PRG program enter one function block controlling the lights:
LIGHT1(xSwitch:= IN1 OR VARIABLE1); OUT1:=LIGHT1.xActuator;
Where IN1 is a digital input (for example, a button), OUT1 is a digital output controlling the circuit. Configure the address of OUT1 as QX0.0 (in Resources/PLC Configuration).
The button 'Read Temp' can be used for reading temperatures from analog inputs. The 'Write' field is inactive. The 'Read' field should receive the address of the analog input ('IW0').
The button 'Read Value' can be used for reading statuses of a given input or output, or a value of an variable. The 'Write' field is inactive. The 'Read' field should receive the address of the input/output/variable ("QX0.0", "IW0", "MB0").
After you finish the configuration ('SAVE' button) the app will read all 'Read' addresses every 5 seconds. The statuses/values of the fields will be updated accordingly. In case of the 'Tab Button', its color will be changed (yellow for QX0.0=1, black for QX0.0=0). In case of the 'Read Temp' field, the received value will be divided by 10 and the units will be added at the end. In case of the 'Read Value' field, the received value will be updated as is without modification.
If you have any questions, comments or suggestions, post it on the forum.