Contenido
El lenguaje de programacin
Edicin: 01/2004
Autor: Edward Gasper
Traduccin: Cristbal Jimnez, Festo Mxico
Contenido
Contenido ........................................................................................ 3
Primeros pasos
1 Primeros pasos 7
1.1 Iniciando el software Win FST .............................................. 9
1.2 Creacin de un nuevo proyecto............................................ 9
1.3 Creacin de un programa .....................................................11
1.4 Configuracin de las Entradas/Salidas ................................12
1.5 Declaracin de las variables.................................................14
1.6 Escritura de un programa.....................................................16
1.7 Verificacin de un programa ................................................17
1.8 Compilacin y construccin de un programa........................18
1.9 Configuracin del Controlador .............................................20
1.10 Transferencia del Programa al PLC .......................................22
1.11 Monitoreo en lnea...............................................................22
1.12 Respaldo y restauracin de proyectos .................................24
1.12.1 Respaldo .................................................................24
1.12.2 Restauracin ...........................................................25
1.13 Salida del programa.............................................................26
Utilizacin de temporizadores
Utilizacin de contadores
6 Utilizacin de contadores............................................ 57
6.1 Introduccin.........................................................................57
6.2 Utilizacin de la funcin de conteo.......................................57
6.3 Aplicacin del contador en nuestro proyecto .......................58
Multitarea
7 Multitarea.................................................................... 63
7.1 Introduccin.........................................................................63
7.2 Trminos asociados con la Multitarea ..................................63
7.2.1 CFM Llamada a mdulo de funcin........................64
7.2.2 CMP Llamada a mdulo de programa ....................64
7.2.3 Llamado de un mdulo ............................................65
7.2.4 Llamado de programas ............................................66
7.3 Utilizacin de banderas........................................................66
7.4 Utilizacin del mdulo de seal intermitente (Blink) ............66
7.5 Tarea de control inicial .........................................................69
7.5.1 Lista de asignaciones...............................................69
7.6 Estructura de los proyectos y de los programas ...................70
7.6.1 Arbol del proyecto ...................................................70
7.6.2 Programa de organizacin principal.........................70
7.6.3 Programa de secuencia............................................71
Win FST Festo Didactic
5
Contenido
Redes de Comunicacin
8 Redes de Comunicacin............................................... 81
8.1 Introduccin.........................................................................83
8.2 Verificacin de la direccin de su PC ....................................83
8.3 Localizacin de una direccin IP libre para sus PLCs...........84
8.4 Modificacin de la direccin IP de sus PLCs ........................84
8.4.1 Configuracin de E/S ...............................................87
8.4.2 Configuracin del Controlador .................................88
8.4.3 Carga del proyecto y de los Drivers al PLC ...............89
8.5 Conexin de par de cables trenzados...................................90
8.6 Verificacin de la Comunicacin...........................................90
8.7 Comunicacin con el Controlador.........................................91
Utilizacin de Ethernet
Captulo1
Primeros Pasos
Win FST
Este manual est elaborado para quienes inician la programacin con el
software Win FST. Este manual contiene algunos ejemplos.
1 Primeros pasos
Hacer proyecto
Construir proyecto
De un Clic en OK
A continuacin abra la ventana Preferences del men [Extra] ,
[Preferences]
Elija la pestaa Communications Port
Elija el puerto COM y ajuste la velocidad de comunicacin Baudrate a
9600 bauds.
De un Click en OK
Win FST Festo Didactic
23
Primeros Pasos
Monitoreo en lnea
Note que puede forzar las salidas dando un clic a los bits respectivos .
Sin embargo, sea cuidadoso cuando force dichas variables, asegrese de
no ocasionar que su equipo afecte a otro equipo.
Tambin recuerde desactivar todas las salidas una vez que haya
terminado.
De un Clic Project
De un Clic en Backup
De un Clic en Project
De un Clic en Restore
De un Clic en OK
Una vez que ha sido recuperado, aparecer la ventana Message
Window.
Captulo 2
2.1 Introduccin
El lenguaje STL (Statement List) le permite al programador resolver tareas de
control utilizando instrucciones simples en ingls para describir la operacin
deseada del controlador.
Step (Paso)
Frase - Parte condicional
- Parte ejecutiva
2.2.2 Frases
a. Parte condicional
o IF I0.1
o IF I0.2 AND I0.3
b. Parte Ejecutiva
STEP Stop
IF I0.1
THEN RESET O0.0
STEP Start
STEP Stop
IF I0.1
THEN RESET O0.0
RESET O0.1
RESET O0.2
STEP Stop
IF I0.1
THEN RESET O0.0
Captulo 3
3.1 Introduccin
Los siguientes commandos son algunos de los ms utilizados en el lenguaje
de Lista de Instrucciones.
Instruccin Descripcin
Instruccin Descripcin
Captulo 4
4.1 Introduccin
En este manual comenzaremos con el proyecto del dispositivo de elevacin y
lo iremos construyendo. Para este dispositivo, el Cilindro 1A elevar la
plataforma y entonces el cilindro 2A empujar al paquete hacia la segunda
banda transportadora. Entonces el cilindro 2A retraer su vstago y acto
seguido se retraer el vstago del cilindro 1A.
Inseertar el programa
Note que puede escribir todo en una sola lnea y automticamente tomar el
formato, como se muestra a continuacin.
STEP 10
IF SB Botn de marcha
AND B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para cilindro 1A
STEP 20
IF B2 Cilindro 1A extendido
THEN SET Y2 Solenoide para cilindro 2A
STEP 30
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para cilindro 2A
STEP 40
IF B3 Cilindro 2A retrado
THEN RESET Y1 Solenoide para cilindro 1A
JMP TO 10
De un clic OK
Monitoreo en lnea
Captulo 5
Utilizacin de temporizadores
5 Utilizacin de temporizadores
5.1 Introduccin
Hasta ahora, hemos escrito el programa utilizando solamente entradas y
salidas del FEC. Ahora utilizaremos los temporizadores que estn
incorporados en el PLC. Modificaremos el proyecto Dispositivo de
elevacin para aadir un temporizador.
De un clic en Help
Despus de un clic en Help Topics
De un clic en el tabulador Index y digite Timers
El tema referente a los temporizadores aparecer en la ventana derecha.
Encontrar toda la informacin necesaria acerca de los temporizadores.
STEP 10
STEP 20
IF N T1 Timer 1
THEN RESET O0.2 Lamp
JMP TO 10
STEP 10
IF SB Botn de marcha
AND B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
STEP 20
IF B2 Cilindro 1A extendido
THEN SET Y2 Soenoide para el cilindro 2A
STEP 30
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP 40
IF B3 Cilindro 2A retrado
THEN RESET Y1 Solenoide para el cilindro 1A
JMP TO 10
STEP 10
IF SB Botn de marcha
AND B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
STEP 20
IF B2 Cilindro 1A extendido
THEN SET Y2 Solenoide para el cilindro 2A
STEP 30
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP 40
IF B3 Cilindro 2A retrado
THEN SET T1 Timer 1
with 5s
STEP 50
IF N T1 Timer 1
THEN RESET Y1 Solenoide para el cilindro 1A
JMP TO 10
Captulo 6
Utilizacin de contadores
6 Utilizacin de contadores
6.1 Introduccin
STEP 10
IF NOP
THEN LOAD V10
TO CP0
SET C0 Contador 0
RESET Y1 Solenoide 1
STEP 20
IF B1 Sensor 1
THEN INC C0 Contador 0
STEP 30
IF N B1 Sensor 1
THEN NOP
STEP 40
IF N C0 Contador 0
THEN JMP TO 50
OTHRW JMP TO 20
STEP 50
STEP 10
IF NOP
THEN LOAD V0
TO CW0
RESET Y1 Solenoide 1
STEP 20
IF B1 Sensor 1
THEN INC CW0 Contador 0
STEP 30
IF CW0 Contador 0
= V10
THEN JMP TO 40
OTHRW JMP TO 20
STEP 40
C0 - Contador 0
CP0 - Preselector del contador 0
CW0 - Valor acumulado de eventos registrados
Mtodo A
STEP 10
IF SB Botn de marcha
AND B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
LOAD V10
TO CPO Valor acumulado de eventos registrados
SET C0 Contador 0
STEP 20
IF B2 Cilindro 1A extendido
THEN SET Y2 Solenoide para el cilindro 2A
STEP 30
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP 40
IF B3 Cilindro 2A retrado
THEN SET T1 Timer 1
with 5s
STEP 50
IF N T1 Timer 1
THEN RESET Y1 Solenoide para el cilindro 1A
INC C0 Contador 0
STEP 60
IF N CO Contador 0
THEN JMP TO 10
OTHRW NOP
STEP 70
IF B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
JMP TO 20
Mtodo B
STEP 10
IF SB Botn de marcha
AND B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
LOAD V0
TO CWO Valor acumulado de eventos registrados
STEP 20
IF B2 Cilindro 1A extendido
THEN SET Y2 Solenoide para el cilindro 2A
STEP 30
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP 40
IF B3 Cilindro 2A retrado
THEN SET T1 Timer 1
with 5s
STEP 50
IF N T1 Timer 1
THEN RESET Y1 Solenoide para el cilindro 1A
INC CW0 Valor acumulado de eventos registrados
STEP 60
STEP 70
IF B1 Cilindro 1A retrado
AND B3 Cilindro 2A retrado
THEN SET Y1 Solenoide para el cilindro 1A
JMP TO 20
Captulo 7
Multitarea
7 Multitarea
7.1 Introduccin
P0 P1 CMP 0 CFM 0
Main
Programa
Principal
Control
Program
P0 is
se
activated
Activa de P2
automatic
Manera
ally when
automtica
power
Al on
aplicar
Energa al CMP 49 CFM 49
control
Program
Programa Mdulo Program
Module de programa Function modules
Mdulos de funcin
((Multi
Multi - Tarea)
Tasking ) ( Subroutine
(Subrutina ) ) (Definidos por
( Predefined byFesto)
Festo )
Festo Didactic Win FST
66
Multitarea
Estos CFM estn disponibles desde el programa, y para tener una mejor
referencia abra el archivo de Ayuda para obtener informacin del mtodo de
llamada del CFM.
Para llamar a los mdulos, solo aada al paso las instrucciones THEN CFM
x o THEN CMP x donde x es el nmero del mdulo.
STEP Blink
STEP Initial
STEP Start
STEP Initial
STEP Start
Por ejemplo:
Elija Blink
Entonces se insertar dicho mdulo en el CFM.
STEP Blink
STEP Initial
STEP Start
En los programas anteriores, el ciclo comienza solo cada vez que se pulsa el
botn. Este no es el caso en la mayora de las mquinas, en las cuales
existen botones para ciclo nico y para ciclo continuo, para restablecimiento
del programa y botn para paro de emergencia.
STEP Stop
IF N P1 Programa de la secuencia
THEN RESET FCStop Paro de ciclo
STEP Aplus
IF B1 Cilindro 1A retrado
THEN SET Y1 Solenoide para el cilindro 1A
STEP BPlus
IF B2 Cilindro 1A extendido
THEN SET Y2 Soenoide para el cilindro 2A
STEP BMinus
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP AMinus
IF B3 Cilindro 2A retrado
THEN RESET Y1 Solenoide para el cilindro 1A
STEP Check
STEP End
STEP Initial
STEP Start
STEP Stop
IF N P1 Programa de la secuencia
THEN RESET FCStop Paro de ciclo
RESET oStop Lmpara de paro
JMP TO Start
STEP Emergency
IF NOP
THEN RESET Y1 Solenoide para el cilindro 1A
RESET Y2 Solenoide para el cilindro 2A
RESET P1 Programa de la secuencia
RESET oStart Lmpara de inicio
RESET oStop Lmpara de paro
STEP Reset
IF FBlink3 1s Blinks
THEN SET oReset Lmpara de restablecimiento
OTHRW RESET oReset Lmpara de restablecimiento
STEP Aplus
IF B1 Cilindro 1A retrado
THEN SET Y1 Solenoide para el cilindro 1A
STEP BPlus
IF B2 Cilindro 1A extendido
THEN SET Y2 Solenoide para el cilindro 2A
STEP BMinus
IF B4 Cilindro 2A extendido
THEN RESET Y2 Solenoide para el cilindro 2A
STEP AMinus
IF B3 Cilindro 2A retrado
THEN RESET Y1 Solenoide para el cilindro 1A
STEP Check
STEP End
THEN NOP
STEP Blink
Captulo 8
Redes de Comunicacin
8 Redes de Comunicacin
8.1 Introduccin
El software Win FST nos permite utilizar Ethernet (TCP/IP) para establecer la
comunicacin entre diferentes controladores y la PC. Utilizaremos TCPIP por
las siguientes razones:
De un clic en Start.
De un clic Run
Festo Didactic Win FST
84
Utilizacin de Ethernet
C:\>ipconfig
C:\>
Adems, cuando por primera vez configure los parmetros de la red y los
drivers para su controlador, necesita utilizar la comunicacin serial RS232
Win FST Festo Didactic
85
Utilizacin de Ethernet
De un clic en OK.
La ventana Driver Configuration listar el driver TCP/IP.
Hasta este punto los drivers TCP/IP se han configurado y el proyecto est
listo para cargarse en el controlador. Como se mencion antes, cuando se
cargan los drivers de la red a los controladores por vez primera, necesita
utilizar el cable serial RS232 con el controlador para llevar a cabo dicha
transferencia.
Guarde todos los archivos al dar clic en la opcin Save All de la barra
de herramientas.
Verifique que la opcin RS232 sea el modo actual de comunicacin al
seleccionar la opcin Preferences del men Extras al elegir la opcin
Communication Port.
Asegrese que est seleccionada la opcin Use RS232.
Pulse la tecla [F5] o de un clic en el cono de carga de proyecto.
El software Win FST detectar los cambios en el proyecto y le solicitar
hacer (Make) el proyecto nuevamente.
De un clic en Yes para recompilar el proyecto. Cuando se haya
completado la carga la ventana de estado aparecer de manera similar a
como se muestra a continuacin:
LED Link: TP
C:\>ping 10.10.24.162
C:\>
Ahora est listo para comunicarse con su controlador a travs de la red y por
lo tanto, podr desconectar el cable RS232.
Captulo 9
Utilizacin de Ethernet
9 Utilizacin de Ethernet
9.1 Introduccin
Mdulo Descripcin
EASY_R Solicita un bloque de operandos de otro controlador
EASY_S Enva un bloque de operandos hacia otro controlador
IP_ALIVE Verifica si se conoce una direccin IP
IP_IP Obtiene/Define nuestra direccin IP
IP_MASK Obtiene/Define nuestra mscara de red IP
IP_TABLE Obtiene/Define la direccin IP desde/hacia una tabla
Este mdulo se utiliza para asignar u obtener una direccin desde o hacia
una tabla.
Parmetros de entrada
Parmetros de salida
Parmetro Descripcin
0 - Si fue exitoso
FU32
De otra manera hubo error
FU33 Nmero de ndice en la tabla IP
FU34 Direccin IP
FU35 Direccin IP
FU36 Direccin IP
FU37 Direccin IP
Parmetros de entrada
Parmetros de salida
Parmetro Descripcin
0 - Si solicita lectura
FU32 De otra manera hubo un
error
Parmetros de entrada
Parmetros de salida
Parmetro Descripcin
0 - Si enva requisicin
FU32
De otra manera hubo error
Una vez recibido el dato, los controladores lo utilizarn al igual que cualquier
seal de entrada.
9.3.1 Ejercicio
Estacin A
Absoluto Simblico Comentario
I0.0 iStart Start Button
I0.1 B1 Lifting Cylinder Back
I0.2 B2 Lifting Cylinder Forward
I0.3 B3 Pushing Cylinder Back
I0.4 B4 Pushing Cylinder Forward
I0.5 S1 Inductive Sensor
I0.6 S2 Optical Sensor
I0.7 AutoMan Auto/Manual Switch
I1.0 iStop Stop Button
I1.1 iReset Reset Button
I1.2 iEStop Emergency Stop Button
O0.0 Y1 Solenoid for Lifting Cylinder
O0.1 Y2 Solenoid for Pushing Cylinder
O0.2 oStart Start Lamp
O0.3 oStop Stop Lamp
O0.4 oReset Reset Lamp
F1.0 FCStop Cycle Stop Flag
F10.1 FBlink1 0.25s Blink
F10.2 FBlink2 0.5s Blink
F10.3 FBlink3 1s Blink
STEP IP_TABLE
STEP IPTable
STEP Initial
STEP Start
STEP Stop1
STEP Stop2
IF N P1 Sequence Program
THEN RESET FCStop Cycle Stop Flag
RESET oStop Stop Lamp
JMP TO Start
STEP Emergency
IF NOP
THEN RESET Y1 Solenoid for Lifting Cylinder
RESET Y2 Solenoid for Pushing Cylinder
RESET oStart Start Lamp
RESET oStop Stop Lamp
IF FBlink3 1s Blinks
THEN SET oReset Reset Lamp
OTHRW RESET oReset Reset Lamp
STEP Sort
IF S1 Inductive Sensor
AND S2 Optical Sensor
THEN SET Metal Metal Workpiece
RESET Red Red Workpiece
JMP TO Up
IF N S1 Inductive Sensor
AND S2 Optical Sensor
THEN SET Red Red Workpiece
RESET Metal Metal Workpiece
STEP Up
STEP ReadyPush1
STEP ReadyPush2
IF FU32
= V0
THEN NOP
STEP Push
STEP Retract
STEP SendData
IF FU32
= V0
THEN NOP
STEP Down
STEP Check
STEP End
THEN NOP
STEP Blink
Tendremos 3 programas:
o El programa principal de organizacin
o El programa de secuencia
o El programa de generacin de seal intermitente
En los programas tanto principal como de secuencia, tendremos que
encender una bandera siempre y cuando la estacin est lista para
recibir la pieza de trabajo proveniente de la estacin A.
Una vez que la estacin B recibe la pieza de trabajo y el dato referente al
tipo de pieza, llevar a cabo la secuencia correspondiente.
Como la estacin B solo utiliza los datos enviados por la estacin A, no
necesitamos utilizar mdulos TCP/IP
STEP Initial
STEP Start
STEP Stop1
STEP Stop2
IF N P1 Sequence Program
THEN RESET FCStop Cycle Stop Flag
RESET oStop Stop Lamp
JMP TO Start
STEP Emergency
IF NOP
THEN RESET Y1 Solenoid for Lifting Cylinder
RESET Y2 Solenoid for Pushing Cylinder
RESET P1 Sequence Program
RESET oStart Start Lamp
RESET oStop Stop Lamp
IF FBlink3 1s Blinks
THEN SET oReset Reset Lamp
OTHRW RESET oReset Reset Lamp
STEP Initial
IF S1 Workpiece Present
THEN RESET ReadyFlag Station Ready
OTHRW SET ReadyFlag Station Ready
IF S1 Workpiece Present
AND B1 Lifting Cylinder Back
AND FReceived Workpiece Received
THEN SET Y1 Solenoid for Lifting Cylinder
RESET Ready Flag Station Ready
RESET FReceived Workpiece Received
STEP Push
STEP Down
STEP Check
STEP End
THEN NOP
STEP Blink
Captulo 10
Hasta este punto los drivers TCP/IP y servidor web se han configurado y el
proyecto est listo para cargarse al controlador. Como se mencion antes,
cuando se cargan por primera vez los drivers al controlador necesita utilizar
la comunicacin serial RS232 para llevar a cabo la transferencia de los
drivers. Una vez realizado esto, ya se puede tener acceso a travs de la red.
Aqu solo se abordarn los commandos ms utilizados HTML (tags) con el fin
de facilitar el desarrollo de pginas Web sencillas para comunicarnos con el
controlador a travs de internet. Para mayor informacin acerca de HTML es
conveniente consultar un libro dedicado al estudio de dicho tema.
Cabecera y
Cuerpo
<HTML>
<HEAD>
<TITLE>
Pgina Web del Controlador Festo FC34
</TITLE>
</HEAD>
<BODY>
Controlador Festo FC34
</BODY>
</HTML>
Note que todo el contenido del documento se encuentra encerrado entre los
comandos <HTML> y </HTML> lo cual indica que esta es una pgina Web.
Los espacios en blanco son ignorados por el navegador en cuanto se
presenta la pgina.
Por lo que, la pgina mostrada arriba puede ser tambin como sigue:
<HTML>
<HEAD><TITLE>Pgina Web del Controlador Festo
FC34</TITLE></HEAD>
<BODY>Controlador Festo FC34</BODY></HTML>
Los editores HTML estn diseados para crear documentos HTML utilizando
una interfase grfica de usuario. En otras palabras, puede crear un
documento como si lo hiciera en Microsoft Word al teclear el texto,
seleccionando diferentes tipos de letra e insertando imgenes, etc.
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
</HEAD>
<BODY>
Festo FC34 Controller
</BODY>
</HTML>
Win FST Festo Didactic
123
HMI Development
Note que los comandos pueden digitarse tambin con letras minsculas.
Sin embargo, de manera convencional se teclean en maysculas para
hacer ms fcil la diferencia con el resto del texto del documento.
Esta pgina no luce tan interesante pero nos muestra los conceptos
bsicos de la creacin y vista de una pgina HTML.
Enter the IP number of your FC34 controller followed by the name of the
Web page at the URL address.
For example,
The page will be delivered to your browser over the network by the FC34
Web server.
Please note:
When the Web server delivers the Web page, it first goes through the
document and replaces all the embedded CI tags with the current values of
the registers. Then, it delivers the page to the browser requesting it. This
mechanism allows us to develop web pages that can be used to remotely
monitor the station.
We will modify the main1.htm file that was created in the previous section
of this chapter to use an embedded CI command to view an input register:
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
</HEAD>
<BODY>
Festo FC34 Controller
<BR><BR>
</BODY>
</HTML>
The <BR><BR> tags insert two blank lines in the page after the Festo
FC34 Controller text.
The embedded CI command <FSTCI DEW0> will be replaced by the
current value of the input word zero when the page is requested from the
controller Web server by the browser.
Save the file as main2.htm (with the quotation marks !).
Download it to the FC34 using the File Transfer utility of FST (as
explained in the previous section).
Run the Internet Explorer and enter your FC34 IP number followed by the
main2.htm filename as the URL:
A Web server delivers a Web page to the requesting browser and the browser
renders the page formatting it with the embedded tags. This is a static
mechanism of content delivery.
After the page is delivered to the browser, if the state of the station changes
the change will not be reflected in the Web page currently being viewed
unless the user hits the refresh button of the browser. Even then, it is not
guaranteed that the content will be updated because, by default, the
browser will make a copy of the Web page (cache the page) on the local hard
drive when it is first delivered.
Later, if the refresh button is pressed, it will get the cached copy and display
it instead of requesting the Web server to deliver the document over the
network again. This mechanism was developed to help reduce network
traffic.
Remember that the controller Web server goes through the requested Web
page and replaces the embedded CI commands with the current values of
registers. Therefore, unless we force the browser to request a copy of the
same page from the Web server again, we will not get an updated page
reflecting the current state of the register.
A simple way of requesting the Web server to deliver the page repeatedly is
to use the Refresh HTML meta tag. This tag has the following format and
must be placed in the head section of an HTML document:
This tag tells the browser to request the current file from the Web server
every 3 seconds.
Open the main2.htm file and place the above meta tag into the head
section of the HTML document
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
<META http-equiv=refresh content=3>
</HEAD>
<BODY>
Festo FC34 Controller
<BR><BR>
</BODY>
</HTML>
Save the file and download it to the FC34 using the File Transfer utility
of FST.
Run the Internet Explorer and enter your FC34 IP number followed by the
main2.htm filename as the URL.
You should see the Web page being refreshed every 3 seconds and
therefore, the input word being updated.
However, sometimes it is hard to correlate the input word to the current
state of the station since the station may change its state faster than the
Web page can be updated.
In this section you will learn how to design an advanced Web page with
embedded graphics for FC34. The page will display the status of all FC34
input and output registers.
The advanced Web page you will design in this section will have the
following layout. We will be designing a web page based on our earlier
project of the Lifting Device.
The design will have a title and a table that displays all input and output
registers of the Lifting Device. Using such a page it is possible to monitor the
station remotely over a network such as the Internet.
<HTML>
<HEAD>
<TITLE> Lifting Device Remote Monitor </TITLE>
<META http-equiv="Content-Type"content="text/html;charset=iso-8859-1">
<META http-equiv="refresh"content="3">
</HEAD>
<BODY bgcolor="#CCCCCC">
<DIV align="center">
<H2><FONT color="#0000CC">Lifting Device Remote Monitor</FONT></H2>
<HR width="80%" align="center">
<BR>
</FONT></PRE>
</TD>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>
Start the Notepad editor by clicking the START button of Windows and
by selecting Programs, Accessories, Notepad.
Type the HTML code for the page exactly as shown in the listing.
Save the file as main3.htm (do not forget to use the quotes when
saving).
Start the FST software and select File Transfer from the Online menu.
This will start the file transfer utility to send the files to the FC34.
Make sure that the virtual drive B is selected. This is where the Web
server looks for files.
Click on the download button (with the downward blue arrow) and
navigate to the main3.htm file on your hard drive.
Click OK to download to the FC34.
Press the START button of the Lifting Device and observe the changing
states of its inputs and outputs on the Web page.
Chapter 11
HMI Development
11 HMI Development
11.1 HTML Forms
HTML is the standard language used to design Web pages. Earlier Web pages
displayed static information that was coded into the page by its designer
using HTML tags. However, as the technology advanced, Web pages started
to have dynamic content that changed based on the browser used,
interactions of the user with various features of the page, etc.
One design element used in making a Web page dynamic is a FORM. Forms
allow users to enter information into a Web page. Forms can contain various
other types of elements such as buttons, drop-down lists, areas to enter text,
etc. that are all associated with receiving information from the user.
A Web page with a form and associated elements to collect input data
from the user; and
A program that can receive the collected data and process it.
A typical Web page with a form can process the user input data by either
sending it to a program running on a server (typically called a CGI program)
or can process the data on the client machine that the user is using with the
help of a scripting language such as JavaScript or VBScript.
Some form elements have a set of events that they can generate. For
example, the button element has an onClick event that it generates when
the user clicks on it. The Web page can react to the user clicking the button
through a so called event handler. An event handler is a script (program)
that is run when the button is clicked.
In this chapter we will look at some of these elements. For more detailed
coverage, please refer to a book on HTML or JavaScript.
The <INPUT> tag specifies that this is an input field. The tag has various
attributes:
Attribute Definition
Checkbox is designed for the user to check it. When the checkbox is checked,
its value is set to 1. This value can later be examined by a script to
determine whether the checkbox was checked or not.
Attribute Definition
For the textbox, the user can enter details. The text entered by the user, can
later be examined by a script.
Attribute Definition
Assigns a name to the text box object. Later this name can be
Name
used in a script (program) to refer to the text box object
Determines the width of the text box. It also limits the
Maxlength maximum number of characters that can be typed into the
text box by the user.
a. CISend
CISend(AW0, 0)
The function then takes these arguments and first checks the value that
was passed to it to make sure that it is acceptable. Then, it forms a query
string to the controller Web server to deliver the CI command to the station.
b. CISend2
Both functions are saved in a single file so that each function can be added
to any HTML document by simply referring to this file from the HTML
document (as shown in the next section).
For this book, the functions are saved into Fst.js file. Note that this file
must be in the same directory as the Web page that is referring to it.
Here we will create a javascript file called Fst.js. This file will be placed into
the same web page directory. The CISend and CISend2 scripts will be placed
in this file.
Create the file in the same way as you created the html file, using Notepad.
You need to download this file to the controller if you intend to use the
CISend and CISend2 functions in your HTML file.
// CISend sends a modify command to the web server
// Parameters:
// Operand: for example MW0
// Value
function CISend(Operand,Value) {
var found;
var href;
if ( Value == "NaN" ) {
alert("Value is not a number");
return;
}
// Verify variable value
if ( (Value < -65535) || (Value > 65535) ) {
alert("Allowed range for value is -65535 to 65535");
return;
}
if ( Value1 == "NaN" ) {
alert("Value1 is not a number");
return;
}
// Verify variable value1
if ( (Value1 < -65535) || (Value1 > 65535) ) {
alert("Allowed range for value1 is -65535 to 65535");
return;
}
if ( Value2 == "NaN" ) {
alert("Value2 is not a number");
return;
} Didactic Win FST
Festo
140
HMI Development
if ( Value == "NaN" ) {
alert("Value is not a number");
return;
}
// Verify variable value
if ( (Value < -65535) || (Value > 65535) ) {
alert("Allowed range for value is -65535 to 65535");
return;
}
To control the functions we will use the function CISend( ). The web page
should look like this. After writing the script, remember to download the file
and the fst.js file to the controller.
We have to create six buttons; four for the cylinder activation and two for the
start and stop function.
<td bgcolor="#e0e0e0">
<form>
<DIV align="center">
<input type="button" value="Cylinder 1A Forward" onclick="CISend('A0.0', '1')">
<input type="button" value=" Cylinder 1A Return " onclick="CISend('A0.0', '0')">
</DIV>
</form>
</td>
<td bgcolor="#e0e0e0">
<form>
<DIV align="center">
<input type="button" value="Cylinder 2A Forward" onclick="CISend('A0.1', '1')">
<input type="button" value=" Cylinder 2A Return " onclick="CISend('A0.1', '0')">
</DIV>
</form>
</td>
For the start and stop buttons it is different, we need to use flags to activate
the inputs. It is not possible to activate the inputs directly as the signal might
not be going in at the right time as the page refreshes. It is usual to set a flag
and use this flag to start and stop your program.
<td bgcolor="#e0e0e0">
<form>
<DIV align="center">
<input type="button" value=" Start Button " onclick="CISend('MW30', '1')">
<input type="button" value=" Stop Button " onclick="CISend('MW30', '2')">
</DIV>
</form>
</td>
We also need to modify our Win FST program to include the two flags. The
modification is made in the Main Organisation Program. This means that
the process can be started by pressing the actual buttons or the buttons on
the web page.
STEP Initial
STEP Start
STEP Stop
IF N P1 Sequence Program
THEN RESET FCStop Cycle Stop
RESET oStop Stop Lamp
JMP TO Start
<td bgcolor="#e0e0e0">
<form>
<DIV align="center">
<input type="button" value="Cylinder 2A Forward" onclick = "CISend('A0.1', '1')">
<input type="button" value=" Cylinder 2A Return " onclick= "CISend('A0.1', '0')">
</DIV>
</form>
</td>
<td bgcolor="#e0e0e0">
<form>
<DIV align="center">
<input type="button" value=" Start Button " onclick= "CISend('MW30', '1')">
<input type="button" value=" Stop Button " onclick= "CISend('MW30', '2')">
</DIV>
</form>
</td>
</tr>
</table>
<br>
<table width="70%" border="1"align="center">
<tr>
<td width="35% bgcolor="#CCCC99"valign="middle">
<H3 align="center"><font color="336633">Inputs</font></H3>
</td>
Save the file and download it to the controller. When downloading the file to
the controller remember to also download the Fst.js file.
Chapter 12
Double-Click on IO Configuration
Right-Click in the Screen
Click Insert IO Module
Set IO Configuration Choose PLC
Identify OW and IW, usually 0
Click OK
Close Window
Double-Click on IO Configuration
Right-Click and Click Insert
Declare Variables Operand or Press Insert Key
Type in Absolute. Symbolic
Operands and Comment
Absolute Operand is Compulsory
Double-Click on Controller
Settings in Project Tree Window
Set Controller Settings Tick Autostart box
Click Download Tab
Tick Download Source File
Click OK
Click on Project
Click on Backup
Backup Project Choose Project
Choose Location
Click Save
Click on Project
Click on Restore
Restore Project Choose File
Click Open
Click OK
Click on Project
Quit Click Exit
If Project has Not been Saved, You
Will be Prompted