BRESIMAR(asaTek)-Beckhoff-Livro Formação Técnica TwinCAT 2
BECKHOFF - TwinCAT 2 Livro de Formação Técnica v1.2/2009 BRESIMAR AUTOMAÇÃO / asaTek Autoria : Jorge Andril
BECKHOFF - TwinCAT 2
Livro de Formação Técnica v1.2/2009
BRESIMAR AUTOMAÇÃO / asaTek
Autoria : Jorge Andril
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
2009-01-12 mpro_twcplc.pdf (v1.2)<br />
<strong>Beckhoff</strong> <strong>TwinCAT</strong><br />
The Windows Control and Automation Technology<br />
Introdução ás instruções “standard”<br />
do “<strong>TwinCAT</strong> PLC”
ÍNDICE<br />
I – TIPO DE DADOS E VARIÁVEIS<br />
I.1 – Identificadores (“Identifiers”)<br />
I.2 – Prefixos (“Prefix”)<br />
I.3 – Tipo de dados (“Data type”)<br />
I.4 – Operandos (“Operands”)<br />
I.5 – Variáveis e endereços<br />
I.6 – Variáveis utilizadas no <strong>TwinCAT</strong> HMI (“Text”)<br />
II – LISTA DE INSTRUÇÕES “STANDARD”<br />
II.1 – Instruções numéricas<br />
II.2 – Instruções aritméticas<br />
II.3 – Instruções lógicas<br />
II.4 – Instruções de deslocação de bit<br />
II.5 – Instruções de selecção<br />
II.6 – Instruções de comparação<br />
II.7 – Instruções de conversão<br />
II.8 – Instruções várias<br />
III – FUNÇÕES BLOCO “STANDARD”<br />
III.1 – Funções bloco “Standard” - Biestavel<br />
III.2 – Funções bloco “Standard” – “Trigger”<br />
III.3 – Funções bloco “Standard” - Temporizadores<br />
III.4 – Funções bloco “Standard” – Contadores<br />
IV – FUNÇÕES “STANDARD”<br />
IV.1 – Funções “Standard” – “String”<br />
V – EXEMPLOS PRÁTICOS<br />
V.1 – Arranque directo de motor trifásico<br />
V.2 – Inversão de rotação de motor trifásico<br />
V.3 – Arranque estrela-triangulo de motor trifásico<br />
A – RESUMO DE INSTRUÇÕES E FUNÇÕES “STANDARD”<br />
A.1 – Resumo de instruções do “<strong>TwinCAT</strong> PLC”<br />
A.2 – Resumo das funções bloco “standard”<br />
A.3 – Resumo das funções “standard”<br />
B – LISTA DE ERROS DE COMPILAÇÃO DE PROGRAMA<br />
B.1 – Erros de compilação
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
I – TIPO DE DADOS E VARIAVEIS<br />
1 – IDENTIFICADORES (“Identifiers”)<br />
2– PREFIXOS (“Prefix”)<br />
3 – TIPO DE DADOS (“Data type”)<br />
4 – OPERANDOS (“Operands”)<br />
5 – VARIAVEIS E ENDEREÇOS<br />
<strong>BRESIMAR</strong> Cap. I – 1 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. I – 2 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
1 – IDENTIFICADORES (“Identifiers”)<br />
Cada identificador de variáveis , funções , etc é assinalado com um tipo de dados que dita o<br />
espaço de memoria que será reservado na CPU .<br />
Um identificador é um nome que designa uma variável , função ou outro tipo de dados e que<br />
deverá cumprir os seguintes requisitos :<br />
<br />
<br />
<br />
Começar por uma letra ou “underscore”<br />
Seguido por números , letras e “underscore”<br />
Não existe diferenças entre letras maiúsculas e minúsculas<br />
e não serão permitidos os seguintes caracteres<br />
<br />
<br />
<br />
Caracteres especiais (!,“ ,*,&,$,#, etc)<br />
Caracteres em branco<br />
“Underscore” seguidos<br />
2– PREFIXOS (“Prefix”)<br />
Para uma melhor identificação do tipo de identificador é de boa prática colocar um<br />
prefixo no inicio de cada nome , para uma melhor organização e clarificação do programa , tal<br />
como é usado nas linguagens de alto nível ( Visual Basic ,etc. ) . Todavia não é obrigatório para<br />
o bom funcionamento do programa .<br />
As primeiras letras deverão ser o prefixo ( letras minúscula ) do identificador<br />
seguido do nome da variável que deverá começar por uma letra maiúsculas .<br />
Aqui vão as nossas sugestões para alguns tipos de dados :<br />
PREFIXO TIPO de DADOS EXEMPLO<br />
b BOOL bNomevariavelbool<br />
by BYTE byNomevariavelbyte<br />
w WORD wNomevariavelbool<br />
dw DWORD dwNomevariavelbool<br />
si SINT syNomevariavelsinteiro<br />
i INTEGER byNomevariavelinteiro<br />
di DINT dyNomevariaveldinteiro<br />
r REAL wNomevariavelreal<br />
s STRING dwNomevariavelstring<br />
t TIME tNomevariaveltempo<br />
tod TIME_OF_DAY todNomevariaveltempodia<br />
dt DATE_AND_TIME dtNomevariaveldatatempo<br />
d DATE dNomevariaveldata<br />
pt POINTER ptNomevariavelponteiro<br />
str STRUCT strNomevariavelestrutura<br />
<strong>BRESIMAR</strong> Cap. I – 3 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
3 – TIPO DE DADOS (“Data type”)<br />
BECKHOFF New Automation Technology<br />
Conforme o que foi dito inicialmente todos os identificadores sejam variáveis ou não terão<br />
de ser assinalados com um tipo de dados que definirá o tamanho de memoria a ser reservado na<br />
CPU .<br />
Podemos dividir em dois grupos os tipos de dados :<br />
Tipo de dados ELEMENTARES .<br />
<br />
Tipo de dados COMPLEXOS ou ESTRUTURADOS em que<br />
o formato dos dados é definido pelo programador .<br />
3.1 - DADOS ELEMENTARES<br />
Tipo Tamanho Limites<br />
BOOL 1 bit TRUE .. FALSE<br />
BYTE 8 bit 16#00 .. FF<br />
WORD 16 bit 16#0000 .. FFFF<br />
DWORD 32 bit 16#0000_0000 .. FFFF_FFFF<br />
USINT 8 bit 0 .. 255<br />
UINT 16 bit 0 .. 65 535<br />
UDINT 32 bit 0 .. 4 294 967 295<br />
SINT 8 bit -128 .. 127<br />
INT 16 bit -32 768 .. 32 767<br />
DINT 32 bit -2 147 483 648 .. 2 147 483 647<br />
REAL<br />
32 bit<br />
LREAL 64 bit<br />
DATE 32 bit D#1970-01-01 .. 2106-02-06<br />
TOD 32 bit TOD# 00:00:00 .. 1193:02:47.295<br />
DT 32 bit DT#1970-01-01-00:00 .. 2106-02-06-06:28:15<br />
Configuração da representação do tipo de dados<br />
AT : = ;<br />
<strong>BRESIMAR</strong> Cap. I – 4 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
3.2 - DADOS COMPLEXOS ou ESTRUTURADOS<br />
Tipo<br />
ARRAY<br />
POINTER<br />
Configuração<br />
:ARRAY<br />
[..,..] OF ;<br />
: POINTER TO ;<br />
SUBRANGE TYPE :<br />
(..);<br />
END_TYPE;<br />
ALIAS<br />
ENUM<br />
STRUCT<br />
TYPE :<br />
;<br />
END_TYPE<br />
TYPE :<br />
( ,, ..,);<br />
END_TYPE<br />
TYPE :<br />
STRUCT<br />
;<br />
.<br />
;<br />
END_STRUCT<br />
END_TYPE<br />
<strong>BRESIMAR</strong> Cap. I – 5 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
4 – OPERANDOS (“Operands”)<br />
Neste paragrafo iremos apresentar num pequeno resumo , as diversas maneiras de representar dentro<br />
do programa , constantes para cada um dos tipos (“Types”) de dados existentes no <strong>TwinCAT</strong> PLC .<br />
4.1 - Constantes em BOOL<br />
As constantes em BOOL são representadas por FALSE e TRUE .<br />
4.2 - Constantes em BYTE , WORD , DWORD , INT , REAL etc<br />
As constantes em BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,<br />
REAL, poderão ser representadas em binário , octal , decimal ou hexadecimal . Na representação<br />
de um numero real a parte decimal é separada da parte inteira por um ponto (formato americano) e<br />
não uma virgula. As constantes terão a seguinte configurações :<br />
Exemplos em ST :<br />
(* Representação em decimal inteiro e real *)<br />
byConstante:= -255<br />
iConstante:=-INT#3565 (*nº inteiro negativo)<br />
diConstante:=DINT#199978<br />
rConstante:=-REAL#123.89 (*nº real negativo)<br />
rConstante:= 1895.567<br />
rConstantee:= 1.5e+010<br />
(* Representação em binario *)<br />
byConstante1:= 2# 1001_1111<br />
wConstante1:= 2# 1001_1111_0000_10101<br />
(* Representação em octal *)<br />
byConstante2:= 8# 77<br />
(* Representação em hexadecimal *)<br />
byConstante3:= 16# FF<br />
wConstante2:= 16# FF_FF<br />
dwConstante1:= 16# FF_FF_FF_FF<br />
4.3 - Constantes em TIME<br />
No <strong>TwinCAT</strong> podemos declarar constantes temporais. Geralmente são usadas na definição<br />
do tempo nos temporizadores (Função bloco standard TON , TOF , TP) . A constante terá a seguinte<br />
configuração :<br />
# diad horah minutosm segundoss milisegms<br />
Exemplos em ST :<br />
(* Valores correctos *)<br />
tTempo1:= T#14ms<br />
tTempo2:= TIME#100s12ms<br />
tTempo3:= t#23d12h45m3s<br />
(* Valores incorrectos *)<br />
tTempo4:= TIME#100m69s (*Limite excedido em seg.*)<br />
tTempo5:= T#100ms12d (*Ordem incorrecta*)<br />
4.4 - Constantes em DATE<br />
Geralmente são usadas na definição de datas . A constante terá a seguinte configuração :<br />
Exemplos em ST :<br />
(* Valores correctos *)<br />
dData1:= d#2005-12-01<br />
dData2:= DATE#2000-06-02<br />
# ano-mes-dia<br />
<strong>BRESIMAR</strong> Cap. I – 6 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
4.5 - Constantes em TIME OF DAY<br />
Geralmente são usadas na definição do tempo (hora) do dia . A constante terá a seguinte<br />
configuração :<br />
# hora:minuto:segundo<br />
Exemplos em ST :<br />
(* Valores correctos *)<br />
todTod1:= tod#15:12:10.250 (* Podemos ter fracção de seg.*)<br />
todTod2:= TIME_OF_DAY#23:59:59<br />
4.6 - Constantes em DATE AND TIME<br />
Geralmente são usadas na definição da data/hora . A constante terá a seguinte configuração:<br />
#ano-mes-dia-hora:minuto:segundo<br />
Exemplos em ST :<br />
(* Valores correctos *)<br />
dtDT1:= dt#1972-03-29-00:00:00<br />
dtDT2:= DATE_AND_TIME#1999-06-19-23:00:15<br />
4.7 - Constantes em STRING<br />
Um STRING é uma sequência de caracteres . As constantes em STRING são precedidas e<br />
finalizadas com aspas ´. Podemos por espaços e caracteres especiais e serão tratados como qualquer<br />
outro carácter . A combinação do símbolo $ seguido de um numero hexadecimal representa o código<br />
de 8 bits da tabela de caracteres standard . Comandos especiais poderão ser representados por um $<br />
seguido de outro carácter como podemos ver a seguir .<br />
Caracteres comando Descrição<br />
$$ Representar o sinal de dólar ( $ )<br />
$’ Representar o sinal de aspas ( ´ )<br />
$L ou $l “Line feed”<br />
$N ou $n “New Line”<br />
$P ou $p “Page feed”<br />
$R ou $r “Line break”<br />
$T ou $t “Tab”<br />
Exemplos em ST :<br />
(* Valores correctos *)<br />
stTexto1:= ‘<strong>BRESIMAR</strong>(ASA)’<br />
5 – VARIAVEIS E ENDEREÇOS<br />
Neste paragrafo iremos apresentar num pequeno resumo as diversas maneiras de representar dentro do<br />
programa tais como as variáveis e os endereços absolutos na memoria do “hardware” no <strong>TwinCAT</strong> .<br />
5.1 – Variáveis<br />
As variáveis podem ser declaradas tanto localmente , dentro do grupo de declaração dos<br />
POU´s ou na lista das variáveis globais . O identificadores das variáveis não deverão conter espaços em<br />
branco ou caracteres especiais como já anteriormente tínhamos dito .<br />
Letras maiúsculas não serão reconhecidas o que significa que VAR1 , Var1 e var1 são todas<br />
a mesma variável .<br />
O sinal de “underscore” é reconhecido nos identificadores ( por exemplo : A_BCD e AB_CD<br />
são duas variáveis diferentes ) .Um identificador de uma variável pode ter mais que um carácter<br />
“underscore” numa linha .<br />
Podemos identificar uma variável com o máximo de 32 caracteres .<br />
Dentro do editor de programa <strong>TwinCAT</strong> , tempos acesso as variáveis através do “Input<br />
Assistant” – “Local Variables” ou “Global Variables” ( pressionar a tecla função F2) e se desejarmos<br />
declarar novas variáveis utilizamos o “Auto Declare” (pressionar shift+F2).<br />
<strong>BRESIMAR</strong> Cap. I – 7 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
Podemos aceder a variáveis em “ARRAYS” , “STRUCTURES” e POU´s utilizando as<br />
seguintes configurações :<br />
Varáveis em ARRAY ( ex. 2 dimensões)<br />
[index1 , index2]<br />
Variaveis em STRUCT<br />
. <br />
Variáveis em FUNÇÕES BLOCO ou PROGRAMAS<br />
. <br />
5.2 – Endereços<br />
A indicação directa de uma posição individual de memoria ou das entradas ou saídas do<br />
“hardware” utilizado é feito através de uma sequencia de caracteres especiais.. Esta sequencia tem a<br />
seguinte configuração :<br />
%<br />
Prefixos do tipo de endereço<br />
Tipo<br />
Descrição<br />
% I Entrada (“Input”)<br />
% O Saida (“Output”)<br />
% M Memoria (“Memory”)<br />
Prefixos do tamanho de endereço<br />
Tamanho<br />
X<br />
B<br />
W<br />
D<br />
Descrição<br />
bit<br />
Byte (8 bit)<br />
Word (16 bit)<br />
Dupla word (32 bit)<br />
Exemplos :<br />
%QX75.1 (* Bit 1 do byte de saída 75 *)<br />
%IW215 (* Word de entrada 125 *)<br />
%QB7 (* Byte de saida 7 *)<br />
%MD48 (* Dupla Word da posição de memoria 48 *)<br />
Para acedermos a uma dada localização de memoria podemos utilizar qualquer tamanho ( bit ,<br />
byte , Word ou duplo Word ) . Por exemplo o endereço %MD48 são os seguintes endereços no formato<br />
byte :<br />
%MD48 ======= > %MB192<br />
( 48 x 4 ) %MB193<br />
%MB194<br />
%MB195<br />
No mapeamento da memoria o 1º byte tem o endereço 0 (zero) .<br />
<strong>BRESIMAR</strong> Cap. I – 8 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
Podemos no <strong>TwinCAT</strong> dentro de variáveis do tipo SINT, INT, DINT, USINT, UINT,<br />
UDINT, BYTE, WORD, DWORD , se desejarmos , aceder a bit´s individualmente . Para fazermos<br />
isto , o índex do bit a ser endereçado é colocado como um apêndice na variável e separado por um<br />
ponto . O índex base é o 0 ( zero) .<br />
Exemplo :<br />
(* Campo da declaração das variaveis *)<br />
(* Não deve ser assinalada no campo VAR_IN_OUT *)<br />
a: INT;<br />
b:INT;<br />
(* Campo no POU - Main *)<br />
a.2 := b; (* O 3º bit da variável “a” é igual ao valor lógico de “b” *)<br />
Se o índex é maior que o tamanho do tipo da variável escolhido surgirá a seguinte mensagem<br />
de erro :<br />
“ Index outside the valid range for variable “<br />
err :<br />
Se o tipo da variável não permitir este modo de programação surgirá a seguinte mensagem de<br />
“ Invalid data type for direct indexing “<br />
6 – VARIAVEIS UTILIZADAS NO <strong>TwinCAT</strong> HMI (“Text”)<br />
Neste paragrafo iremos apresentar num pequeno resumo dos diversos tipos de dados a apresentar na<br />
propriedade “Text” dos objectos utilizados na HMI pertencente ao “<strong>TwinCAT</strong> PLC” (“Visualizations”).<br />
Estes comandos colocados na janela da propriedade “Text”/”Content” permitirá visualizar o conteúdo de<br />
uma variável colocada na propriedade “Variables”/”Textdisplay” . Deverá ser inicializada por “ % ” e o<br />
tipo de dado a representar (indicada por uma letra minúscula) . Caso se pretenda introduzir uma nova linha<br />
no “Text” utilize a combinação das teclas + e um TAB +<br />
Tipo<br />
Descrição<br />
% i ou d Visualização de nº em decimal com sinal<br />
% o Visualização de nº em octal<br />
% x Visualização de nº em hexadecimal<br />
% d Visualização de nº em decimal sem sinal<br />
% c Visualização de um único carácter<br />
% s Visualização de fila de texto (“string”)<br />
% f Visualização de nº real<br />
%m.df<br />
indica o nº mínimo de dígitos inteiros<br />
indica o nº de dígitos decimais (precisão 6 por defeito)<br />
indica o tipo de dado em real<br />
Exemplo:<br />
/ Nível do tanque: %2.5f<br />
Nível do tanque: 99.1234<br />
% t Visualização do relógio de tempo real do sistema .<br />
A seguir ao comando %t :<br />
% % - Introdução de texto<br />
%a – Nome abreviado do dia da semana<br />
%A – Nome do dia da semana<br />
%b – Nome abreviado do mês<br />
%B – Nome do mês<br />
%c – Representação completa da DATA e HORA .<br />
(// ::)<br />
<strong>BRESIMAR</strong> Cap. I – 9 de 10
TWINCAT PLC – Tipo de Dados e Variaveis<br />
BECKHOFF New Automation Technology<br />
%d – Dia do mês em decimal (00 – 31)<br />
%H –Hora em formato de 24 horas (00 – 24)<br />
%I – Hora em formato de 12 horas (00 – 12)<br />
%J – Dia do ano em decimal (000 – 366)<br />
%m – Mês em decimal (00 – 12)<br />
%M – Minutos em decimal (00 – 59)<br />
%S – Segundos em decimal (00 – 59)<br />
%U –Nº de semana , com começo á 2ª feira (00 – 53)<br />
%w – Dia da semana em decimal (0 – 6)<br />
%U –Nº de semana , com começo ao Domingo (00 – 53)<br />
%x – Representação da DATA .<br />
(//)<br />
%X – Representação da HORA .<br />
(::)<br />
%y – Ano em decimal , sem os milhares (00 – 99)<br />
%Y – Ano em decimal , com os milhares (0000 – 2099)<br />
Exemplo:<br />
/ %t% Dia de Hoje : %d.%m.%y<br />
Dia de Hoje :28.01.08<br />
NOTA : Não coloque qualquer texto antes do comando %t .<br />
<strong>BRESIMAR</strong> Cap. I – 10 de 10
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
II – LISTA DE INSTRUÇÕES<br />
1 - INSTRUÇÕES NUMÉRICAS<br />
2 - INSTRUÇÕES ARITMÉTICAS<br />
3 - INSTRUÇÕES LÓGICAS<br />
4 - INSTRUÇÕES de DESLOCAÇÃO de BIT<br />
5 - INSTRUÇÕES de SELECÇÃO<br />
6 - INSTRUÇÕES de COMPARAÇÃO<br />
7 - INSTRUÇÕES de CONVERSÃO<br />
8 - INSTRUÇÕES VÁRIAS<br />
<strong>BRESIMAR</strong> Cap. II – 1 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. II – 2 de 20
TWINCAT PLC - Lista de Instruções<br />
1 - INSTRUÇÕES NUMÉRICAS<br />
BECKHOFF New Automation Technology<br />
ABS<br />
Calcula o valor absoluto do numero .<br />
IN e OUT poderão ter as seguintes combinações :<br />
IN<br />
OUT<br />
INT<br />
INT, REAL, WORD, DWORD, DINT<br />
REAL<br />
REAL<br />
BYTE<br />
INT, REAL, BYTE, WORD, DWORD, DINT<br />
WORD<br />
INT, REAL, WORD, DWORD, DINT<br />
DWORD<br />
REAL, DWORD, DINT<br />
SINT<br />
REAL<br />
USINT<br />
REAL<br />
UINT<br />
INT, REAL, WORD, DWORD, DINT, UDINT, UINT<br />
DINT<br />
REAL, DWORD, DINT<br />
UDINT<br />
REAL, DWORD, DINT, UDINT<br />
Exemplo em ST:<br />
Var1:INT;<br />
Var1:= ABS(-2); (*Resultado é 2)<br />
Exemplo em IL:<br />
LD -10<br />
ABS<br />
ST Var1 (* Resultado é 10*)<br />
ACOS<br />
Calcula o arco de co-seno (inverso de co-seno ) do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
ASIN<br />
Calcula o arco de seno (inverso de seno ) do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
ATAN<br />
Calcula o arco de tangente (inverso de tangente ) do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT , e OUT<br />
deve ser do tipo REAL .<br />
COS<br />
Calcula o co-seno do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
EXP<br />
Calcula o exponencial do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
<strong>BRESIMAR</strong> Cap. II – 3 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
EXPT<br />
Calcula o exponencial de numero levantado a outro numero .<br />
IN1 e IN2 pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e<br />
OUT deve ser do tipo REAL .<br />
Exemplo em ST:<br />
Var1:REAL;<br />
Var1:= EXPT(7,2); (*Resultado é 2)<br />
Exemplo em IL:<br />
LD 7<br />
EXPT 2<br />
ST Var1 (* Resultado é 49.0*)<br />
LN<br />
Calcula o logaritmo natural do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
LOG<br />
Calcula o logaritmo de base 10 do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
SIN<br />
Calcula o seno do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
SQRT<br />
Calcula a raiz quadrada do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
TAN<br />
Calcula a tangente do numero .<br />
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT<br />
deve ser do tipo REAL .<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 4 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
2 - INSTRUÇÕES ARITMÉTICAS<br />
ADD<br />
Calcula a soma aritmética de variáveis de diversos tipos : BYTE WORD DWORD SINT USINT INT<br />
UINT DINT UDINT REAL e LREAL. Duas variáveis TIME podem ser somadas resultando um outro<br />
TEMPO (ex. T#45s + T#50s = T#1m35s) .<br />
Exemplo em ST:<br />
Var1:= 7+2+4+7; (*Resultado é 20)<br />
Exemplo em IL:<br />
LD 7<br />
ADD 2,4,7<br />
ST Var1 (* Resultado é 20*)<br />
Exemplo em FBD:<br />
MUL<br />
Calcula o produto aritmético de variáveis de diversos tipos : BYTE WORD DWORD SINT USINT<br />
INT UINT DINT UDINT REAL e LREAL<br />
Exemplo em ST:<br />
Var1:= 7*2*4*7;<br />
Exemplo em IL:<br />
LD 7<br />
MUL 2,4,7<br />
ST Var1<br />
Exemplo em FBD:<br />
SUB<br />
Calcula a subtracção aritmética de variáveis de diversos tipos : BYTE WORD DWORD SINT<br />
USINT INT UINT DINT UDINT REAL e LREAL. Duas variáveis TIME podem ser subtraídas<br />
resultando um outro TEMPO . Um valor TIME negativo é um valor indefinido.<br />
Exemplo em ST:<br />
Var1:= 7-2;<br />
Exemplo em IL:<br />
LD 7<br />
SUB 2<br />
ST Var1<br />
Exemplo em FBD:<br />
<strong>BRESIMAR</strong> Cap. II – 5 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
DIV<br />
Calcula a divisão aritmética de variáveis de diversos tipos :BYTE WORD DWORD SINT USINT<br />
INT UINT DINT UDINT REAL e LREAL .<br />
Exemplo em ST:<br />
Var1:= 7/2;<br />
Exemplo em FBD:<br />
Nota : Usando CheckDivByte ; CheckDivWord ; CheckDivDWord e CheckDivReal podemos verificar<br />
o valor do divisor de maneira a evitar a divisão por zero .<br />
MOD<br />
Calcula o modulo de divisão (resto da divisão) de variáveis de diversos tipos : BYTE WORD<br />
DWORD SINT USINT INT UINT DINT UDINT . Duas variáveis TIME podem ser subtraídas<br />
resultando um outro TEMPO . Um valor TIME negativo é um valor indefinido.<br />
Exemplo em ST:<br />
Var1:= 9 MOD 2;<br />
Exemplo em IL:<br />
LD 9<br />
MOD 2<br />
ST Var1 (*Resultado é 1*)<br />
Exemplo em FBD:<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 6 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
3 - INSTRUÇÕES LOGICAS<br />
AND<br />
Calcula o produto lógico ( “E”) de variáveis de diversos tipos : BOOL BYTE WORD DWORD .<br />
Exemplo em ST:<br />
Var1:= 2#1001_0011 AND 2#1000_1010;<br />
Exemplo em IL:<br />
Var1:BYTE;<br />
LD 2#1001_0011<br />
AND 2#1000_1010<br />
ST Var1 (* Resultado é 2#1000_0010*)<br />
Exemplo em FBD:<br />
OR<br />
Calcula a soma lógica ( “OU”) de variáveis de diversos tipos : BOOL BYTE WORD DWORD .<br />
Exemplo em ST:<br />
Var1:= 2#1001_0011 OR 2#1000_1010;<br />
Exemplo em IL:<br />
Var1:BYTE;<br />
LD 2#1001_0011<br />
OR 2#1000_1010<br />
ST Var1 (* Resultado é 2#1001_1011*)<br />
Exemplo em FBD:<br />
XOR<br />
Calcula a soma lógica exclusiva ( “OU-Exclusivo”) de variáveis de diversos tipos : BOOL BYTE<br />
WORD DWORD .<br />
Exemplo em ST:<br />
Var1:= 2#1001_0011 XOR 2#1000_1010;<br />
Exemplo em IL:<br />
Var1:BYTE;<br />
LD 2#1001_0011<br />
XOR 2#1000_1010<br />
ST Var1 (* Resultado é 2#0001_1001*)<br />
Exemplo em FBD:<br />
Nota : Usando mais que 2 entradas o resultado é feito aos pares .<br />
<strong>BRESIMAR</strong> Cap. II – 7 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
NOT<br />
Calcula a negação lógica (“NÃO”) de variáveis de diversos tipos: BOOL BYTE WORD DWORD .<br />
Exemplo em ST:<br />
Var1:= NOT 2#1000_1010;<br />
Exemplo em IL:<br />
Var1:BYTE;<br />
LD 2#1001_0011<br />
NOT<br />
ST Var1 (* Resultado é 2#0110_1100*)<br />
Exemplo em FBD:<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 8 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
4 - INSTRUÇÕES de DESLOCAÇÃO de BIT<br />
SHL<br />
Deslocação de IN em “n” bits á esquerda e preenchendo de zeros os bits á direita . A:= SHL(IN, N) .<br />
IN e OUT serão do tipo BYTE WORLD ou DWORLD .<br />
Exemplo em ST:<br />
Exemplo em IL:<br />
LD 1<br />
SHL 1<br />
ST Var1 (* Resultado é 2 *)<br />
SHR<br />
Deslocação de IN em “n” bits á direita e preenchendo de zeros os bits á esquerda . A:= SHR(IN, N) .<br />
IN e OUT serão do tipo BYTE WORLD ou DWORLD .<br />
Exemplo em ST:<br />
Exemplo em IL:<br />
LD 32<br />
SHR 2<br />
ST Var1 (* Resultado é 8 *)<br />
<strong>BRESIMAR</strong> Cap. II – 9 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
ROL<br />
Deslocação de IN em “n” bits á esquerda e com realimentação á direita . A:= ROL(IN, N) .<br />
IN e OUT serão do tipo BYTE WORLD ou DWORLD .<br />
Exemplo em ST:<br />
Exemplo em IL:<br />
Var1: BYTE;<br />
LD 2#1001_0011<br />
ROL 3<br />
ST Var1 (* Resultado é 2#1001_1100 *)<br />
ROR<br />
Deslocação de IN em “n” bits á direita e com realimentação á esquerda . A:= ROR(IN, N) .<br />
IN e OUT serão do tipo BYTE WORLD ou DWORLD .<br />
Exemplo em ST:<br />
Exemplo em IL:<br />
Var1: BYTE;<br />
LD 2#1001_0011<br />
ROR 3<br />
ST Var1 (* Resultado é 2#0111_0010 *)<br />
<strong>BRESIMAR</strong> Cap. II – 10 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
5 - INSTRUÇÕES de SELECÇÃO<br />
SEL<br />
Selector binario . OUT := SEL(G, IN0, IN1) .<br />
Significa que OUT := IN0 se G=FALSE; OUT := IN1 se G=TRUE.<br />
IN0, IN1 e OUT pode ser de qualquer tipo de dados , G deve ser BOOL . O resultado da selecção é IN0<br />
se G for FALSE e IN1 se G for TRUE .<br />
Exemplo em IL:<br />
LD TRUE<br />
SEL 3,4<br />
ST Var1 (* Resultado é 4 *)<br />
ou<br />
LD FALSE<br />
SEL 3,4<br />
ST Var1 (* Resultado é 3 *)<br />
Exemplo em FBD:<br />
MAX<br />
Selecção do maior dado . OUT := MAX(IN0, IN1) .<br />
IN0, IN1 e OUT pode ter qualquer tipo de dados .<br />
Exemplo em IL:<br />
LD 90<br />
MAX 30<br />
MAX 40<br />
MAX 77<br />
ST Var1 (* Resultado é 90 *)<br />
Exemplo em FBD:<br />
MIN<br />
Selecção do menor dado . OUT := MIN(IN0, IN1) .<br />
IN0, IN1 e OUT pode ter qualquer tipo de dados .<br />
Exemplo em IL:<br />
LD 90<br />
MIN 30<br />
MIN 40<br />
MIN 77<br />
ST Var1 (* Resultado é 30 *)<br />
Exemplo em FBD:<br />
<strong>BRESIMAR</strong> Cap. II – 11 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
LIMIT<br />
Selecção de limites . OUT := LIMIT(Min, IN , Max).<br />
Significa que MAX é o limite superior e MIN o limite inferior . Se o valor em IN ultrapassar o MAX o<br />
valor na saída OUT será o MAX . Se o valor inferior a MIN o valor na saída OUT será MIN.<br />
MIN, MAX, IN e OUT pode ser de qualquer tipo de dados .<br />
Exemplo em IL:<br />
LD 90<br />
LIMIT 30,80<br />
ST Var1 (* Resultado é 80 *)<br />
MUX<br />
Multiplexador . OUT := MUX(K, IN0,...,INn) .<br />
Significa que o numero colocado em K indicará que o valor da entrada correspondente IN(K) será<br />
colocada na saida OUT .<br />
IN0, IN1, INn, OUT pode ser de qualquer tipo de dados . K deve ser BYTE, WORD, DWORD, SINT,<br />
USINT, INT, UINT, DINT ou UDINT.<br />
Exemplo em IL:<br />
LD 0<br />
MUX 30,40,50,60,70,80<br />
ST Var1 (* Resultado é 30 *)<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 12 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
6 - INSTRUÇÕES de COMPARAÇÃO<br />
GT<br />
Comparação maior que (“>”) . OUT:= IN1 GT IN2 . O valor do resultado OUT será TRUE quando o<br />
1º operando for maior que o 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,<br />
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,<br />
DATE_AND_TIME e STRING.<br />
Exemplo em ST:<br />
Var1:= 20 > 30 > 40;<br />
Exemplo em IL:<br />
LD 20<br />
GT 30<br />
ST Var1 (* Resultado é FALSE *)<br />
Exemplo em FBD:<br />
LT<br />
Comparação menor que (“=”) . OUT:= IN1 GE IN2 . O valor do resultado OUT será TRUE<br />
quando o 1º operando for maior ou igual ao 2º operando . Os operandos podem ser do tipo BOOL,<br />
BYTE, WORD, DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL,<br />
TIME, TIME_OF_DAY, DATE_AND_TIME e STRING.<br />
Exemplo em ST:<br />
Var1:= 20 > =20;<br />
Exemplo em IL:<br />
LD 20<br />
GE 20<br />
ST Var1 (* Resultado é TRUE *)<br />
Exemplo em FBD:<br />
<strong>BRESIMAR</strong> Cap. II – 13 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
LE<br />
Comparação menor ou igual a (“ 30 > 40;<br />
Exemplo em IL:<br />
LD 20<br />
LE 30<br />
ST Var1 (* Resultado é TRUE *)<br />
EQ<br />
Comparação igual (“=”) . OUT:= IN1 EQ IN2 . O valor do resultado OUT será TRUE quando o 1º<br />
operando for igual ao 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,<br />
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,<br />
DATE_AND_TIME e STRING.<br />
Exemplo em ST:<br />
Var1:= 20 ;<br />
Exemplo em IL:<br />
LD 20<br />
EQ 20<br />
ST Var1 (* Resultado é TRUE *)<br />
Exemplo em FBD:<br />
NE<br />
Comparação não igual (“”) . OUT:= IN1 IN2 . O valor do resultado OUT será TRUE quando o<br />
1º operando for diferente do 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,<br />
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,<br />
DATE_AND_TIME e STRING.<br />
Exemplo em ST:<br />
Var1:= 40 40 ;<br />
Exemplo em IL:<br />
LD 40<br />
NE 40<br />
ST Var1 (* Resultado é FALSE *)<br />
Exemplo em FBD:<br />
<strong>BRESIMAR</strong> Cap. II – 14 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
7 - INSTRUÇÕES de CONVERSÃO<br />
BOOL_TO conversão<br />
Converte uma variável BOOL para qualquer outro tipo . Para variáveis numéricas o resultado é 1<br />
quando o operando é TRUE e 0 quando o operando é FALSE. O resultado é “TRUE” ou “FALSE”<br />
respectivamente para variáveis STRING.<br />
Exemplo em ST:<br />
i:=BOOL_TO_INT(TRUE); (* Resultado é 1 *)<br />
str:=BOOL_TO_STRING(TRUE); (* Resultado é 'TRUE' *)<br />
t:=BOOL_TO_TIME(TRUE); (* Resultado é T#1ms *)<br />
tof:=BOOL_TO_TOD(TRUE); (* Resultado é TOD#00:00:00.001 *)<br />
dat:=BOOL_TO_DATE(FALSE); (* Resultado é D#1970-01-01 *)<br />
dandt:=BOOL_TO_DT(TRUE); (* Resultado é DT#1970-01-01-00:00:01 *)<br />
Conversão TO BOOL<br />
Converte qualquer tipo de variável para o tipo BOOL . O resultado é TRUE quando o operando não é<br />
0 . O resultado é FALSE quando o operando é igual a 0 . O resultado é TRUE no tipo de variável<br />
STRING quando o operando é “TRUE” , caso contrário o resultado é FALSE .<br />
Exemplo em ST:<br />
b := BYTE_TO_BOOL(2#11010101); (* Resultado é TRUE *)<br />
b := INT_TO_BOOL(0); (* Resultado é FALSE *)<br />
b := TIME_TO_BOOL(T#5ms); (* Resultado é TRUE *)<br />
b := STRING_TO_BOOL('TRUE'); (* Resultado é TRUE *)<br />
STRING_TO conversão<br />
Converte uma variável STRING para qualquer outro tipo . O operando da variável do tipo STRING<br />
deve conter um valor que seja valido no tipo de variável que se deseja converter , caso contrário o<br />
resultado é 0 .<br />
Exemplo em ST:<br />
b :=STRING_TO_BOOL('TRUE'); (* Resultado é TRUE *)<br />
w :=STRING_TO_WORD('abc34'); (* Resultado é 0 *)<br />
t :=STRING_TO_TIME('T#127ms'); (* Resultado é T#127ms *)<br />
Conversão TO STRING<br />
Converte qualquer tipo de variável para o tipo STRING .<br />
Exemplo em ST:<br />
str :=TIME_TO_STRING(T#12ms); (* Resultado é 'T#12ms' *)<br />
str :=DATE_TO_STRING(D#2002-08-18); (* Resultado é 'D#2002-08-18' *)<br />
str:=TOD_TO_STRING(TOD#14:01:05.123); (* Resultado é 'TOD#14:01:05.123' *)<br />
str:=BOOL_TO_STRING(TRUE); (* Resultado é 'TRUE' *)<br />
str:=DT_TO_STRING(DT#1998-02-13-14:20); (* Resultado é 'DT#1998-02-13-14:20' *)<br />
k := LREAL_TO_STRING(1.4); (* Resultado is '1.4' *)<br />
TIME_TO conversão<br />
Converte uma variável do tipo TIME para qualquer outro tipo . Os dados serão armazenados<br />
internamente numa DWORD em milissegundos . Só depois é que este valor será convertido . Quando<br />
ocorre uma conversão de um valor de um tipo maior para um menor corremos o risco de perda de<br />
informação . Para o tipo de STRING o resultado é uma constante que corresponde a um tempo.<br />
Exemplo em ST:<br />
dw:=TIME_TO_DWORD(T#5m); (* Resultado é 300000 *)<br />
str :=TIME_TO_STRING(T#12ms); (* Resultado é 'T#12ms' *)<br />
<strong>BRESIMAR</strong> Cap. II – 15 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
DATE_TO conversão<br />
Converte uma variável do tipo DATE para qualquer outro tipo . Os dados serão armazenados<br />
internamente numa DWORD em segundos a contar a partir do dia 1 de Janeiro de 1970. Só depois é<br />
que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo maior para um<br />
menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é uma constante<br />
que corresponde a uma data.<br />
Exemplo em ST:<br />
b :=DATE_TO_BOOL(D#1970-01-01); (* Resultado é FALSE *)<br />
i :=DATE_TO_INT(D#1970-01-15); (* Resultado é 29952 *)<br />
str :=DATE_TO_STRING(D#2002-08-18); (* Resultado é 'D#2002-08-18' *)<br />
vdt:=DATE_TO_DT(D#2002-08-18); (* Resultado é DT#2002-08-18-00:00 *)<br />
udw:=DATE_TO_DWORD(D#2002-08-18); (* Resultado é 16#3D5EE380 *)<br />
TOD_TO conversão<br />
Converte uma variável do tipo TIME_OF_DATE para qualquer outro tipo . Os dados serão<br />
armazenados internamente numa DWORD em milissegundos a contar a partir das 12:00 AM. Só<br />
depois é que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo maior<br />
para um menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é uma<br />
constante que corresponde a uma constante de tempo.<br />
Exemplo em ST:<br />
si:=TOD_TO_SINT(TOD#00:00:00.012); (* Resultado é 12 *)<br />
str:=TOD_TO_STRING(TOD#14:01:05.123); (* Resultado é 'TOD#14:01:05.123' *)<br />
tm:= TOD_TO_TIME(TOD#14:01:05.123); (* Resultado é T#841m5s123ms *)<br />
udi:= TOD_TO_UDINT(TOD#14:01:05.123); (* Resultado é 16#03020963 *)<br />
DT_TO conversão<br />
Converte uma variável do tipo DATE_AND_TIME para qualquer outro tipo . Os dados serão<br />
armazenados internamente numa DWORD em segundos a contar a partir do dia 1 de Janeiro de 1970.<br />
Só depois é que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo<br />
maior para um menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é<br />
uma constante que corresponde a uma data e tempo.<br />
Exemplo em ST:<br />
byt :=DT_TO_BYTE(DT#1970-01-15-05:05:05); (* Resultado é 129 *)<br />
str:=DT_TO_STRING(DT#1998-02-13-14:20); (* Resultado é 'DT#1998-02-13-14:20' *)<br />
vtod:=DT_TO_TOD(DT#1998-02-13-14:20); (* Resultado é TOD#14:20 *)<br />
vdate:=DT_TO_DATE(DT#1998-02-13-14:20); (* Resultado é D#1998-02-13 *)<br />
vdw:=DT_TO_DWORD(DT#1998-02-13-14:20); (* Resultado é 16#34E45690 *)<br />
REAL_TO / LREAL_TO conversão<br />
Converte uma variável do tipo REAL ou LREAL para qualquer outro tipo . Os dados serão<br />
arredondados para cima ou para baixo conforme o valor decimal e convertidos em um novo tipo de<br />
variável excepto para as variáveis de tipo STRING, BOOL, REAL e LREAL. Quando ocorre uma<br />
conversão de um valor de um tipo maior para um menor corremos o risco de perda de informação .<br />
Para o tipo de STRING o numero total de dígitos é limitado a 16 . Se o numero (L)REAL tem<br />
mais dígitos o 16º digito será arredondado . Se o comprimento do STRING é definido curto ele<br />
será truncado começando no fim do lado direito .<br />
Exemplo em ST:<br />
i := REAL_TO_INT(1.5); (* Resultado é 2 *)<br />
j := REAL_TO_INT(1.4); (* Resultado é 1 *)<br />
k := LREAL_TO_STRING(1.4); (* Resultado é '1.4' *)<br />
<strong>BRESIMAR</strong> Cap. II – 16 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
BYTE TO conversão USINT TO conversão SINT TO conversão<br />
WORD TO conversão UINT TO conversão INT TO conversão<br />
DWORD TO conversão UDINT TO conversão DINT TO conversão<br />
Quando ocorre uma conversão de um valor de um tipo maior para um menor corremos o risco de<br />
perda de informação . Se o numero convertido excede o limite máximo, o primeiro “ byte” será<br />
ignorado .<br />
Exemplo em ST:<br />
si := INT_TO_SINT (4223); (* Resultado é 127 . Como o numero inteiro 4223 em Hex é 16#107F em<br />
SINT ( 1 “byte”) só será representado o “byte menos significativo 16#7F que representa 127 *)<br />
Exemplo em IL:<br />
LD 5<br />
INT_TO_REAL<br />
MUL 3.5<br />
ST Var1 (* Resultado é REAL , 17.5*)<br />
TRUNC<br />
Converte uma variável de tipo REAL para INT . Quando ocorre uma conversão de um valor de um<br />
tipo maior para um menor corremos o risco de perda de informação . Se o numero convertido excede<br />
o limite máximo, o primeiro “ byte” será ignorado .<br />
Exemplo em ST:<br />
i:=TRUNC(1.9); (* Result is 1 *)<br />
i:=TRUNC(-1.4); (* Result is -1 *)<br />
Exemplo em IL:<br />
LD 5.5<br />
TRUNC<br />
MUL 3.5<br />
ST Var1 (* Resultado é REAL , 17.5*)<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 17 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 18 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
8 - INSTRUÇÕES VÁRIAS<br />
INDEXOF<br />
Calcula o índex (posição de memória) interno do POU (“Program Organization Unit”) .<br />
Exemplo em ST:<br />
Var1:= TRUNC (POU2);<br />
Exemplo em IL:<br />
Var1:DINT;<br />
LD POU2 (* Nome da programa , função ou bloco funcional *)<br />
INDEXOF<br />
ST Var1<br />
SIZEOF<br />
Calcula o numero de “bytes” requerido para um dado tipo de dados .<br />
Exemplo em ST:<br />
arr1:ARRAY [0..5] OF INT;<br />
Var1:INT;<br />
Var1:= TRUNC (arr1); (* O resultado é 12 *)<br />
Exemplo em IL:<br />
arr1:ARRAY [0..6] OF INT;<br />
Var1:INT;<br />
LD arr1<br />
SIZEOF<br />
ST Var1 (* O resultado é 14 *)<br />
ADR<br />
Calcula o endereço absoluto de uma variável em DWORLD . Esta função é utilizada para ser tratada<br />
pelos PONTEIROS .<br />
Exemplo em IL:<br />
LD var1<br />
ADR<br />
ST var2<br />
^<br />
Esta identificação referência um PONTEIRO .<br />
Exemplo em ST:<br />
pt:POINTER TO INT<br />
var_int1:INT;<br />
var_int2:INT;<br />
pt:=ADR(var_int1);<br />
var_int2:=pt^;<br />
BITADR<br />
Retorna com o endereço do bit d a variável indicada .<br />
Exemplo em IL:<br />
var1: AT %IX1.0 : BOOL<br />
out : BYTE<br />
LD var1<br />
BITADR<br />
ST out (*Retorna com 08)<br />
Exemplo em ST<br />
bOFF AT %QX10.1 : BOOL<br />
iBitAdr : BYTE<br />
iBit := BITADR (bOFF) ; (*Retorna com 81)<br />
<strong>BRESIMAR</strong> Cap. II – 19 de 20
TWINCAT PLC - Lista de Instruções<br />
BECKHOFF New Automation Technology<br />
CAL<br />
Chama em IL uma função bloco . As variáveis que servem como entradas estão colocadas entre<br />
parênteses á direita depois do nome da função bloco .<br />
Exemplo em IL:<br />
CAL INST (par1: 0 , par2:= TRUE)<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. II – 20 de 20
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
III – FUNÇÕES BLOCO “STANDARD”<br />
1 – FUNÇÕES BLOCO “STANDARD” – BIESTAVEL<br />
2 – FUNÇÕES BLOCO “STANDARD” – “TRIGGER”<br />
3 – FUNÇÕES BLOCO “STANDARD” – TEMPORIZADORES<br />
4 – FUNÇÕES BLOCO “STANDARD” – CONTADORES<br />
<strong>BRESIMAR</strong> Cap. III – 1 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. III – 2 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
1 – FUNÇÕES BLOCO “STANDARD” - BIESTAVEL<br />
FUNCTION_BLOCK RS<br />
Biestavel com RESET prioritário Q1 = RS (SET, RESET1) .<br />
Equação lógica implementada internamente no FB , Q1 = NOT RESET1 AND (Q1 OR SET) .<br />
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb (*Para PC*)<br />
VAR_INPUT<br />
VAR_INPUT<br />
SET : BOOL;<br />
RESET1 : BOOL;<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q1 : BOOL;<br />
END_VAR<br />
FUNCTION_BLOCK SR<br />
Biestavel com SET prioritário Q1 = SR (SET1, RESET) .<br />
Equação lógica implementada internamente no FB , Q1 := (NOT RESET AND Q1) OR SET1 .<br />
VAR_INPUT<br />
VAR_INPUT<br />
SET1 : BOOL;<br />
RESET : BOOL;<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q1 : BOOL;<br />
END_VAR<br />
FUNCTION_BLOCK SEMA<br />
Função semáforo .Equação lógica implementada internamente no FB ,é a seguinte :<br />
BUSY := X;<br />
IF CLAIM THEN X:=TRUE;<br />
ELSIF RELEASE THEN BUSY := FALSE;<br />
X:= FALSE;<br />
END_IF<br />
VAR_INPUT<br />
VAR_INPUT<br />
CLAIM : BOOL;<br />
REALEASE : BOOL;<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q1 : BOOL;<br />
END_VAR<br />
<strong>BRESIMAR</strong> Cap. III – 3 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
2 – FUNÇÕES BLOCO “STANDARD” – “TRIGGER”<br />
FUNCTION_BLOCK F_TRIG<br />
Accionamento pelo flanco descendente . A saída Q e a variável interna M manter-se-á FALSE<br />
enquanto a entrada CLK é TRUE . Logo que ocorra a transição de TRUE para FALSE em CLK a saída<br />
Q ficará TRUE e M será posto a TRUE (set) . Isto significa que cada vez que esta função bloco seja<br />
chamada a saída Q mantém-se FALSE até que ocorra uma transição do CLK de TRUE para FALSE .<br />
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb6 (*Para BC*)<br />
VAR_INPUT<br />
VAR_INPUT<br />
CLK : BOOL; (* Sinal a detector*)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (* Transição detectada *)<br />
END_VAR<br />
VAR<br />
M : BOOL;<br />
END_VAR<br />
FUNCTION_BLOCK R_TRIG<br />
Accionamento pelo flanco ascendente . A saída Q e a variável interna M manter-se-á FALSE enquanto<br />
a entrada CLK é FALSE . Logo que ocorra a transição de FALSE para TRUE em CLK a saída Q<br />
ficará TRUE e M será posto a TRUE (set) . Isto significa que cada vez que esta função bloco seja<br />
chamada a saída Q mantém-se FALSE até que ocorra uma transição do CLK de FALSE para TRUE .<br />
VAR_INPUT<br />
VAR_INPUT<br />
CLK : BOOL; (* Sinal a detector*)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (* Transição detectada *)<br />
END_VAR<br />
VAR<br />
M : BOOL;<br />
END_VAR<br />
<strong>BRESIMAR</strong> Cap. III – 4 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
3 – FUNÇÕES BLOCO “STANDARD” – TEMPORIZADORES<br />
FUNCTION_BLOCK TOF<br />
Temporizador ao atraso .<br />
VAR_INPUT<br />
VAR_INPUT<br />
IN : BOOL;(* Iniciar temporização quando FALSE*)<br />
PT : TIME; (* Temporização *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (*FALSE passado PT seg depois de PT ter passado T RUE=>FALSE *)<br />
PT: TIME; (* Tempo já decorrido *)<br />
END_VAR<br />
FUNCTION_BLOCK TON<br />
Temporizador ao trabalho .<br />
VAR_INPUT<br />
VAR_INPUT<br />
IN : BOOL;(* Iniciar temporização quando TRUE *)<br />
PT : TIME; (* Temporização *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (*TRUE passado PT seg depois de PT ter passado FALSE=>TRUE *)<br />
PT: TIME; (* Tempo já decorrido *)<br />
END_VAR<br />
<strong>BRESIMAR</strong> Cap. III – 5 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
FUNCTION_BLOCK TP<br />
Temporizador ao trabalho por impulso .<br />
VAR_INPUT<br />
VAR_INPUT<br />
IN : BOOL;(* Iniciar temporização na transição de TRUE para FALSE*)<br />
PT : TIME; (* Temporização *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (*TRUE durante PT tempo, impulso *)<br />
PT: TIME; (* Tempo já decorrido *)<br />
END_VAR<br />
<strong>BRESIMAR</strong> Cap. III – 6 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
4 – FUNÇÕES BLOCO “STANDARD” – CONTADORES<br />
FUNCTION_BLOCK CTD<br />
Contador decrescente . Quando LOAD é TRUE a variável CV será inicializada com o valor que se<br />
encontra na variável PV . Se CD transitar de FALSE para TRUE , CV decrementa 1. Quando CV for<br />
menor ou igual a zero Q irá a TRUE .<br />
VAR_INPUT<br />
VAR_INPUT<br />
IN : BOOL;(* Contar com a transição positiva (FALSE=>TRUE) *)<br />
LOAD : BOOL; (* Ordem de carregar valor inicial PV *)<br />
PV : WORD; (* Valor inicial *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (* Finalização de contagem *)<br />
CV: WORD; (* Contagem corrente *)<br />
END_VAR<br />
FUNCTION_BLOCK CTU<br />
Contador crescente . A variável CV será inicializada com o RESET a TRUE . Quando ocorre uma<br />
transição de FALSE para TRUE o contador incrementa 1 . Quando CV for maior ou igual a PV<br />
Q irá a TRUE .<br />
VAR_INPUT<br />
VAR_INPUT<br />
CU : BOOL;(* Contar com a transição positiva (FALSE=>TRUE) *)<br />
RESET : BOOL; (* Ordem de por a zero o contador *)<br />
PV : WORD; (* Valor final *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
Q : BOOL; (* Finalização de contagem *)<br />
CV: WORD; (* Contagem corrente *)<br />
<strong>BRESIMAR</strong> Cap. III – 7 de 8
TWINCAT PLC – Funções bloco “standard”<br />
BECKHOFF New Automation Technology<br />
FUNCTION_BLOCK CTUD<br />
Contador crescente e decrescente . Combinação das mesmas características dos blocos funcionais de<br />
contagem anteriores .( CTU e CTD ) .<br />
VAR_INPUT<br />
VAR_INPUT<br />
CU : BOOL;(* Contagem crescente *)<br />
CU : BOOL;(* Contagem crescente *)<br />
RESET : BOOL; (* Ordem de por a zero o contador *)<br />
LOAD : BOOL; (* Ordem de carregar valor inicial PV *)<br />
PV : WORD; (* Valor final *)<br />
END_VAR<br />
VAR_OUTPUT<br />
VAR_OUTPUT<br />
QU : BOOL; (* Finalização de contagem *)<br />
QD : BOOL; (* Finalização de contagem a zero *)<br />
CV: WORD; (* Contagem corrente *)<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. III – 8 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
IV – FUNÇÕES “STANDARD”<br />
1 – FUNÇÕES “STANDARD” – “STRING”<br />
<strong>BRESIMAR</strong> Cap. IV – 1 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. IV – 2 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
1 – FUNÇÕES “STANDARD” – “STRING”<br />
CONCAT<br />
Combina 2 “strings” .<br />
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb (*Para PC*)<br />
FUNCTION CONCAT : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR1 : STRING(255);<br />
STR2 : STRING(255);<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: CONCAT (‘SUSI’ , ‘WILLI’) ;<br />
Exemplo em IL:<br />
LD ‘SUSI’<br />
CONCAT ‘WILLI’<br />
ST Var1 (* Resultado é ‘SUSIWILLI’ *)<br />
DELETE<br />
Apaga uma parte de um STRING a partir de uma dada posição .<br />
DELETE (STR, L, P) significa o seguinte :<br />
Apaga L caracteres do “string” STR a partir do carácter nº P .<br />
FUNCTION DELETE : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR : STRING(255);<br />
LEN : INT;<br />
POS : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = DELETE (‘SUXYSI’ , 2 , 2 ) ;<br />
Exemplo em IL:<br />
LD ‘SUXYSI’<br />
DELETE 2,2<br />
ST Var1 (* Resultado é ‘SYSI’ *)<br />
<strong>BRESIMAR</strong> Cap. IV – 3 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
FIND<br />
Função de procura de uma parte (frase) dentro de um STRING .<br />
FIND (STR1, STR2) significa o seguinte :<br />
Encontra a posição , desde o 1º carácter , da frase STR1 dentro da STR2 .<br />
FUNCTION FIND : INT<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR1 : STRING(255);<br />
STR2 : STRING(255);<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = FIND (‘SUXYSI’ , ‘XY’ ) ;<br />
Exemplo em IL:<br />
LD ‘SUXYSI’<br />
FIND ‘XY’<br />
ST Var1 (* Resultado é 3 *)<br />
INSERT<br />
Função de inserção de uma parte (frase) dentro de um STRING .<br />
INSERT (STR1, STR2, POS) significa o seguinte :<br />
Insere STR2 depois da posição POS na frase STR1 .<br />
FUNCTION INSERT : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR1 : STRING(255);<br />
STR2 : STRING(255);<br />
POS : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = INSERT (‘SUSI’ , ‘XY’ , 2) ;<br />
Exemplo em IL:<br />
LD ‘SUSI’<br />
INSERT ‘XY’ , 2<br />
ST Var1 (* Resultado é ‘SUXYSI’ *)<br />
<strong>BRESIMAR</strong> Cap. IV – 4 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
LEFT<br />
Selecciona um nº caracteres de um STRING a começar pela esquerda .<br />
LEFT (STR, SIZE) significa o seguinte :<br />
Selecciona na frase STR , SIZE caracteres a começar pela esquerda .<br />
FUNCTION LEFT : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR : STRING(255);<br />
SIZE : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = LEFT (‘<strong>BRESIMAR</strong>’ , 2) ;<br />
Exemplo em IL:<br />
LD ‘<strong>BRESIMAR</strong>’<br />
LEFT 2<br />
ST Var1 (* Resultado é ‘BR’ *)<br />
LEN<br />
Calcula o tamanho de um STRING (nº de caracteres) .<br />
FUNCTION LEN : INT<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR : STRING(255);<br />
SIZE : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = LEN (‘<strong>BRESIMAR</strong>’ ) ;<br />
Exemplo em IL:<br />
LD ‘<strong>BRESIMAR</strong>’<br />
LEN<br />
ST Var1 (* Resultado é 8 *)<br />
<strong>BRESIMAR</strong> Cap. IV – 5 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
MID<br />
Selecciona um nº caracteres de um STRING a partir de uma dada posição .<br />
MID (STR, LEN, POS) significa o seguinte :<br />
Selecciona na frase STR , LEN caracteres a começar da posição POS (a contar da<br />
esquerda).<br />
FUNCTION MID : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR : STRING(255);<br />
LEN : INT;<br />
POS : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = MID (‘<strong>BRESIMAR</strong>’ , 2 , 3) ;<br />
Exemplo em IL:<br />
LD ‘<strong>BRESIMAR</strong>’<br />
MID 2 , 3<br />
ST Var1 (* Resultado é ‘ES’ *)<br />
REPLACE<br />
Cola um STRING a partir de uma dada posição de um dado STRING e eliminando um nº de caracteres<br />
definidos .<br />
REPLACE (STR1, STR2, L, P) significa o seguinte :<br />
Cola a frase STR2 a partir da posição P da frase STR1 e eliminando em STR1 L<br />
caracteres .<br />
FUNCTION REPLACE : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR1 : STRING(255);<br />
STR1 : STRING(255);<br />
L : INT;<br />
P : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = REPLACE (‘<strong>BRESIMAR</strong>’ , ‘ASA’ , 2 , 3) ;<br />
Exemplo em IL:<br />
LD ‘<strong>BRESIMAR</strong>’<br />
REPLACE ‘ASA’ , 2, 3<br />
ST Var1 (* Resultado é ‘BASAIMAR’ *)<br />
<strong>BRESIMAR</strong> Cap. IV – 6 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
RIGTH<br />
Selecciona um nº caracteres de um STRING a começar pela direita .<br />
RIGTH (STR, SIZE) significa o seguinte :<br />
Selecciona na frase STR , SIZE caracteres a começar pela direita .<br />
FUNCTION RIGTH : STRING(255)<br />
VAR_INPUT<br />
VAR_INPUT<br />
STR : STRING(255);<br />
SIZE : INT;<br />
END_VAR<br />
Exemplo em ST:<br />
Var1: = RIGTH (‘<strong>BRESIMAR</strong>’ , 3) ;<br />
Exemplo em IL:<br />
LD ‘<strong>BRESIMAR</strong>’<br />
RIGTH 3<br />
ST Var1 (* Resultado é ‘MAR’ *)<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. IV – 7 de 8
TWINCAT PLC – Funções “standard”<br />
BECKHOFF New Automation Technology<br />
Notas :<br />
<strong>BRESIMAR</strong> Cap. IV – 8 de 8
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
V – EXEMPLOS PRÁTICOS<br />
1 – ARRANQUE DIRECTO DE MOTOR TRIFÁSICO<br />
2 – INVERSÃO DE ROTAÇÃO DE MOTOR TRIFÁSICO<br />
3 – ARRANQUE ESTRELA-TRIANGULO DE MOTOR TRIFÁSICO<br />
Neste capitulo vão ser apresentados exemplos de automatismos e respectivas soluções<br />
utilizando instruções pertencentes a PLC´s “<strong>Beckhoff</strong>” .<br />
As aplicações abordam circuitos eléctricos simples e comuns nos automatismos electromecânicos<br />
industriais . O estudo destes exemplos tem por finalidade aprofundar os conhecimentos<br />
adquiridos nos capítulos anteriores e , ao mesmo tempo , possibilitar a prática das instruções base do<br />
“<strong>TwinCAT</strong>-PLC” .<br />
Compreendidos os exemplos propostos , adquirem-se os conhecimentos necessários para se<br />
abordar situações mais complexas , ou seja , o caminho fica aberto para que se torne possível enfrentar<br />
a concepção , realização e manutenção de automatismos usando o “<strong>TwinCAT</strong>” .<br />
Chamo á atenção , que os exemplos de programação apresentados foram escritos a titulo<br />
didáctico . Por isso , podem não estar previstas todas as situações de funcionamento real . Deste modo ,<br />
o seu uso em programas de aplicação industrial pode necessitar de adaptações que assegurem todas as<br />
possibilidades de utilização e o respeito pelas normas de segurança em vigor no sector de actividade<br />
onde vão ser utilizadas .<br />
<strong>BRESIMAR</strong> Cap. V – 1 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 2 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1 – ARRANQUE DIRECTO DE MOTOR TRIFÁSICO<br />
Com este circuito pretende-se comandar um motor trifásico através de duas botoneiras com<br />
contactos normalmente abertos (N.A.) “S1” e “S2” e executado por um algoritmo ( programa de PLC<br />
- “<strong>Beckhoff</strong>“) . A colocação em marcha do motor é feita quando se pressiona “S2” e a paragem quando<br />
se pressiona “S1”. A paragem também ocorre se a protecção térmica do motor contra sobrecargas for<br />
actuada. Se tal acontecer , é actuado o contacto normalmente fechado (N.F.) “F2” (circuito abre ) .<br />
Equação lógica do circuito :<br />
KM1 = /F2 . /S1 . ( S2 + KM1)<br />
<strong>BRESIMAR</strong> Cap. V – 3 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.1 - Edição a texto<br />
1.1.1 - ST - “Structured Text”<br />
<strong>BRESIMAR</strong> Cap. V – 4 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.1.2 - IL - “Instruction List”<br />
<strong>BRESIMAR</strong> Cap. V – 5 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.2 - Edição gráfica<br />
1.2.1 - LD - “Ladder Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 6 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.2.2 - FBD - “Function Block Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 7 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.2.3 - CFC - “Continuos Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 8 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.3 - Edição por GRAFCET<br />
Para quem utilizar o método de diagrama funcional GRAFCET , teremos para o circuito<br />
anterior a seguinte estrutura :<br />
GRAFCET NÍVEL 1 (Especificações funcionais)<br />
GRAFCET NÍVEL 2 (Especificações tecnológicas)<br />
Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , estando o sistema em<br />
repouso (motor parado) . Para que o motor trabalhe é necessário que o GRAFCET evolua para a etapa<br />
1 .<br />
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição<br />
lógica de transição ( F2 . /S1 . S2 ) for verdadeira ( o botão de pressão “S2“ foi pressionado , não está<br />
pressionado o botão “S1“ e nem o relé térmico “F2” foi actuado ). Nesta situação o GRAFCET evolui<br />
para a etapa 1 e a acção associada a esta etapa é realizada (bobina do contactor é alimentada e o motor<br />
M1 é accionado).<br />
Estando o motor em funcionamento (etapa 1) se desejarmos desligar o motor teremos de<br />
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S1 ) for<br />
verdadeira ( o botão de pressão “S1“ foi pressionado ou o relé térmico “F2” disparou ) .<br />
<strong>BRESIMAR</strong> Cap. V – 9 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.3.1 - SFC - “Sequencial Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 10 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
1.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”<br />
<strong>BRESIMAR</strong> Cap. V – 11 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2 – INVERSÃO DE ROTAÇÃO DE MOTOR TRIFÁSICO<br />
Com este circuito pretende-se comandar o sentido de rotação de um motor trifásico através de<br />
duas botoneiras com contactos normalmente abertos (N.A.) “S7” (marcha para a direita) e “S8” (para a<br />
esquerda) . A paragem efectua-se quando se pressiona o botão “S6” (N.A)ou se a protecção térmica<br />
do motor contra sobrecargas for actuada . Se tal acontecer , é actuado o contacto normalmente fechado<br />
(N.F.) “F2” ( contacto abre) .<br />
Equação lógica do circuito :<br />
KM5 = /F2 . /S6 . /KM6 . ( S7 + KM5)<br />
KM6 = /F2 . /S6 . /KM5 . ( S8 + KM6)<br />
<strong>BRESIMAR</strong> Cap. V – 12 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.1 - Edição a texto<br />
2.1.1 - ST - “Structured Text”<br />
<strong>BRESIMAR</strong> Cap. V – 13 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.1.2 - IL - “Instruction List”<br />
<strong>BRESIMAR</strong> Cap. V – 14 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.2 - Edição gráfica<br />
2.2.1 - LD - “Ladder Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 15 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.2.2 - FBD - “Function Block Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 16 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.2.3 - CFC - “Continuos Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 17 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.3 - Edição por GRAFCET<br />
Para quem utilizar o método de diagrama funcional de GRAFCET , teremos para o circuito anterior a<br />
seguinte estrutura :<br />
GRAFCET NÍVEL 1 (Especificações funcionais)<br />
GRAFCET NÍVEL 2 (Especificações tecnológicas)<br />
Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , o motor está parado .<br />
Para que o motor trabalhe é necessário que o GRAFCET evolua para a etapa 1 ou 2.<br />
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição<br />
lógica de transição ( F2 . /S6 . /S8 . S7 ) for verdadeira ( o botão de pressão “S7“ foi pressionado e não<br />
está pressionado o botão “S6“ nem o “S8” e nem o relé térmico “F2” foi actuado ). Nesta situação o<br />
GRAFCET evolui para a etapa 1 e o motor irá rodar para a direita . Para o motor rodar para a esquerda<br />
, a etapa 2 terá de ser activada , em alternativa á etapa 1 , sendo necessário que o motor esteja parado (<br />
etapa 0) e a condição de transição ( F2 . /S6 . /S7 . S8 ) seja verdadeira .<br />
Estando o motor em funcionamento (etapa 1 ou 2) se desejarmos desligar o motor teremos de<br />
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S6 ) for<br />
verdadeira ( o botão de pressão “S6“ foi pressionado ou o relé térmico “F2” disparou ) .<br />
<strong>BRESIMAR</strong> Cap. V – 18 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.3.1 - SFC - “Sequencial Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 19 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
2.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”<br />
<strong>BRESIMAR</strong> Cap. V – 20 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 21 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3 – ARRANQUE ESTRELA-TRIANGULO DE MOTOR TRIFÁSICO<br />
Com este circuito pretende-se efectuar o arranque estrela - triangulo de um motor assíncrono<br />
trifásico com rotor em curto-circuito. O arranque ocorre quando se pressiona o botão de pressão “S10”.<br />
A paragem efectua-se quando se pressiona o botão “S9” (N.A) ou se a protecção térmica do motor<br />
“F2” (N.F.)contra sobrecargas for actuada .<br />
Equação lógica do circuito :<br />
KM1 = /F2 . /S9 . ( S10 + KM2 . KM1) . /KM2(t1) . /KM3<br />
KM2 = /F2 . /S9 . ( S10 . KM1+ KM2)<br />
KM3 = /F2 . /S9 . ( S10 . KM1+ KM2) . /KM1<br />
<strong>BRESIMAR</strong> Cap. V – 22 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.1 - Edição a texto<br />
3.1.1 - ST - “Structured Text”<br />
<strong>BRESIMAR</strong> Cap. V – 23 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.1.2 - IL - “Instruction List”<br />
<strong>BRESIMAR</strong> Cap. V – 24 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 25 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.2 - Edição gráfica<br />
3.2.1 - LD - “Ladder Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 26 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 27 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.2.2 - FBD - “Function Block Diagram”<br />
<strong>BRESIMAR</strong> Cap. V – 28 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 29 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.2.3 - CFC - “Continuos Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 30 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.3 - Edição por GRAFCET<br />
Para quem utilizar o método de diagrama funcional de GRAFCET , teremos a seguinte estrutura :<br />
GRAFCET NÍVEL 1 (Especificações funcionais)<br />
GRAFCET NÍVEL 2 (Especificações tecnológicas)<br />
Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , o motor esta parado .<br />
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição<br />
lógica de transição ( F2 . /S9 . S10 ) for verdadeira ( o botão de pressão “S10“ foi pressionado e não<br />
está pressionado o botão “S9“ e nem o relé térmico “F2” foi actuado ). Nesta situação o GRAFCET<br />
evolui para a etapa 1 e o motor irá arrancar em modo “estrela” durante o tempo “t1” (seg.) . Nesta<br />
etapa está accionado o contactor “KM1” e “KM2” .Passado esse tempo “t1” o sistema passará para<br />
a etapa 2 , que corresponde ao modo “triangulo” . Nesta etapa o contactor “KM1” está desligado , o<br />
contactor “KM2” mantém-se ligado e é ligado o contactor “KM3” .<br />
Estando o motor em funcionamento (etapa 1 ou 2) se desejarmos desligar o motor teremos de<br />
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S9) for<br />
verdadeira ( o botão de pressão “S9“ foi pressionado ou o relé térmico “F2” disparou ) .<br />
<strong>BRESIMAR</strong> Cap. V – 31 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.3.1 - SFC - “Sequencial Function Chart”<br />
<strong>BRESIMAR</strong> Cap. V – 32 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 33 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
3.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”<br />
<strong>BRESIMAR</strong> Cap. V – 34 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 35 de 36
TWINCAT PLC – Exemplos práticos<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Cap. V – 36 de 36
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
Anexo A – RESUMO DE INSTRUÇÕES E FUNÇÕES “STANDARD”<br />
1 – RESUMO DE INSTRUÇÕES DO “<strong>TwinCAT</strong> PLC”<br />
2 – RESUMO DAS FUNÇÕES BLOCO “STANDARD”<br />
3 – RESUMO DAS FUNÇÕES “STANDARD”<br />
<strong>BRESIMAR</strong> Anexo A – 1 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Anexo A – 2 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
1 – RESUMO DE INSTRUÇÕES DO “<strong>TwinCAT</strong> PLC”<br />
NUMERICAS IL ST LD<br />
ABS - Valor absoluto LD in<br />
ABS<br />
ST out<br />
out:=ABS(in);<br />
ACOS - Arco de coseno<br />
ASIN - Arco de seno<br />
ATAN - Arco de<br />
tangente<br />
COS - Co-seno<br />
EXP - Exponencial<br />
EXPT - Expo. de in1<br />
levantado a in2<br />
LD in<br />
ACOS<br />
ST out<br />
LD in<br />
ASIN<br />
ST out<br />
LD in<br />
ATAN<br />
ST out<br />
LD in<br />
COS<br />
ST out<br />
LD in<br />
EXP<br />
ST out<br />
LD in1<br />
EXPT in2<br />
ST out<br />
out:=COS(in);<br />
out:=ASIN(in);<br />
out:=ATAN(in);<br />
out:=COS(in);<br />
out:=EXP(in);<br />
out:=EXPT(in1,<br />
in2);<br />
LN - Logaritmo natural<br />
LOG - Logaritmo de<br />
base 10<br />
SIN - Seno<br />
SQRT - Raiz quadrada<br />
TAN - Tangente<br />
LD in<br />
LN<br />
ST out<br />
LD in<br />
LOG<br />
ST out<br />
LD in<br />
SIN<br />
ST out<br />
LD in<br />
SQRT<br />
ST out<br />
LD in<br />
TAN<br />
ST out<br />
out:=LN(in);<br />
out:=LOG(in);<br />
out:=SIN(in);<br />
out:=SQRT(in);<br />
out:=TAN(in);<br />
ARITMETICAS IL ST LD<br />
ADD - Soma<br />
LD in1<br />
ADD in2<br />
ST out<br />
out:= in1+in2;<br />
MUL - Multiplicação<br />
SUB - Subtracção<br />
LD in1<br />
MUL in2,in3<br />
ST out<br />
LD in1<br />
SUB in2<br />
ST out<br />
out:= in1*in2*in3;<br />
out:= in1-in2;<br />
<strong>BRESIMAR</strong> Anexo A – 3 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
DIV - Divisão<br />
MOD - Resto da divisão<br />
LD in<br />
DIV in2<br />
ST out<br />
LD in<br />
MOD in2<br />
ST out<br />
out:= in1 / in2;<br />
out:= in1 MOD in2;<br />
LOGICAS IL ST LD<br />
AND - “E” (produto<br />
lógico)<br />
( BOOL , BYTE , WORD ,<br />
DWORD )<br />
LD in1<br />
AND in2<br />
ST out<br />
out:= in1 AND in2;<br />
OR - “OU” (soma<br />
lógica)<br />
( BOOL , BYTE , WORD ,<br />
DWORD )<br />
XOR - “OU EX” (<br />
“OU” exclusivo)<br />
( BOOL , BYTE , WORD ,<br />
DWORD )<br />
NOT - “NÃO”<br />
(negação lógica)<br />
( BOOL , BYTE , WORD ,<br />
DWORD )<br />
LD in<br />
OR in2<br />
ST out<br />
LD in<br />
XOR in2<br />
ST out<br />
LD in<br />
NOT<br />
ST out<br />
out:= in1 OR in2;<br />
out:= in1 XOR in2;<br />
out:= NOT in;<br />
DESLOCAÇÃO IL ST LD<br />
SHL - Deslocação de in<br />
em n bits a direita com<br />
preenchimento á<br />
esquerda<br />
( BYTE , WORD , DWORD )<br />
LD in<br />
SHL n<br />
ST out<br />
out:= SHL (in,n);<br />
SHR - Deslocação de in<br />
em n bits á esquerda<br />
com preenchimento á<br />
direita<br />
( BYTE , WORD , DWORD )<br />
ROL - Deslocação de in<br />
em n bits á direita com<br />
entrada á esquerda<br />
( BYTE , WORD , DWORD )<br />
ROR - Deslocação de in<br />
em n bits á esquerda<br />
com entrada á direita<br />
( BYTE , WORD , DWORD )<br />
LD in<br />
SHR n<br />
ST out<br />
LD in<br />
ROL n<br />
ST out<br />
LD in<br />
ROR n<br />
ST out<br />
out:= SHR (in,n);<br />
out:= ROL (in,n);<br />
out:= ROR (in.n);<br />
SELECÇÃO IL ST LD<br />
SEL - Selector binário LD TRUE<br />
SEL in1,in2<br />
ST out<br />
out:=SEL(g,in1,in2);<br />
MAX - Selecção do<br />
maior dado<br />
MIN - Selecção do<br />
menor dado<br />
LD in1<br />
MAX in2<br />
MAX in3<br />
ST out<br />
LD in1<br />
MIN in2,in3<br />
ST out<br />
out:=MAX (in1,in2,in3);<br />
out:=MIN(in1,in2,in3);<br />
<strong>BRESIMAR</strong> Anexo A – 4 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
LIMIT - Selecção de<br />
limites<br />
LD min<br />
LIMIT in , max<br />
ST out<br />
out:=LIMIT(min,in,max);<br />
MUX - Multiplexador<br />
LD k<br />
MUX<br />
in0,in1,in2,<br />
In3,in4<br />
ST out<br />
out:=MUX(K,in0,in1,in2,in3,in4)<br />
;<br />
COMPARAÇÃO IL ST LD<br />
GT – “>” (maior que) LD in1<br />
GT in2<br />
ST out<br />
out:= in1 > in2;<br />
LT – “=” (maior ou<br />
igual a)<br />
LE – “= in2;<br />
out:= in1
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
SINT_TO_tipo<br />
(16 conversões)<br />
INT_TO_tipo<br />
(16 conversões)<br />
DINT_TO_tipo<br />
(16 conversões)<br />
REAL_TO_tipo<br />
(16 conversões)<br />
LREAL_TO_tipo<br />
(16 conversões)<br />
STRING_TO_tipo<br />
(16 conversões)<br />
TIME_TO_tipo<br />
(16 conversões)<br />
TOD_TO_tipo<br />
(16 conversões)<br />
“TIME_OF_DAY”<br />
DATE_TO_tipo<br />
(16 conversões)<br />
DT_TO_tipo<br />
(16 conversões)<br />
“DATE_AND_TIME”<br />
TRUNC – Truncar<br />
variável<br />
LD in<br />
SINT_ TO_USINT<br />
ST out<br />
LD in<br />
INT_ TO_USINT<br />
ST out<br />
LD in<br />
DINT_ TO_USINT<br />
ST out<br />
LD in<br />
REAL_ TO_USINT<br />
ST out<br />
LD in<br />
LREAL_ TO_USINT<br />
ST out<br />
LD in<br />
STRING_TO_USINT<br />
ST out<br />
LD in<br />
TIME_ TO_USINT<br />
ST out<br />
LD in<br />
TOD_ TO_UINT<br />
ST out<br />
LD in<br />
DATE_TO_UINT<br />
ST out<br />
LD in<br />
DT_TO_UINT<br />
ST out<br />
LD in<br />
TRUNC<br />
ST out<br />
out:=SINT_TO_USINT(in);<br />
out:=INT_TO_USINT(in);<br />
out:=DINT_TO_USINT(in);<br />
out:=REAL_TO_USINT(in);<br />
out:=LREAL_TO_USINT(in);<br />
out:=STRING_TO_USINT(in);<br />
out:=TIME_TO_USINT(in);<br />
out:=TOD_TO_UINT(in);<br />
out:=DATE_TO_UINT(in);<br />
out:=DT_TO_UINT(in);<br />
out:=TRUNC(in);<br />
VÁRIAS IL ST LD<br />
INDEXOF – index<br />
interno do POU<br />
LD in<br />
INDEXOF<br />
ST out<br />
out:=INDEXOF(in);<br />
SIZEOF – nº de<br />
“bytes” da variável<br />
ADR – endereço<br />
absoluto da variável<br />
^ – indicação de<br />
ponteiro<br />
BITADR – endereço do<br />
bit na variável<br />
LD in<br />
SIZEOF<br />
ST out<br />
LD in<br />
BITADR<br />
ST out<br />
out:=SIZEOF(in);<br />
pt:POINTER TO INT<br />
var_int1:INT;<br />
var_int2:INT;<br />
pt:=ADR(var_int1);<br />
var_int2:=pt^;<br />
out:=BITADR(in);<br />
<strong>BRESIMAR</strong> Anexo A – 6 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
CAL – chamada de uma<br />
função bloco<br />
2 – RESUMO DAS FUNÇÕES BLOCO “STANDARD”<br />
BIESTAVEL IL ST LD<br />
RS – Biestavel com<br />
RESET prioritário<br />
CAL rs1<br />
(SET := in1,<br />
RESET1 :=<br />
in2)<br />
LD rs1.Q1<br />
rs1(SET:=in1 , RESET1:=in2 ,<br />
Q1=> out1);<br />
SR – Biestavel com<br />
SET prioritário<br />
SEMA – Função<br />
semáforo<br />
ST out1<br />
LD in1<br />
ST sr1.SET1<br />
CAL sr1<br />
(RESET:=in2)<br />
LD rs1.Q1<br />
ST out1<br />
CAL sema1<br />
(CLAIM:=in1,<br />
RELEASE:=in<br />
2,<br />
BUSY=>out1)<br />
sr1(SET1:=in1 , RESET:=in2 ,<br />
Q1=> out1);<br />
sema1(CLAIM:=in1,RESET:=in<br />
2,BUSY=>out1);<br />
”TRIGGER” IL ST LD<br />
F_TRIG –<br />
Accionamento pelo<br />
CAL ftrig1<br />
(CLK := in1)<br />
ftrig1(CLK:=in1 , Q=>out1 );<br />
flanco descendente<br />
LD ftrig1.Q<br />
R_TRIG –<br />
Accionamento pelo<br />
flanco ascendente<br />
ST out1<br />
CAL rtrig1<br />
(CLK := in1)<br />
LD<br />
ST<br />
rtrig1.Q<br />
out1<br />
rtrig1(CLK:=in1 , Q=>out1 );<br />
TEMPORIZADORES IL ST LD<br />
TOF – Temporizado ao<br />
repouso<br />
CAL tof1<br />
(IN := in1 ,<br />
PT := T#2s ,<br />
Q=>out1 ,<br />
ET=>tempor)<br />
tof1(IN:=in1 , PT:=T#2s ,<br />
Q=>out1 , ET=>tempor );<br />
LD tof1.Q<br />
ST out1<br />
LD tof1.ET<br />
ST tempor<br />
TON – Temporizado<br />
ao trabalho<br />
CAL ton1<br />
(IN := in1 ,<br />
PT := T#4s ,<br />
Q=>out1 ,<br />
ET=>tempor)<br />
ton1(IN:=in1 , PT:=T#4s ,<br />
Q=>out1 , ET=>tempor );<br />
<strong>BRESIMAR</strong> Anexo A – 7 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
TP – Temporizado ao<br />
trabalho por impulso<br />
CAL tp1<br />
(IN := in1,<br />
PT:=T#6000ms<br />
)<br />
LD tp1.Q<br />
ST out1<br />
LD tp1.ET<br />
ST tempor<br />
tp1(IN:=in1, PT:=T#6s );<br />
out1:=tp1.Q;<br />
tempor:=tp1.ET;<br />
CONTADORES IL ST LD<br />
CTD – Contador<br />
decrescente<br />
CAL tof1<br />
(IN := in1 ,<br />
PT := T#2s ,<br />
Q=>out1 ,<br />
ET=>tempor)<br />
tof1(IN:=in1 , PT:=T#2s ,<br />
Q=>out1 , ET=>tempor );<br />
LD tof1.Q<br />
ST out1<br />
LD tof1.ET<br />
ST tempor<br />
CTU – Contador<br />
crescente<br />
CTUD – Contador<br />
crescente / decrescente<br />
CAL ton1<br />
(IN := in1 ,<br />
PT := T#4s ,<br />
Q=>out1 ,<br />
ET=>tempor)<br />
CAL tp1<br />
(IN := in1,<br />
PT:=T#6000ms<br />
)<br />
LD tp1.Q<br />
ST out1<br />
LD tp1.ET<br />
ST tempor<br />
ton1(IN:=in1 , PT:=T#4s ,<br />
Q=>out1 , ET=>tempor );<br />
tp1(IN:=in1, PT:=T#6s );<br />
out1:=tp1.Q;<br />
tempor:=tp1.ET;<br />
3 – RESUMO DAS FUNÇÕES “STANDARD”<br />
BIESTAVEL IL ST LD<br />
CONCAT – Combina<br />
2 “strings” .<br />
LD ‘S.’<br />
CONCAT<br />
‘WILLI’<br />
(* Resultado é ‘S.WILLI’ *)<br />
Var1:=CONCAT(‘S.’,‘WILLI’);<br />
DELETE – Apaga uma<br />
parte de um STRING a<br />
partir de uma dada<br />
posição .<br />
ST Var1<br />
LD ‘SUXYSI’<br />
DELETE 2,2<br />
ST Var1<br />
(* Resultado é ‘SYSI’ *)<br />
Var1: = DELETE (‘SUXYSI’ , 2<br />
, 2 ) ;<br />
FIND – Função de<br />
procura de uma parte<br />
(frase) dentro de um<br />
STRING .<br />
INSERT – Função de<br />
procura de uma parte<br />
(frase) dentro de um<br />
STRING .<br />
LD ‘SUXYSI’<br />
FIND ‘XY’<br />
ST Var1<br />
LD ‘SUSI’<br />
INSERT<br />
‘XY’,2<br />
ST Var1<br />
(* Resultado é 3 *)<br />
Var1: = FIND (‘SUXYSI’ , ‘XY’<br />
) ;<br />
(* Resultado é ‘SUXYSI’ *)<br />
Var1: = INSERT (‘SUSI’ , ‘XY’<br />
, 2) ;<br />
<strong>BRESIMAR</strong> Anexo A – 8 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
LEFT – Selecciona<br />
um nº caracteres de um<br />
STRING a começar pela<br />
esquerda .<br />
LEN – Calcula o<br />
tamanho de um<br />
STRING (nº de<br />
caracteres) .<br />
LD<br />
‘<strong>BRESIMAR</strong>’<br />
LEFT 2<br />
ST Var1<br />
LD<br />
‘<strong>BRESIMAR</strong>’<br />
LEN<br />
ST Var1<br />
(* Resultado é ‘BR’ *)<br />
Var1: = LEFT (‘<strong>BRESIMAR</strong>’ ,<br />
2) ;<br />
(* Resultado é 8 *)<br />
Var1: = LEN (‘<strong>BRESIMAR</strong>’ ) ;<br />
MID – Selecciona um<br />
nº caracteres de um<br />
STRING a partir de uma<br />
dada posição .<br />
LD<br />
‘<strong>BRESIMAR</strong>’<br />
MID 2 , 3<br />
ST Var1<br />
(* Resultado é ‘ES’ *)<br />
Var1: = MID (‘<strong>BRESIMAR</strong>’ , 2 ,<br />
3) ;<br />
REPLACE – Cola um<br />
STRING a partir de uma<br />
dada posição de um<br />
dado STRING e<br />
eliminando um nº de<br />
caracteres definidos .<br />
LD<br />
‘<strong>BRESIMAR</strong>’<br />
REPLACE<br />
‘ASA’ , 2, 3<br />
ST Var1<br />
(* Resultado é ‘BASAIMAR’ *)<br />
Var1: = REPLACE<br />
(‘<strong>BRESIMAR</strong>’ , ‘ASA’ , 2 , 3) ;<br />
RIGTH – Selecciona<br />
um nº caracteres de um<br />
STRING a começar pela<br />
direita .<br />
LD<br />
‘<strong>BRESIMAR</strong>’<br />
RIGTH 3<br />
ST Var1<br />
(* Resultado é ‘MAR’ *)<br />
Var1: = RIGTH (‘<strong>BRESIMAR</strong>’ ,<br />
3) ;<br />
<strong>BRESIMAR</strong> Anexo A – 9 de 10
TWINCAT PLC – Resumo de Instruções<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Anexo A – 10 de 10
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
Anexo B – LISTA DE ERROS DE COMPILAÇÃO DE PROGRAMA<br />
1 – ERROS DE COMPILAÇÃO<br />
<strong>BRESIMAR</strong> Anexo B – 1 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Anexo B – 2 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
1 – ERROS DE COMPILAÇÃO<br />
Neste capitulo encontrará as mensagens de erro ( em “italics” ) e as suas possíveis causas . Para<br />
uma melhor interpretação e como o software <strong>TwinCAT</strong> é o usado a versão inglesa , optamos em deixar a<br />
tabela na mesma língua .<br />
1.1 - CHAMADAS DE ATENÇÃO (“Warnings”)<br />
Nº men. Mensagem de atenção Possível causa<br />
1100 Unknown function<br />
'' in library.<br />
1101 Unresolved symbol<br />
''.<br />
1102 Invalid interface for<br />
symbol ''.<br />
1103 The constant ''<br />
at code address<br />
'' overwrites<br />
a 16K page boundary!<br />
1200 Task '%s', call of '%<br />
Access variables in the<br />
parameter list are not<br />
updated<br />
An external library is used. Please check, whether all<br />
functions, which are defined in the .hex file, are also defined<br />
in the .lib file.<br />
The code generator expects a POU with the name<br />
. It is not defined in the project. Define a<br />
function/program with this name.<br />
The code generator expects a function with the name<br />
and exactly one scalar input, or a program with<br />
the name and no input or output.<br />
A string constant exceeds the 16K page boundary. The<br />
system cannot handle this. It depends on the runtime system<br />
whether the problem could be avoided by an entry in the<br />
target file. Please contact the PLC manufacturer.<br />
Variables, which are only used at a function block call in the<br />
task configuration, will not be listed in the cross reference<br />
list.<br />
1300 File not found '' The file, to which the global variable object is pointing, does<br />
not exist. Please check the path.<br />
1301 Analyze-Library not<br />
found! Code for<br />
analyzation will not be<br />
generated.<br />
The analyze function is used, but the library analyzation.lib is<br />
missing. Add the in the library manager.<br />
1302 New externally<br />
referenced functions<br />
inserted. Online<br />
Change is therefore no<br />
longer possible!<br />
1400 Unknown Pragma<br />
'' is ignored!<br />
1401 The struct ''<br />
does not contain any<br />
elements.<br />
1500 Expression contains no<br />
assignment. No code<br />
was generated.<br />
1501 String constant passed<br />
as 'VAR_IN_OUT':<br />
'' must not be<br />
overwritten!<br />
1502 Variable '' has<br />
the same name as a<br />
POU. The POU will not<br />
be called!<br />
Since the last download you have linked a library containing<br />
functions which are not yet referenced in the runtime system.<br />
For this reason you have to download the complete project.<br />
This pragma is not supported by the compiler. See keyword<br />
‘pragma’ for supported directives.<br />
The structure with name does not contain any<br />
elements. But Variables of this type will use 1 Byte of<br />
memory.<br />
The result of this expression is not used. For this reason<br />
there is no code generated for the whole expression.<br />
The constant may not be written within the POU, because<br />
there no size check is possible.<br />
A variable is used, which has the same name<br />
Example:<br />
PROGRAM a<br />
...<br />
VAR_GLOBAL<br />
a: INT;<br />
END_VAR<br />
...<br />
a; (* Not POU a is called but variable a is loaded.. *)<br />
<strong>BRESIMAR</strong> Anexo B – 3 de 18
TWINCAT PLC – Lista de erros<br />
1503 The POU ‘’ has<br />
no outputs. Box result<br />
is set to 'TRUE'.<br />
1504 ’ (‘’):<br />
Statement may not be<br />
executed due to the<br />
evaluation of the logical<br />
expression<br />
1505 Side effect in ''!<br />
Branch is probably not<br />
executed !<br />
1506 Variable '%s' has the<br />
same name as a local<br />
action. The action will<br />
not be called!<br />
1600 Open DB unclear<br />
(generated code may<br />
be erroneous).<br />
1700 Input box without<br />
assignment.<br />
1800 (element<br />
#):<br />
Invalid watchexpression<br />
'%s'<br />
1801 ' (number): No<br />
Input on Expression<br />
'' possible<br />
1900 POU '' (main<br />
routine) is not available<br />
in the library<br />
1901 Access Variables and<br />
Variable Configurations<br />
are not saved in a<br />
library!<br />
1902 '': is no Library<br />
for the current machine<br />
type!<br />
1903 : is no valid<br />
Library<br />
BECKHOFF New Automation Technology<br />
The Output pin of a POU which has no outputs, is connected<br />
in FBD or KOP. The assignment automatically gets the value<br />
TRUE.<br />
Eventually not all branches of the logic expression will be<br />
executed. Example:<br />
IF a AND funct(TRUE) THEN<br />
If a has is FALSE then funct will not be called.<br />
The first input of the POU is FALSE, for this reason the side<br />
branch, which may come in at the second input, will not be<br />
executed.<br />
Rename the variable or the action.<br />
The original Siemens program does not tell, which POU is<br />
openend.<br />
An input box is used in CFC which has no assignment. For<br />
this no code will be generated.<br />
The visualization element contains an expression which<br />
cannot be monitored. Check variable name and placeholder<br />
replacements.<br />
In the configuration of the visualization object at field input a<br />
composed expression is used. Replace this by a single<br />
variable.<br />
The Start-POU (z.B. PLC_PRG) will not be available, when<br />
the project is used as library.<br />
Access variables and variable configuration are not stored in<br />
the library.<br />
The .obj file of the lib was generated for another device.<br />
The file does not have the format requested for the actual<br />
target.<br />
1.2 – ERROS DE COMPILAÇÃO<br />
Nº erro Mensagem de erro Possível causa<br />
3100 Code too large.<br />
Maximum size:<br />
'' Byte<br />
(K)<br />
3101 Total data too large.<br />
Maximum size:<br />
'' Byte<br />
(K)<br />
3110 Error in library file<br />
''.<br />
3111 Library '' is too<br />
large. Maximum size:<br />
64K<br />
3112 Nonrelocatable<br />
instruction in library.<br />
3113 Library code overwrites<br />
function tables.<br />
3114 Library uses more than<br />
one segment.<br />
3115 Unable to assign<br />
constant to<br />
VAR_IN_OUT.<br />
Incompatible data types .<br />
The maximum program size is exceeded. Reduce project<br />
size.<br />
Memory is exceeded. Reduce data usage of the application.<br />
The .hex file is not in INTEL Hex format.<br />
The .hex file exceeds the set maximum size.<br />
The .hex file contains a nonrelocatable instruction. The<br />
library code cannot be linked.<br />
The ranges for code and function tables are overlapping.<br />
The tables and the code in the .hex file use more than one<br />
segment.<br />
The internal pointer format for string constants cannot get<br />
converted to the internal pointer format of VAR_IN_OUT,<br />
because the data are set "near" but the string constants are<br />
set " huge" or "far". If possible change these target settings.<br />
<strong>BRESIMAR</strong> Anexo B – 4 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
3120 Current code-segment<br />
exceeds 64K.<br />
3121 POU too large." A POU<br />
may not exceed the<br />
size of 64K.<br />
3122 Initialisation too large.<br />
Maximum size: 64K<br />
3130 User-Stack too small:<br />
'' DWORD<br />
needed, ''<br />
DWORD available.<br />
3131 User-Stack too small:<br />
'' WORD<br />
needed, ''<br />
WORD available.<br />
3132 System-Stack too<br />
small: ''<br />
WORD needed,<br />
'' WORD<br />
available.<br />
3150 Parameter of<br />
function '':<br />
Cannot pass the result<br />
of a IEC-function as<br />
string parameter to a C-<br />
function.<br />
3160 Can't open library file<br />
''.<br />
3161 Library ''<br />
contains no<br />
codesegment<br />
3162 Could not resolve<br />
reference in Library<br />
''(Symbol<br />
'', Class<br />
'', Type<br />
'')<br />
3163 Unknown reference<br />
type in Library<br />
'' (Symbol<br />
'' , Class<br />
'' , Type<br />
'')<br />
3200 "%s (%d): Boolean<br />
expression to complex<br />
3201 (): A<br />
network must not result<br />
in more than 512 bytes<br />
of code<br />
3202 Stack overrun with<br />
nested<br />
string/array/structure<br />
function calls<br />
3203 Expression too complex<br />
(too many used<br />
address registers).<br />
3204 A jump exceeds 32k<br />
Bytes<br />
3205 Internal Error: Too<br />
many constant strings"<br />
In a POU there at the<br />
most 3000 string<br />
constants may be used.<br />
3206 Function block data<br />
exceeds maximal size<br />
The currently generated code is bigger than 64K. Eventually<br />
to much initializing code is created.<br />
A POU may not exceed the size of 64K.<br />
The initialization code for a function or a structure POU may<br />
not exceed 64K.<br />
The nesting depth of the POU calls is to big. Enter a higher<br />
stack size in the target settings or compile build project<br />
without option ‚Debug’ (can be set in dialog ‘Project’<br />
‘Options’ ‘Build’).<br />
Please contact the PLC manufacturer.<br />
Please contact the PLC manufacturer.<br />
Use a intermediate variable, to which the result of the IEC<br />
function is assigned.<br />
A library is included in the library manager for this<br />
project, but the library file does not exist at the given path.<br />
A .obj file of a library at least must contain one C function.<br />
Insert a dummy function in the .obj file, which is not defined<br />
in the .lib file.<br />
The .obj file contains a not resolvable reference to another<br />
symbol. Please check the settings of the C-Compiler.<br />
The .obj file contains a reference type, which is not<br />
resolvable by the code generator. Please check -the settings<br />
of the C-Compiler.<br />
The temporary memory of the target system is insufficient for<br />
the size of the expression. Divide up the expression into<br />
several partial expressions thereby using assignments to<br />
intermediate variables.<br />
Internal jumps can not be resolved. Activate option "Use 16<br />
bit Sprungoffsets" in the 68k target settings.<br />
A nested function call CONCAT(x, f(i)) is used. This can lead<br />
to data loss. Divide up the call into two expressions.<br />
Divide up the assignment in several expressions.<br />
Jump distances may not be bigger than 32767 bytes.<br />
In a POU there at the most 3000 string constants may be<br />
used.<br />
A function block may produce maximum 32767 Bytes of<br />
code.<br />
3207 Array optimization The optimization of the array accesses failed because during<br />
<strong>BRESIMAR</strong> Anexo B – 5 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
3208 Conversion not<br />
implemented yet<br />
3209 Operator not<br />
implemented<br />
3210 Function '' not<br />
found<br />
3211 Max string usage<br />
exceeded<br />
3250 Real not supported for<br />
8 Bit Controller<br />
3251 date of day types are<br />
not supported for 8 Bit<br />
Controller<br />
3252 size of stack exceeds<br />
bytes<br />
3253 Could not find hex file:<br />
''<br />
3254 Call to external library<br />
function could not be<br />
resolved.<br />
3400 An error occurred<br />
during import of Access<br />
variables<br />
3401 An error occurred<br />
during import of<br />
variable configuration<br />
3402 An error occurred<br />
during import of global<br />
variables<br />
3403 Could not import<br />
<br />
3404 An error occurred<br />
during import of task<br />
configuration<br />
3405 An error occurred<br />
during import of PLC<br />
configuration<br />
3406 Two steps with the<br />
name '
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
points to an used<br />
memory!<br />
3455 Error during load: GSD-<br />
File '' could not<br />
be found, but is<br />
referenced in hardware<br />
configuration!<br />
3456 The profibus device<br />
'' couldn't be<br />
created!<br />
3457 Error in module<br />
description!<br />
3500 No 'VAR_CONFIG' for<br />
''<br />
3501 No address in<br />
'VAR_CONFIG' for<br />
''.<br />
3502 Wrong data type for<br />
'' in 'VAR_CONFIG<br />
3503 Wrong data type for<br />
'' in 'VAR_CONFIG'<br />
3504 Initial values are not<br />
supported for<br />
'VAR_CONFIG<br />
3505 '’is no valid<br />
dialog ‚Settings’ of the PLC configuration and an overlap has<br />
been detected. Regard, that the area check is based on the<br />
size which results of the data types of the modules, the size<br />
which is given by the entry ‚size’ in the configuration file.<br />
Eventually the device file required by the Profibus<br />
configuration is not in the correct directory. . Check the<br />
directory setting for configuration files in ‚Project' 'Options'<br />
'Directories'.<br />
The device file for module does not fit to the current<br />
configuration. Eventually it has been modified since the<br />
configuration has been set up or it is corrupted.<br />
Please check the device file of this module.<br />
Insert a declaration for this variable in the global variable list<br />
which contains the 'Variable_Configuration'.<br />
Assign an address to this variable in the global variable list<br />
which contains the 'Variable_Configuration'.<br />
In the global variables list which contains the‚<br />
‘Variable_Configuration’ the variable is declared with a<br />
different data type than in the POU.<br />
In the global variables list which contains the‚<br />
’Variable_Configuration’ the variable is declared with a<br />
different address than in the POU.<br />
A variable of the ‚Variable_Configuration’ is declared with<br />
address and initial value. But an initial value can only be<br />
defined for input variables without address assignment.<br />
The Variable_Configuration contains a nonexisting variable.<br />
instance path<br />
3506 Access path expected In the global variable list for Access Variables the access<br />
path for a variable is not correct. Correct:<br />
:'': <br />
3507 No address<br />
specification for<br />
'VAR_ACCESS'-<br />
variables<br />
3550 Duplicate definition of<br />
identifier ''<br />
3551 The task '' must<br />
contain at least one<br />
program call<br />
3552 Event variable<br />
'' in task '%s'<br />
not defined<br />
3553 "Event variable<br />
'' in task '%s'<br />
must be of type 'BOOL'<br />
3554 Task entry ''<br />
must be a program or<br />
global function block<br />
instance<br />
3555 The task entry<br />
'' contains<br />
invalid parameters<br />
The global variable list for Access Variables contains an<br />
address assignment for a variable. This is not allowed. Valid<br />
variable definition: :'':<br />
<br />
There are two tasks are defined with an identic same name.<br />
Rename one of them.<br />
Insert a program call or delete task.<br />
There is an event variable set in the ‘Single’ field of the task<br />
properties dialog which is not declared globally in the project.<br />
Use another variable or define the variable globally.<br />
Use a variable of type BOOL as event variable in the ‘Single’<br />
field of the task properties dialog.<br />
In the field ‚Program call’ a function or a not defined POU is<br />
entered. Enter a valid program name.<br />
In the field ‚Append program call’ there are parameters used<br />
which do not comply with the declaration of the program<br />
POU.<br />
Use command ‚Rebuild all’. If nevertheless you get the error<br />
3600 Implicit variables not<br />
found!<br />
message again please contact the PLC manufacturer.<br />
3601 is a reserved The given variable is declared in the project, although it is<br />
variable name<br />
reserved for the codegenerator. Rename the variable.<br />
3610 '' not supported The given feature is not supported by the current version of<br />
the programming system.<br />
3611 The given compile There is an invalid directory given in the ‚Project’ ‚Options’<br />
directory '' is ‚Directories’ for the Compile files.<br />
invalid<br />
3612 Maximum number of<br />
POUs ()<br />
exceeded! Compile is<br />
aborted.<br />
Too many POUs and data types are used in the project.<br />
Modify the maximum number of POUs in the Target<br />
Settings / Memory Layout.<br />
<strong>BRESIMAR</strong> Anexo B – 7 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
3613 Build canceled The compile process was cancelled by the user.<br />
3614 Project must contain a<br />
POU named<br />
'' (main routine)<br />
or a task configuration<br />
Create an init POU of type Program (e.g. PLC_PRG) or set<br />
up a task configuration.<br />
3615 (main routine)<br />
must be of type<br />
program<br />
3616 Programs musn't be<br />
implemented in external<br />
libraries<br />
A init POU (e.g. PLC_PRG) is used in the project which is<br />
not of type Program.<br />
The project which should be saved as an external library<br />
contains a program. This will not be available, when the<br />
library will be used.<br />
3617 Out of memory Increase the virtual memory capacity of your computer.<br />
3618 BitAccess not<br />
supported in current<br />
code generator!<br />
3700 POU with name<br />
‘' is already in<br />
library ''<br />
The code generator for the currently set target system does<br />
not support bit access on variables.<br />
A POU name is used in the project, which is already used for<br />
a library POU. Rename the POU.<br />
3701 Name used in interface<br />
is not identical with<br />
POU Name<br />
Use command ‘Project’ ‘Rename object’ to rename the POU<br />
in the object organizer, or change the name of the POU in<br />
the declaration window. There the POU name has to be<br />
placed next to one of the keywords PROGRAM, FUNCTION<br />
or FUNCTIONBLOCK.<br />
3702 Overflow of identifier list Maximum 100 identifiers can be entered in one variable<br />
3703 Duplicate definition of<br />
identifier ''<br />
3905 data recursion:<br />
-> -<br />
> .. -> <br />
3720 Address expected after<br />
'AT'<br />
3721 Only 'VAR' and<br />
'VAR_GLOBAL' can be<br />
located to addresses<br />
3722 Only 'BOOL' variables<br />
allowed on bit<br />
addresses<br />
3729 Invalid type '' at<br />
address: ''<br />
declaration.<br />
Take care that there is only one identifier with the given<br />
name in the declaration part of the POU.<br />
A FB instance was used, which needs itself.<br />
Add a valid address after the keyword AT or modify the<br />
keyword.<br />
Put the declaration to a VAR or VAR_GLOBAL declaration<br />
area.<br />
Modify the address or modify the type of the variable to<br />
which the address is assigned.<br />
The type of this variable cannot be placed on the given<br />
address. Example: For a target system working with<br />
‘alignment 2’ the following declaration is not valid: var1 AT %<br />
IB1:WORD;<br />
3740 Invalid type: '' An invalid data type is used in a variable declaration.<br />
3741 Expecting type<br />
specification<br />
3742 Enumeration value<br />
expected<br />
3743 Integer number<br />
expected<br />
3744 Enum constant<br />
'' already<br />
defined.<br />
A keyword or an operator is used instead of a valid type<br />
identifier.<br />
In the definition of the enumeration type an identifier is<br />
missing after the opening bracket or after a comma between<br />
the brackets.<br />
Enumerations can only be initialized with numbers of type<br />
INT.<br />
Check if you have followed the following rules for the<br />
definition of enumeration values:<br />
- Within one enum definition all values have to be unique.<br />
- Within all global enum definitions all values have to be<br />
unique.<br />
- Within all local enum definitions all values have to be<br />
unique<br />
3745 Subranges are only<br />
allowed on Integers!<br />
Subrange types can only be defined resting on integer data<br />
types.<br />
3746 Subrange '' is<br />
not compatible with<br />
One of the limits set for the range of the subrange type is out<br />
of the range which is valid for the base type.<br />
Type ''<br />
3747 unknown string length:<br />
''<br />
There is a not valid constant used for the definition of the<br />
string length.<br />
3748 More than three<br />
dimensions are not<br />
allowed for arrays<br />
More than the allowed three dimensions are given in the<br />
definition of an array. If applicable use an ARRAY OF<br />
ARRAY.<br />
3749 lower bound '' There is a not defined constant used to define the lower limit<br />
<strong>BRESIMAR</strong> Anexo B – 8 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
not defined<br />
supported in current<br />
code generator!<br />
3700 POU with name<br />
‘' is already in<br />
library ''<br />
3701 Name used in interface<br />
is not identical with<br />
POU Name<br />
for a subrange or array type.<br />
not support bit access on variables.<br />
A POU name is used in the project, which is already used for<br />
a library POU. Rename the POU.<br />
Use command ‘Project’ ‘Rename object’ to rename the POU<br />
in the object organizer, or change the name of the POU in<br />
the declaration window. There the POU name has to be<br />
placed next to one of the keywords PROGRAM, FUNCTION<br />
or FUNCTIONBLOCK.<br />
3702 Overflow of identifier list Maximum 100 identifiers can be entered in one variable<br />
3703 Duplicate definition of<br />
identifier ''<br />
3905 data recursion:<br />
-> -<br />
> .. -> <br />
3720 Address expected after<br />
'AT'<br />
3721 Only 'VAR' and<br />
'VAR_GLOBAL' can be<br />
located to addresses<br />
3722 Only 'BOOL' variables<br />
allowed on bit<br />
addresses<br />
3729 Invalid type '' at<br />
address: ''<br />
declaration.<br />
Take care that there is only one identifier with the given<br />
name in the declaration part of the POU.<br />
A FB instance was used, which needs itself.<br />
Add a valid address after the keyword AT or modify the<br />
keyword.<br />
Put the declaration to a VAR or VAR_GLOBAL declaration<br />
area.<br />
Modify the address or modify the type of the variable to<br />
which the address is assigned.<br />
The type of this variable cannot be placed on the given<br />
address. Example: For a target system working with<br />
‘alignment 2’ the following declaration is not valid: var1 AT %<br />
IB1:WORD;<br />
3740 Invalid type: '' An invalid data type is used in a variable declaration.<br />
3741 Expecting type<br />
specification<br />
3742 Enumeration value<br />
expected<br />
3743 Integer number<br />
expected<br />
3744 Enum constant<br />
'' already<br />
defined.<br />
A keyword or an operator is used instead of a valid type<br />
identifier.<br />
In the definition of the enumeration type an identifier is<br />
missing after the opening bracket or after a comma between<br />
the brackets.<br />
Enumerations can only be initialized with numbers of type<br />
INT.<br />
Check if you have followed the following rules for the<br />
definition of enumeration values:<br />
- Within one enum definition all values have to be unique.<br />
- Within all global enum definitions all values have to be<br />
unique.<br />
- Within all local enum definitions all values have to be<br />
unique<br />
3745 Subranges are only<br />
allowed on Integers!<br />
Subrange types can only be defined resting on integer data<br />
types.<br />
3746 Subrange '' is<br />
not compatible with<br />
One of the limits set for the range of the subrange type is out<br />
of the range which is valid for the base type.<br />
Type ''<br />
3747 unknown string length:<br />
''<br />
There is a not valid constant used for the definition of the<br />
string length.<br />
3748 More than three<br />
dimensions are not<br />
allowed for arrays<br />
More than the allowed three dimensions are given in the<br />
definition of an array. If applicable use an ARRAY OF<br />
ARRAY.<br />
3749 lower bound ''<br />
not defined<br />
There is a not defined constant used to define the lower limit<br />
for a subrange or array type.<br />
3903 Invalid duration<br />
constant<br />
The notation of the constant does not comply with the<br />
IEC61131-3 format.<br />
3904 Overflow in duration<br />
constant.<br />
The value used for the time constant cannot be represented<br />
in the internal format. The maximum value which is<br />
representable is t#49d17h2m47s295ms<br />
3905 Invalid date constant The notation of the constant dies not comply with the<br />
IEC61131-3 format.<br />
3906 Invalid time of day<br />
constant<br />
The notation of the constant dies not comply with the<br />
IEC61131-3 format.<br />
3907 Invalid date and time<br />
constant<br />
The notation of the constant dies not comply with the<br />
IEC61131-3 format.<br />
<strong>BRESIMAR</strong> Anexo B – 9 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
3908 Invalid string constant The string constant contains an invalid character.<br />
4000 Identifier expected Enter a valid identifier at this position.<br />
4001 Variable '' not Declare variable local or global.<br />
declared<br />
4010 Type mismatch: Cannot<br />
convert '' to<br />
''.<br />
Check what data type the operator expects (Browse Online<br />
Help for name of operator) and change the type of the<br />
variable which has caused the error, or select another<br />
4011 Type mismatch in<br />
parameter '' of<br />
'': Cannot<br />
convert '' to<br />
''.<br />
4012 Type mismatch in<br />
parameter '' of<br />
'': Cannot<br />
convert '' to<br />
''.<br />
4013 Type mismatch in<br />
output '' of<br />
'': Cannot<br />
convert '' to<br />
''.<br />
4014 Typed literal: Cannot<br />
convert '' to<br />
'<br />
4015 Data type ‘'<br />
illegal for direct bit<br />
access<br />
4016 Bit index ''<br />
out of range for variable<br />
of type '<br />
4017 'MOD' is not defined for<br />
'REAL<br />
4020 Variable with write<br />
access or direct<br />
address required for<br />
'ST', 'STN', 'S', 'R'<br />
4021 No write access to<br />
variable '%s' allowed<br />
variable.<br />
The data type of the actual parameter cannot be<br />
automatically converted to that of the formal parameter. Use<br />
a type conversion or use another variable type.<br />
A value with the invalid type is assigned to the input<br />
variable ''. Replace the variable or constant to one of<br />
type or use a type conversion respectively a<br />
constant with type-prefix.<br />
A value with the invalid type is assigned to the<br />
output variable ''. Replace the variable or constant to<br />
one of type or use a type conversion respectively a<br />
constant with type-prefix.<br />
The type of the constant is not compatible with the type of<br />
the prefix. Example: SINT#255<br />
Direct bit addressing is only allowed for Integer- and Bitstring<br />
data types. You are using a variable var1 of type<br />
REAL/LREAL or a constant in bit access ..<br />
You are trying to access a bit which is not defined for the<br />
data type of the variable.<br />
The operator MOD can only be used for integer and bitstring<br />
data types.<br />
Replace the first operand by a variable with write access.<br />
Replace the variable by a variable with write access.<br />
4022 Operand expected Add an operand behind the command.<br />
4023 Number expected after Enter a digit.<br />
'+' or '-'<br />
4024 or<br />
or ...<br />
expected before<br />
''<br />
Enter a valid operand at the named position.<br />
4025 ':=' or '=>' expected<br />
before ''<br />
4026 'BITADR' expects a bit<br />
address or a variable<br />
on a bit address<br />
4027 Integer number or<br />
symbolic constant<br />
expected<br />
4028 'INI' operator needs<br />
function block instance<br />
or data unit type<br />
instance<br />
4029 Nested calls of the<br />
same function are not<br />
possible.<br />
4030 Expressions and<br />
constants are not<br />
allowed as operands of<br />
'ADR'<br />
4031 'ADR' is not allowed on<br />
bits! Use 'BITADR'<br />
Enter one of the both operators at the named position.<br />
Use a valid bit address (e.g. %IX0.1).<br />
Enter a integer number or the identifier of a valid constant.<br />
Check the data type of the variable, for which the INI<br />
operator is used.<br />
At not reentrant target systems and in simulation mode a<br />
function call may not contain a call of itself as a parameter.<br />
Example: fun1(a,fun1(b,c,d),e); Use a intermediate table.<br />
Replace the constant or the expression by a variable or a<br />
direct address.<br />
Use BITADR. Please note: The BITADR function does not<br />
return a physical memory address<br />
<strong>BRESIMAR</strong> Anexo B – 10 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
instead.<br />
4032 ’’ operands<br />
are too few for<br />
''. At least<br />
‘’ are needed<br />
4033 ’’ operands<br />
are too many for<br />
''. At least<br />
‘’ are needed<br />
Check how many operands the named operator requires and<br />
add the missing operands.<br />
Check how many operands the named operator requires and<br />
remove the surplus operands.<br />
4034 Division by 0 You are using a division by 0 in a constant expression. If you<br />
want to provocate a runtime error, use – if applicable - a<br />
variable with the value 0.<br />
4035 ADR must not be<br />
applied on 'VAR<br />
CONSTANT' if<br />
'replaced constants' is<br />
activated<br />
An address access on constants for which the direct values<br />
are used, is not possible. If applicable, deactivate the option<br />
‚Replace Constants’ in ‚Project’ ‚Options’ ‚Build’.<br />
4040 Label '' is not<br />
defined<br />
Define a label with the name or change the<br />
name to that of a defined label.<br />
4041 Duplicate definition of<br />
label ''<br />
The label '' is multiple defined in the POU. Rename<br />
the label or remove one of the definitions.<br />
4042 No more than %d<br />
labels in sequence are<br />
The number of jump labels is limited to ''. Insert a<br />
dummy instruction.<br />
allowed<br />
4043 Format of label invalid.<br />
A label must be a name<br />
The label name is not valid or the colon is missing in the<br />
definition.<br />
optionally followed by a<br />
colon.<br />
4050 POU '%s' is not defined Define a POU with the name '' using the command<br />
‘Project’ ‘Add Object’ or change '' to the name of a<br />
defined POU.<br />
4051 '%s' is no function Use instead of a function name which is defined in<br />
the project or in the libraries.<br />
4052 '%s' must be a declared Use an instance of data type '' which is defined in<br />
expected before<br />
''<br />
4025 ':=' or '=>' expected Enter one of the both operators at the named position.<br />
before ''<br />
4026 'BITADR' expects a bit Use a valid bit address (e.g. %IX0.1).<br />
address or a variable<br />
on a bit address<br />
4027 Integer number or<br />
symbolic constant<br />
Enter a integer number or the identifier of a valid constant.<br />
expected<br />
4028 'INI' operator needs<br />
function block instance<br />
or data unit type<br />
instance<br />
4029 Nested calls of the<br />
same function are not<br />
possible.<br />
4030 Expressions and<br />
constants are not<br />
allowed as operands of<br />
'ADR'<br />
4031 'ADR' is not allowed on<br />
bits! Use 'BITADR'<br />
instead.<br />
4032 ’’ operands<br />
are too few for<br />
''. At least<br />
‘’ are needed<br />
4033 ’’ operands<br />
are too many for<br />
''. At least<br />
‘’ are needed<br />
Check the data type of the variable, for which the INI<br />
operator is used.<br />
At not reentrant target systems and in simulation mode a<br />
function call may not contain a call of itself as a parameter.<br />
Example: fun1(a,fun1(b,c,d),e); Use a intermediate table.<br />
Replace the constant or the expression by a variable or a<br />
direct address.<br />
Use BITADR. Please note: The BITADR function does not<br />
return a physical memory address<br />
Check how many operands the named operator requires and<br />
add the missing operands.<br />
Check how many operands the named operator requires and<br />
remove the surplus operands.<br />
4034 Division by 0 You are using a division by 0 in a constant expression. If you<br />
want to provocate a runtime error, use – if applicable - a<br />
<strong>BRESIMAR</strong> Anexo B – 11 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
4035 ADR must not be<br />
applied on 'VAR<br />
CONSTANT' if<br />
'replaced constants' is<br />
activated<br />
4040 Label '' is not<br />
defined<br />
4041 Duplicate definition of<br />
label ''<br />
4042 No more than %d<br />
labels in sequence are<br />
allowed<br />
4043 Format of label invalid.<br />
A label must be a name<br />
optionally followed by a<br />
colon.<br />
variable with the value 0.<br />
An address access on constants for which the direct values<br />
are used, is not possible. If applicable, deactivate the option<br />
‚Replace Constants’ in ‚Project’ ‚Options’ ‚Build’.<br />
Define a label with the name or change the<br />
name to that of a defined label.<br />
The label '' is multiple defined in the POU. Rename<br />
the label or remove one of the definitions.<br />
The number of jump labels is limited to ''. Insert a<br />
dummy instruction.<br />
The label name is not valid or the colon is missing in the<br />
definition.<br />
4050 POU '%s' is not defined Define a POU with the name '' using the command<br />
‘Project’ ‘Add Object’ or change '' to the name of a<br />
defined POU.<br />
4051 '%s' is no function Use instead of a function name which is defined in<br />
the project or in the libraries.<br />
4052 '%s' must be a declared Use an instance of data type '' which is defined in<br />
4202 Unexpected end of text Insert a closing bracket after the text.<br />
in brackets<br />
4203 in brackets not The operator is not valid in a IL bracket expression.<br />
allowed<br />
4204 Closing bracket with no<br />
corresponding opening<br />
bracket<br />
4205 No comma allowed<br />
after ')'<br />
4206 Label in brackets not<br />
allowed<br />
4207 'N' modifier requires<br />
operand of type<br />
'BOOL', 'BYTE',<br />
'WORD' or 'DWORD'<br />
4208 Conditional Operator<br />
requires type 'BOOL'<br />
4209 Function name not<br />
allowed here<br />
4210 'CAL', 'CALC' and<br />
'CALN' require a<br />
function block instance<br />
as operand<br />
4211 Comments are only<br />
allowed at the end of<br />
line in IL<br />
4212 Accumulator is invalid<br />
before conditional<br />
statement<br />
4213 'S' and 'R' require<br />
'BOOL' operand<br />
4250 Another 'ST' statement<br />
or end of POU<br />
expected<br />
4251 Too many parameters<br />
in function '%s'<br />
4252 Too few parameters in<br />
function '%s'<br />
4253 'IF' or 'ELSIF' require<br />
'BOOL' expression as<br />
condition<br />
4254 'WHILE' requires<br />
'BOOL' expression as<br />
condition<br />
(not valid are: 'JMP', 'RET', 'CAL', 'LDN', 'LD', 'TIME')<br />
Insert an opening bracket or remove the closing one.<br />
Remove comma after closing bracket.<br />
Shift jump label so that it is outside of the brackets.<br />
The N modifier requires a data type, for which a boolean<br />
negation can be executed.<br />
Make sure that the expression gives out a boolean result or<br />
use a type conversion.<br />
Replace the function call by a variable or a constant.<br />
Declare an instance of the function block which you want to<br />
call.<br />
Shift the comment to the end of the line or to an extra line.<br />
The accu is not defined. This happens if an instruction is<br />
preceeding which does not submit a result (e.g. 'CAL').<br />
Use a boolean variable at this place.<br />
The line does not start with a valid ST instruction.<br />
There are more parameters given than are declared in the<br />
definition of the function.<br />
There are less parameters given than are declared in the<br />
definition of the function.<br />
Make sure that the condition for IF or ELSIF is a boolean<br />
expression.<br />
Make sure that the condition following the ‘WHILE’ is a<br />
boolean expression.<br />
4255 'UNTIL' requires 'BOOL' Make sure that the condition following the ‘UNTIL’ is a<br />
<strong>BRESIMAR</strong> Anexo B – 12 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
expression as condition boolean expression.<br />
4256 'NOT' requires 'BOOL'<br />
operand<br />
Make sure that the condition following the ‘NOT’ is a boolean<br />
expression.<br />
4257 Variable of 'FOR'<br />
statement must be of<br />
Make sure that the counter variable is of an integer or<br />
bitstring data type (e.g. DINT, DWORD).<br />
type 'INT'<br />
4258 Expression in 'FOR' Replace the counter variable by a variable with write access.<br />
statement is no variable<br />
with write access<br />
4259 Start value in 'FOR'<br />
statement is no variable<br />
The start value in the ‚FOR' instruction must be compatible<br />
to the type of the counter variable.<br />
with write access<br />
4260 End value of 'FOR'<br />
statement must be of<br />
The end value in the ‚FOR' instruction must be compatible to<br />
the type of the counter variable.<br />
type 'INT'<br />
4261 Increment value of<br />
'FOR' statement must<br />
The incremental value in the ‚FOR' instruction must be<br />
compatible to the type of the counter variable.<br />
be of type 'INT'<br />
4262 'EXIT' outside a loop Use 'EXIT' only within 'FOR', 'WHILE' or 'UNTIL' instructions.<br />
4263 Expecting Number,<br />
'ELSE' or 'END_CASE'<br />
Within a ‘CASE' expression you only can use a number or a<br />
'ELSE' instruction or the ending instruction 'END_CASE'.<br />
4264 'CASE' requires<br />
selector of an integer<br />
Make sure that the selector is of an integer or bitstring data<br />
type (e.g. DINT, DWORD).<br />
type<br />
4265 Number expected after ',' In the enumeration of the CASE selectors there must be<br />
inserted a further selector after a comma.<br />
4266 At least one statement Insert an instruction, at least a semicolon.<br />
is required<br />
4267 Function block call<br />
requires function block<br />
instance<br />
The identifier in the functionblock call is no instance. Declare<br />
an instance of the desired functionblock or use the name of<br />
an already defined instance.<br />
4268 Expression expected Insert an impression here.<br />
4269 'END_CASE' expected<br />
after 'ELSE'-branch<br />
Terminate the 'CASE' instruction after the 'ELSE' part with an<br />
'END_CASE'.<br />
4270 'CASE' constant '%ld'<br />
already used<br />
A 'CASE' selector may only be used once within a ‘CASE'<br />
instruction.<br />
4271 The lower border of the<br />
range is greater than<br />
the upper border.<br />
Modify the area bounds for the selectors so that the lower<br />
border is not highte than the upper border.<br />
4272 Exptecting parameter<br />
'%s' at place %d in call<br />
of '%s'!<br />
4273 Parts of the 'CASE'-<br />
Range '%ld..%ld'<br />
already used in Range<br />
'%ld..%ld'<br />
4274 Multiple 'ELSE' branch<br />
in 'CASE' statement<br />
4300 Jump requires 'BOOL'<br />
You can edit a function call in that way, that also the<br />
parameter names are contained, not only the parameter<br />
values. But nevertheless the position (sequence) of the<br />
parameters must be the same as in the function definition.<br />
Make sure that the areas for the selectors which are used in<br />
the CASE instruction, don’t overlap.<br />
A CASE instruction may not contain more than one ‚ELSE'<br />
instruction.<br />
Make sure that the input for the jump respectively the<br />
as input type<br />
RETURN instruction is a boolean expression.<br />
4301 POU '%s' need exactly The number of inputs does not correspond to the number of<br />
%d inputs<br />
VAR_INPUT and VAR_IN_OUT variables which is given in<br />
the POU definition.<br />
4302 POU '%s' need exactly The number of outputs does not correspond to the number of<br />
%d outputs<br />
VAR_OUTPUT variables which is given in the POU<br />
definition.<br />
4303 '%s' is no operator Replace '' by a valid operator.<br />
4320 Non-boolean<br />
The switch signal for a contact must be a boolean<br />
expression '' expression.<br />
used with contact<br />
4321 Non-boolean<br />
expression ''<br />
used with coil<br />
4330 Expression expected at<br />
input 'EN' of the box<br />
''<br />
The output variable of a coil must be of type BOOL.<br />
Assign an input or an expression to the input EN of POU<br />
'’.<br />
4331 Expression expected at The input of the operator POU is not assigned.<br />
<strong>BRESIMAR</strong> Anexo B – 13 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
input '' of the<br />
box ''<br />
4332 Expression expected at<br />
input '' of the<br />
box ''<br />
4333 Identifier in jump<br />
expected<br />
4334 Expression expected at<br />
the input of jump<br />
4335 Expression expected at<br />
the input of the return<br />
4336 Expression expected at<br />
the input of the output<br />
4337 Identifier for input<br />
expected<br />
The input of the POU is of type VAR_IN_OUT and is not<br />
assigned.<br />
The given jump mark is not a valid identifier.<br />
Assign a boolean expression to the input of the jump. If this<br />
is TRUE, the jump will be executed.<br />
Assign a boolean expression to the input of the RETURN<br />
instruction. If this is TRUE, the jump will be executed.<br />
Assign a suitable expression to the output box.<br />
Insert a valid expression or identifier in the input box.<br />
4338 Box '%s' has no inputs To none of the inputs of the operator POU '' a valid<br />
expression is assigned.<br />
4339 Typemismatch at<br />
output: Cannot convert<br />
'' to ''.<br />
The type of the expression in the output box is not<br />
compatible to that of the expression which should be<br />
assigned to it.<br />
4340 Jump requires 'BOOL'<br />
as input type<br />
4341 Return requires 'BOOL'<br />
as input type<br />
4342 Expression expected at<br />
input 'EN' of the box<br />
''<br />
4343 Values of Constants:<br />
‘’<br />
Make sure that the input for the jump is a boolean<br />
expression.<br />
Make sure that the input for the RETURN instruction is a<br />
boolean expression.<br />
Assign a valid boolean expression to the EN input of the box.<br />
Input '' of box '' is declared as VAR_INPUT<br />
CONSTANT. But to this POU box an expression has been<br />
assigned in the dialog 'Edit Parameters' which is not type<br />
compatible.<br />
Insert a valid boolean expression after the Set resp. Reset<br />
instruction.<br />
An expression is assigned to input '' of POU box<br />
'' which is not type compatible.<br />
4344 'S' and 'R' require<br />
'BOOL' operand<br />
4345 Invalid Type for<br />
parameter '' of<br />
'': Cannot<br />
convert '' to<br />
''.<br />
4346 Not allowed to use a You can only assign an output to a variable or a direct<br />
constant as an output" address with write access.<br />
4347 'VAR_IN_OUT'<br />
To VAR_IN_OUT parameters only variables with write<br />
parameter needs<br />
access can be handed over, because these can be modified<br />
variable with write<br />
within the POU.<br />
access as input.<br />
4350 An SFC-Action can not SFC actions only can be called within the SFC POU in which<br />
be accessed from<br />
they are defined.<br />
outside!<br />
4351 Step name is no<br />
Rename the step or choose a valid identifier as step name.<br />
identifier: ''<br />
4352 Extra characters<br />
Remove the not valid characters in the step name.<br />
following valid step<br />
name:''<br />
4353 Step name duplicated: Rename one of the steps.<br />
''<br />
4354 Jump to undefined Choose an existent step name as aim of the jump resp.<br />
Step: ''<br />
insert a step with name ‚’.<br />
4355 A transition must not A transition must be a boolean expression.<br />
have any side effects<br />
(Assignments, FB-Calls<br />
etc.)<br />
4356 Jump without valid Step Use a valid identifier as aim (mark) of the jump.<br />
Name: ''<br />
4357 IEC-Library not found Check whether the library iecsfc.lib is inserted in the library<br />
manager and whether the library paths defined in ‘Project’<br />
‘Options’ ‘Paths’are correct.<br />
4358 Action not declared: '%<br />
s'.<br />
Make sure that in the object organizer the action of the IEC<br />
step is inserted below the SFC POU and that in the editor<br />
the action name is inserted in the box on the right hand of<br />
<strong>BRESIMAR</strong> Anexo B – 14 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
the qualifier.<br />
4359 Invalid Qualifier: '%s' In the box on the left hand of the action name enter a<br />
qualifier for the IEC action.<br />
4360 Time Constant<br />
expected after qualifier<br />
'%s'<br />
4361 '%s' is not the name of<br />
an action<br />
Enter next to the box on the left hand of the action name a<br />
time constant behind the qualifier.<br />
Enter next to the box on the right hand of the qualifier the<br />
name of an action or the name of a variable which is defined<br />
in the project.<br />
Insert a boolean variable or a valid action name.<br />
4362 Nonboolean expression<br />
used in action: '%s'<br />
4363 IEC-Step name already Please rename the step or the variable.<br />
used for variable:<br />
''<br />
4364 A transition must be a The result of the transition expression must be of type<br />
boolean expression BOOL.<br />
4365 Time Constant<br />
Open dialog ‚step attributes’ for the step '' and enter<br />
expected after qualifier a valid time variable or time constant<br />
''<br />
4366 The label of the parallel Enter a valid identifier next to the triangle which marks the<br />
branch is no valid<br />
jump label.<br />
identifier: ''<br />
4367 The label '' is There is already a jump label or a step with this name.<br />
already used<br />
Please rename correspondingly.<br />
4368 Action '' is used The action '' is used in the POU as well as in one or<br />
in multiple step chains, several actions of the POU.<br />
where one is containing<br />
the other!<br />
4369 Exactly one network There are used several FBD resp. LD networks for a<br />
required for a transition transition. Please reduce to 1 network.<br />
4370 Additional lines found Remove the not needed lines at the end of the transition.<br />
after correct ILtransition<br />
4371 Invalid characters<br />
Remove the not needed characters at the end of the<br />
following valid<br />
transition.<br />
expression: '<br />
4400 Import / conversion of The POU cannot be converted to IEC 61131-3 completely.<br />
POU '%s' contains<br />
errors resp. is not<br />
complete.<br />
4401 S5 time constant %lu There is no valid BCD coded time in the accu.<br />
seconds is too big<br />
(max. 9990s).<br />
4402 Direct access to I/Os Make sure that you only access variables which are defined<br />
allowed only.<br />
as input or output.<br />
4403 STEP5/7 instruction Some STEP5/7 commands are not convertable to IEC<br />
invalid or not<br />
61131-3, e.g. CPU commands like MAS.<br />
convertible to IEC<br />
61131-3.<br />
4404 STEP5/7 operand<br />
Some STEP5/7 operands are not convertable to IEC 61131-<br />
invalid or not<br />
3 respectively an operand is missing.<br />
convertible to IEC<br />
61131-3.<br />
4405 Reset of a STEP5/7 The corresponding IEC timer have no reset input.<br />
timer cannot be<br />
converted into IEC<br />
61131-3.<br />
4406 STEP5/7 Counter<br />
There is no valid BCD coded counter constant in the accu.<br />
constant out of range<br />
(max. 999).<br />
4407 STEP5 instruction not Some STEP5/7 instructions cannot be converted to IEC<br />
convertible to IEC<br />
61131-3, e.g. DUF.<br />
61131-3.<br />
4408 Bit access of timer or Special timer/counter commands are not convertable into<br />
counter words not<br />
IEC 61131-3.<br />
convertible into IEC<br />
61131-3.<br />
4409 Contents of ACCU1 or A command, which connects the both accus, cannot be<br />
<strong>BRESIMAR</strong> Anexo B – 15 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
ACCU2 undefined, not converted, because the accu values are not defined.<br />
convertible into IEC<br />
61131-3.<br />
4410 Called POU not in<br />
Import the called POU.<br />
project.<br />
4411 Error in global variable Please check the SEQ file.<br />
list.<br />
4412 Internal error no.11 Please contact the PLC manufacturer.<br />
4413 Error in format of line in<br />
data block<br />
In the code which should be imported there is an erroneous<br />
date.<br />
4414 FB/FX name missing. In the original S5D file the symbolic name of an (extended)<br />
POU is missing.<br />
4415 Instruction after block A protected POU cannot get imported<br />
end not allowed.<br />
4416 Invalid Command The S5/S7 command cannot be disassembled.<br />
4417 Comment not closed Close the comment with "*)".<br />
4418 FB/FX-Name too long The symbolic name of an (extended) POU is to long.<br />
(max. 8 characters)<br />
4419 Expected format of line Correct the line correspondingly.<br />
""(* Name: *)""<br />
4420 Name of FB/FX<br />
Check the POUs.<br />
parameter missing<br />
4421 Type of FB/FX<br />
Check the POUs.<br />
parameter invalid<br />
4422 Type of FB/FX<br />
Check the POUs.<br />
parameter missing<br />
4423 Invalid FB/FX call<br />
Check the interface of the POU.<br />
parameter<br />
4424 Warning: FB/FX for call<br />
either missing or<br />
parameters invalid or<br />
The called POU is not imported yet or is not correct or has<br />
no parameters (in the last case you can ignore the error<br />
message).<br />
has '0' parameters<br />
4425 Definition of label<br />
The aim (label) of the jump is not defined.<br />
missing<br />
4426 POU does not have a Modify the POU name.<br />
valid STEP 5 block<br />
name, e.g. PB10<br />
4427 Timer type not declared Add a declaration of the timer in the global variables list.<br />
4428 Maximum number of You may not use more than seven open brackets.<br />
open STEP5 brackets<br />
exceeded<br />
4429 Error in name of formal The parameter name may not exceed four characters.<br />
parameter<br />
4430 Type of formal<br />
parameter not IECconvertible<br />
4431 Too many<br />
'VAR_OUTPUT'<br />
parameters for a call in<br />
STEP5 STL<br />
4432 Labels within an<br />
expression are not<br />
allowed<br />
In IEC 61131-3 Timer, counter and POUs cannot be<br />
converted as formal parameters.<br />
A POU may not contain more than 16 formal parameters as<br />
outputs.<br />
In IEC 61131-3 jump labels may not be inserted at any<br />
desired position.<br />
4434 Too many labels A POU may not contain more than 100 labels.<br />
4435 After jump / call, a new After jump or call a Load command LD must follow.<br />
expression must start<br />
4436 Bit result undefined, not<br />
convertible to IEC<br />
61131-3.<br />
The command which is used by VKE cannot get converted,<br />
because the value of the VKE is not known.<br />
4437 Type of instruction and A bit command is used for a word operand or the other way<br />
operand are not<br />
round.<br />
compatible<br />
4438 No data block opened<br />
(insert instruction C DB<br />
before)<br />
Insert a „A DB“.<br />
4500 Unrecognized variable<br />
or address<br />
The watch variable is not declared within the project. By<br />
pressing you get the input assistant which lists the<br />
<strong>BRESIMAR</strong> Anexo B – 16 de 18
TWINCAT PLC – Lista de erros<br />
4501 Extra characters<br />
following valid watch<br />
expression<br />
4520 Error in Pragma: Flag<br />
expected before<br />
''!<br />
4521 Error in Pragma:<br />
Unexpected element<br />
''!<br />
4522 "flag off' pragma<br />
expected!<br />
4550 Index out of defined<br />
range : Variable OD<br />
"number>, Line .<br />
4551 Subindex out of defined<br />
range : Variable OD<br />
"number>, Line .<br />
4552 Index out of defined<br />
range : Parameter OD<br />
"number>, Line .<br />
4553 Subindex out of defined<br />
range : Parameter OD<br />
"number>, Line .<br />
4554 Variablename invalid:<br />
Variable OD ,<br />
Line .<br />
4555 Empty table-entry, input<br />
not optional: Parameter<br />
OD , Line<br />
<br />
4556 Empty table-entry, input<br />
not optional: Variable<br />
OD , Line<br />
<br />
declared variables.<br />
Remove the surplus signs.<br />
BECKHOFF New Automation Technology<br />
The pragma is not correct. Check whether ‘' is a<br />
valid flag.<br />
Check whether pragma is composed correctly.<br />
The switch off of the pragma is missing, add a 'flag off'<br />
instruction.<br />
Ensure that the index is within the area which is defined in<br />
the target settings/ networkfunctionality.<br />
Ensure that the subindex is within the area which is defined<br />
in the target settings /networkfunctionality.<br />
Ensure that the index is within the area which is defined in<br />
the target settings /networkfunctionality<br />
Ensure that the subindex is within the area which is defined<br />
in the target settings /networkfunctionality.<br />
Enter a valid project variable in the filed ‚variable’. Use the<br />
syntax . resp. for global<br />
variables .<br />
You must make an entry in this field.<br />
You must make an entry in this field.<br />
<strong>BRESIMAR</strong> Anexo B – 17 de 18
TWINCAT PLC – Lista de erros<br />
BECKHOFF New Automation Technology<br />
<strong>BRESIMAR</strong> Anexo B – 18 de 18