Вы находитесь на странице: 1из 110

2005-10-19 mpro_twcplc.pdf (v1.

0)

Beckhoff TwinCAT
The Windows Control and Automation Technology

Introdução ás instruções “standard”


do “TwinCAT PLC”
ÍNDICE

I – TIPO DE DADOS E VARIÁVEIS

I.1 – Identificadores (“Identifiers”)


I.2 – Prefixos (“Prefix”)
I.3 – Tipo de dados (“Data type”)
I.4 – Operandos (“Operands”)
I.5 – Variáveis e endereços

II – LISTA DE INSTRUÇÕES “STANDARD”

II.1 – Instruções numéricas


II.2 – Instruções aritméticas
II.3 – Instruções lógicas
II.4 – Instruções de deslocação de bit
II.5 – Instruções de selecção
II.6 – Instruções de comparação
II.7 – Instruções de conversão
II.8 – Instruções várias

III – FUNÇÕES BLOCO “STANDARD”

III.1 – Funções bloco “Standard” - Biestavel


III.2 – Funções bloco “Standard” – “Trigger”
III.3 – Funções bloco “Standard” - Temporizadores
III.4 – Funções bloco “Standard” – Contadores

IV – FUNÇÕES “STANDARD”

IV.1 – Funções “Standard” – “String”

V – EXEMPLOS PRÁTICOS

V.1 – Arranque directo de motor trifásico


V.2 – Inversão de rotação de motor trifásico
V.3 – Arranque estrela-triangulo de motor trifásico

A – RESUMO DE INSTRUÇÕES E FUNÇÕES “STANDARD”

A.1 – Resumo de instruções do “TwinCAT PLC”


A.2 – Resumo das funções bloco “standard”
A.3 – Resumo das funções “standard”

B – LISTA DE ERROS DE COMPILAÇÃO DE PROGRAMA

B.1 – Erros de compilação


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

I – TIPO DE DADOS E VARIAVEIS

1 – IDENTIFICADORES (“Identifiers”)

2– PREFIXOS (“Prefix”)

3 – TIPO DE DADOS (“Data type”)

4 – OPERANDOS (“Operands”)

5 – VARIAVEIS E ENDEREÇOS

BRESIMAR <j.andril@bresimar.pt> Cap. I – 1 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. I – 2 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

1 – IDENTIFICADORES (“Identifiers”)

Cada identificador de variáveis , funções , etc é assinalado com um tipo de dados que dita o
espaço de memoria que será reservado na CPU .
Um identificador é um nome que designa uma variável , função ou outro tipo de dados e
que deverá cumprir os seguintes requisitos :

y Começar por uma letra ou “underscore”


y Seguido por números , letras e “underscore”
y Não existe diferenças entre letras maiúsculas e minúsculas

e não serão permitidos os seguintes caracteres

y Caracteres especiais (!,“ ,*,&,$,#, etc)


y Caracteres em branco
y “Underscore” seguidos

2– PREFIXOS (“Prefix”)

Para uma melhor identificação do tipo de identificador é de boa prática colocar um


prefixo no inicio de cada nome , para uma melhor organização e clarificação do programa , tal
como é usado nas linguagens de alto nível ( Visual Basic ,etc. ) . Todavia não é obrigatório para
o bom funcionamento do programa .
As primeiras letras deverão ser o prefixo ( letras minúscula ) do identificador
seguido do nome da variável que deverá começar por uma letra maiúsculas .
Aqui vão as nossas sugestões para alguns tipos de dados :

PREFIXO TIPO de DADOS EXEMPLO


b BOOL bNomevariavelbool

by BYTE byNomevariavelbyte

w WORD wNomevariavelbool

dw DWORD dwNomevariavelbool
si SINT syNomevariavelsinteiro

i INTEGER byNomevariavelinteiro

di DINT dyNomevariaveldinteiro

r REAL wNomevariavelreal

s STRING dwNomevariavelstring

t TIME tNomevariaveltempo
tod TIME_OF_DAY todNomevariaveltempodia

dt DATE_AND_TIME dtNomevariaveldatatempo
d DATE dNomevariaveldata
pt POINTER ptNomevariavelponteiro

str STRUCT strNomevariavelestrutura

BRESIMAR <j.andril@bresimar.pt> Cap. I – 3 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

3 – TIPO DE DADOS (“Data type”)

Conforme o que foi dito inicialmente todos os identificadores sejam variáveis ou não terão
de ser assinalados com um tipo de dados que definirá o tamanho de memoria a ser reservado na
CPU .
Podemos dividir em dois grupos os tipos de dados :

y Tipo de dados ELEMENTARES .

y Tipo de dados COMPLEXOS ou ESTRUTURADOS em que


o formato dos dados é definido pelo programador .

3.1 - DADOS ELEMENTARES

Tipo Tamanho Limites


BOOL 1 bit TRUE .. FALSE
BYTE 8 bit 16#00 .. FF
WORD 16 bit 16#0000 .. FFFF
DWORD 32 bit 16#0000_0000 .. FFFF_FFFF
USINT 8 bit 0 .. 255
UINT 16 bit 0 .. 65 535
UDINT 32 bit 0 .. 4 294 967 295
SINT 8 bit -128 .. 127
INT 16 bit -32 768 .. 32 767
DINT 32 bit -2 147 483 648 .. 2 147 483 647
REAL 32 bit
LREAL 64 bit
DATE 32 bit D#1970-01-01 .. 2106-02-06
TOD 32 bit TOD# 00:00:00 .. 1193:02:47.295
DT 32 bit DT#1970-01-01-00:00 .. 2106-02-06-06:28:15

Configuração da representação do tipo de dados

<identificação> AT <formato> : <tipo> = <constante> ;

BRESIMAR <j.andril@bresimar.pt> Cap. I – 4 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

3.2 - DADOS COMPLEXOS ou ESTRUTURADOS

Tipo Configuração
ARRAY <identificação>:ARRAY
[<Linf1>..<Lsup1>,<Linf2>..<Lsup2>] OF <tipo dado> ;

POINTER <identificação>: POINTER TO <tipo dado / função bloco>;

SUBRANGE TYPE <nome subrange> :


<tipo dado> (<limite inf>..<limite sup>);
END_TYPE;
ALIAS TYPE <identificação>:
<term assinalado>;
END_TYPE

ENUM TYPE <identificação>:


(<num0> ,<num1>, ..,<num_n>);
END_TYPE

STRUCT TYPE <nome estrutura>:


STRUCT
<Declaração da variável 1> ;
.
<Declaração da variável n> ;
END_STRUCT
END_TYPE

BRESIMAR <j.andril@bresimar.pt> Cap. I – 5 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology

4 – OPERANDOS (“Operands”)
Neste paragrafo iremos apresentar num pequeno resumo , as diversas maneiras de representar dentro
do programa , constantes para cada um dos tipos (“Types”) de dados existentes no TwinCAT PLC .

4.1 - Constantes em BOOL


As constantes em BOOL são representadas por FALSE e TRUE .

4.2 - Constantes em BYTE , WORD , DWORD , INT , REAL etc


As constantes em BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT,
REAL, poderão ser representadas em binário , octal , decimal ou hexadecimal . Na representação
de um numero real a parte decimal é separada da parte inteira por um ponto (formato americano) e
não uma virgula. As constantes terão a seguinte configurações :

Exemplos em ST :
(* Representação em decimal inteiro e real *)
byConstante:= -255
iConstante:=-INT#3565 (*nº inteiro negativo)
diConstante:=DINT#199978
rConstante:=-REAL#123.89 (*nº real negativo)
rConstante:= 1895.567
rConstantee:= 1.5e+010
(* Representação em binario *)
byConstante1:= 2# 1001_1111
wConstante1:= 2# 1001_1111_0000_10101
(* Representação em octal *)
byConstante2:= 8# 77
(* Representação em hexadecimal *)
byConstante3:= 16# FF
wConstante2:= 16# FF_FF
dwConstante1:= 16# FF_FF_FF_FF

4.3 - Constantes em TIME


No TwinCAT podemos declarar constantes temporais. Geralmente são usadas na definição
do tempo nos temporizadores (Função bloco standard TON , TOF , TP) . A constante terá a seguinte
configuração :

<touTouTIMEoutime ># diadhorahminutosmsegundossmilisegms

Exemplos em ST :
(* Valores correctos *)
tTempo1:= T#14ms
tTempo2:= TIME#100s12ms
tTempo3:= t#23d12h45m3s
(* Valores incorrectos *)
tTempo4:= TIME#100m69s (*Limite excedido em seg.*)
tTempo5:= T#100ms12d (*Ordem incorrecta*)

4.4 - Constantes em DATE


Geralmente são usadas na definição de datas . A constante terá a seguinte configuração :

<douDouDATEoudate># ano-mes-dia

Exemplos em ST :
(* Valores correctos *)
dData1:= d#2005-12-01
dData2:= DATE#2000-06-02

BRESIMAR <j.andril@bresimar.pt> Cap. I – 6 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology
4.5 - Constantes em TIME OF DAY
Geralmente são usadas na definição do tempo (hora) do dia . A constante terá a seguinte
configuração :

<todouTODouTIME_OF_DAY># hora:minuto:segundo

Exemplos em ST :
(* Valores correctos *)
todTod1:= tod#15:12:10.250 (* Podemos ter fracção de seg.*)
todTod2:= TIME_OF_DAY#23:59:59

4.6 - Constantes em DATE AND TIME


Geralmente são usadas na definição da data/hora . A constante terá a seguinte configuração:

<dtouDTouDATE_AND_TIME>#ano-mes-dia-hora:minuto:segundo

Exemplos em ST :
(* Valores correctos *)
dtDT1:= dt#1972-03-29-00:00:00
dtDT2:= DATE_AND_TIME#1999-06-19-23:00:15

4.7 - Constantes em STRING


Um STRING é uma sequência de caracteres . As constantes em STRING são precedidas e
finalizadas com aspas ´. Podemos por espaços e caracteres especiais e serão tratados como qualquer
outro carácter . A combinação do símbolo $ seguido de um numero hexadecimal representa o código
de 8 bits da tabela de caracteres standard. Comandos especiais poderão ser representados por um $
seguido de outro carácter como podemos ver a seguir .

Caracteres comando Descrição


$$ Representar o sinal de dolar($)
$’ Representar o sinal de aspas(´)
$L ou $l “Line feed”
$N ou $n “New Line”
$P ou $p “Page feed”
$R ou $r “Line break”
$T ou $t “Tab”

Exemplos em ST :
(* Valores correctos *)
stTexto1:= ‘BRESIMAR(ASA)’

5 – VARIAVEIS E ENDEREÇOS
Neste paragrafo iremos apresentar num pequeno resumo as diversas maneiras de representar dentro do
programa tais como as variáveis e os endereços absolutos na memoria do “hardware” no TwinCAT .

5.1 – Variáveis
As variáveis podem ser declaradas tanto localmente , dentro do grupo de declaração dos
POU´s ou na lista das variáveis globais . O identificadores das variáveis não deverão conter espaços em
branco ou caracteres especiais como já anteriormente tínhamos dito .
Letras maiúsculas não serão reconhecidas o que significa que VAR1 , Var1 e var1 são todas a
mesma variável .
O sinal de “underscore” é reconhecido nos identificadores ( por exemplo : A_BCD e AB_CD
são duas variáveis diferentes ) .Um identificador de uma variável pode ter mais que um carácter
“underscore” numa linha .
Podemos identificar uma variável com o máximo de 32 caracteres .
Dentro do editor de programa TwinCAT , tempos acesso as variáveis através do “Input
Assistant” – “Local Variables” ou “Global Variables” ( pressionar a tecla função F2) e se desejarmos
declarar novas variáveis utilizamos o “Auto Declare” (pressionar shift+F2).

BRESIMAR <j.andril@bresimar.pt> Cap. I – 7 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology
Podemos aceder a variáveis em “ARRAYS” , “STRUCTURES” e POU´s utilizando as
seguintes configurações :

Varáveis em ARRAY ( ex. 2 dimensões)

<nome do array>[index1 , index2]

Variaveis em STRUCT

<nome da structure> . <nome da variável>

Variáveis em FUNÇÕES BLOCO ou PROGRAMAS

<nome da função bloco> . <nome da variável>

5.2 – Endereços
A indicação directa de uma posição individual de memoria ou das entradas ou saídas do
“hardware” utilizado é feito através de uma sequencia de caracteres especiais.. Esta sequencia tem a
seguinte configuração :

%<prefixodotipo><prefixodotamanho>

Prefixos do tipo de endereço

Tipo Descrição
% I Entrada (“Input”)
% O Saida (“Output”)
% M Memoria (“Memory”)

Prefixos do tamanho de endereço

Tamanho Descrição
X bit
B Byte (8 bit)
W Word (16 bit)
D Dupla word (32 bit)

Exemplos :
%QX75.1 (* Bit 1 do byte de saída 75 *)
%IW215 (* Word de entrada 125 *)
%QB7 (* Byte de saida 7 *)
%MD48 (* Dupla Word da posição de memoria 48 *)

Para acedermos a uma dada localização de memoria podemos utilizar qualquer tamanho ( bit ,
byte , Word ou duplo Word ) . Por exemplo o endereço %MD48 são os seguintes endereços no formato
byte :

%MD48 ======= > %MB192


( 48 x 4 ) %MB193
%MB194
%MB195

No mapeamento da memoria o 1º byte tem o endereço 0 (zero) .

BRESIMAR <j.andril@bresimar.pt> Cap. I – 8 de 9


TWINCAT PLC – Tipo de Dados e Variaveis BECKHOFF New Automation Technology
Podemos no TwinCAT dentro de variáveis do tipo SINT, INT, DINT, USINT, UINT,
UDINT, BYTE, WORD, DWORD , se desejarmos , aceder a bit´s individualmente . Para fazermos
isto , o índex do bit a ser endereçado é colocado como um apêndice na variável e separado por um
ponto . O índex base é o 0 ( zero) .

Exemplo :
(* Campo da declaração das variaveis *)
(* Não deve ser assinalada no campo VAR_IN_OUT *)
a: INT;
b:INT;

(* Campo no POU - Main *)


a.2 := b; (* O 3º bit da variável “a” é igual ao valor lógico de “b” *)

Se o índex é maior que o tamanho do tipo da variável escolhido surgirá a seguinte mensagem
de erro :
“ Index <n> outside the valid range for variable <var> “

Se o tipo da variável não permitir este modo de programação surgirá a seguinte mensagem de
err :
“ Invalid data type <type> for direct indexing “

BRESIMAR <j.andril@bresimar.pt> Cap. I – 9 de 9


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

IV – LISTA DE INSTRUÇÕES

1 - INSTRUÇÕES NUMÉRICAS

2 - INSTRUÇÕES ARITMÉTICAS

3 - INSTRUÇÕES LÓGICAS

4 - INSTRUÇÕES de DESLOCAÇÃO de BIT

5 - INSTRUÇÕES de SELECÇÃO

6 - INSTRUÇÕES de COMPARAÇÃO

7 - INSTRUÇÕES de CONVERSÃO

8 - INSTRUÇÕES VÁRIAS

BRESIMAR <j.andril@bresimar.pt> Cap. II – 1 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. II – 2 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

1 - INSTRUÇÕES NUMÉRICAS

ABS
Calcula o valor absoluto do numero .
IN e OUT poderão ter as seguintes combinações :
IN OUT
INT INT, REAL, WORD, DWORD, DINT
REAL REAL
BYTE INT, REAL, BYTE, WORD, DWORD, DINT
WORD INT, REAL, WORD, DWORD, DINT
DWORD REAL, DWORD, DINT
SINT REAL
USINT REAL
UINT INT, REAL, WORD, DWORD, DINT, UDINT, UINT
DINT REAL, DWORD, DINT
UDINT REAL, DWORD, DINT, UDINT

Exemplo em ST:
Var1:INT;
Var1:= ABS(-2); (*Resultado é 2)

Exemplo em IL:
LD -10
ABS
ST Var1 (* Resultado é 10*)

ACOS
Calcula o arco de co-seno (inverso de co-seno ) do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

ASIN
Calcula o arco de seno (inverso de seno ) do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

ATAN
Calcula o arco de tangente (inverso de tangente ) do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT , e OUT
deve ser do tipo REAL .

COS
Calcula o co-seno do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

EXP
Calcula o exponencial do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

BRESIMAR <j.andril@bresimar.pt> Cap. II – 3 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

EXPT
Calcula o exponencial de numero levantado a outro numero .
IN1 e IN2 pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e
OUT deve ser do tipo REAL .

Exemplo em ST:
Var1:REAL;
Var1:= EXPT(7,2); (*Resultado é 2)

Exemplo em IL:
LD 7
EXPT 2
ST Var1 (* Resultado é 49.0*)

LN
Calcula o logaritmo natural do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

LOG
Calcula o logaritmo de base 10 do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

SIN
Calcula o seno do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

SQRT
Calcula a raiz quadrada do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .

TAN
Calcula a tangente do numero .
IN pode ser do tipo BYTE WORD DWORD INT DINT REAL SINT USINT UINT UDINT e OUT
deve ser do tipo REAL .
Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 4 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

2 - INSTRUÇÕES ARITMÉTICAS
ADD
Calcula a soma aritmética de variáveis de diversos tipos : BYTE WORD DWORD SINT USINT INT
UINT DINT UDINT REAL e LREAL. Duas variáveis TIME podem ser somadas resultando um outro
TEMPO (ex. T#45s + T#50s = T#1m35s) .

Exemplo em ST:
Var1:= 7+2+4+7; (*Resultado é 20)

Exemplo em IL:
LD 7
ADD 2,4,7
ST Var1 (* Resultado é 20*)

Exemplo em FBD:

MUL
Calcula o produto aritmético de variáveis de diversos tipos : BYTE WORD DWORD SINT USINT
INT UINT DINT UDINT REAL e LREAL

Exemplo em ST:
Var1:= 7*2*4*7;

Exemplo em IL:
LD 7
MUL 2,4,7
ST Var1

Exemplo em FBD:

SUB
Calcula a subtracção aritmética de variáveis de diversos tipos : BYTE WORD DWORD SINT
USINT INT UINT DINT UDINT REAL e LREAL. Duas variáveis TIME podem ser subtraídas
resultando um outro TEMPO . Um valor TIME negativo é um valor indefinido.

Exemplo em ST:
Var1:= 7-2;

Exemplo em IL:
LD 7
SUB 2
ST Var1

Exemplo em FBD:

BRESIMAR <j.andril@bresimar.pt> Cap. II – 5 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

DIV
Calcula a divisão aritmética de variáveis de diversos tipos :BYTE WORD DWORD SINT USINT
INT UINT DINT UDINT REAL e LREAL .

Exemplo em ST:
Var1:= 7/2;

Exemplo em FBD:

Nota : Usando CheckDivByte ; CheckDivWord ; CheckDivDWord e CheckDivReal podemos verificar


o valor do divisor de maneira a evitar a divisão por zero .
MOD
Calcula o modulo de divisão (resto da divisão) de variáveis de diversos tipos : BYTE WORD
DWORD SINT USINT INT UINT DINT UDINT . Duas variáveis TIME podem ser subtraídas
resultando um outro TEMPO . Um valor TIME negativo é um valor indefinido.

Exemplo em ST:
Var1:= 9 MOD 2;

Exemplo em IL:
LD 9
MOD 2
ST Var1 (*Resultado é 1*)

Exemplo em FBD:

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 6 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

3 - INSTRUÇÕES LOGICAS
AND
Calcula o produto lógico ( “E”) de variáveis de diversos tipos : BOOL BYTE WORD DWORD .

Exemplo em ST:
Var1:= 2#1001_0011 AND 2#1000_1010;

Exemplo em IL:
Var1:BYTE;
LD 2#1001_0011
AND 2#1000_1010
ST Var1 (* Resultado é 2#1000_0010*)

Exemplo em FBD:

OR
Calcula a soma lógica ( “OU”) de variáveis de diversos tipos : BOOL BYTE WORD DWORD .

Exemplo em ST:
Var1:= 2#1001_0011 OR 2#1000_1010;

Exemplo em IL:
Var1:BYTE;
LD 2#1001_0011
OR 2#1000_1010
ST Var1 (* Resultado é 2#1001_1011*)

Exemplo em FBD:

XOR
Calcula a soma lógica exclusiva ( “OU-Exclusivo”) de variáveis de diversos tipos : BOOL BYTE
WORD DWORD .

Exemplo em ST:
Var1:= 2#1001_0011 XOR 2#1000_1010;

Exemplo em IL:
Var1:BYTE;
LD 2#1001_0011
XOR 2#1000_1010
ST Var1 (* Resultado é 2#0001_1001*)

Exemplo em FBD:

Nota : Usando mais que 2 entradas o resultado é feito aos pares .

BRESIMAR <j.andril@bresimar.pt> Cap. II – 7 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

NOT
Calcula a negação lógica (“NÃO”) de variáveis de diversos tipos: BOOL BYTE WORD DWORD .

Exemplo em ST:
Var1:= NOT 2#1000_1010;

Exemplo em IL:
Var1:BYTE;
LD 2#1001_0011
NOT
ST Var1 (* Resultado é 2#0110_1100*)

Exemplo em FBD:

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 8 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

4 - INSTRUÇÕES de DESLOCAÇÃO de BIT

SHL
Deslocação de IN em “n” bits á esquerda e preenchendo de zeros os bits á direita . A:= SHL(IN, N) .
IN e OUT serão do tipo BYTE WORLD ou DWORLD .

Exemplo em ST:

Exemplo em IL:
LD 1
SHL 1
ST Var1 (* Resultado é 2 *)

SHR
Deslocação de IN em “n” bits á direita e preenchendo de zeros os bits á esquerda . A:= SHR(IN, N) .
IN e OUT serão do tipo BYTE WORLD ou DWORLD .

Exemplo em ST:

Exemplo em IL:
LD 32
SHR 2
ST Var1 (* Resultado é 8 *)

BRESIMAR <j.andril@bresimar.pt> Cap. II – 9 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

ROL
Deslocação de IN em “n” bits á esquerda e com realimentação á direita . A:= ROL(IN, N) .
IN e OUT serão do tipo BYTE WORLD ou DWORLD .

Exemplo em ST:

Exemplo em IL:
Var1: BYTE;
LD 2#1001_0011
ROL 3
ST Var1 (* Resultado é 2#1001_1100 *)

ROR
Deslocação de IN em “n” bits á direita e com realimentação á esquerda . A:= ROR(IN, N) .
IN e OUT serão do tipo BYTE WORLD ou DWORLD .

Exemplo em ST:

Exemplo em IL:
Var1: BYTE;
LD 2#1001_0011
ROR 3
ST Var1 (* Resultado é 2#0111_0010 *)

BRESIMAR <j.andril@bresimar.pt> Cap. II – 10 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

5 - INSTRUÇÕES de SELECÇÃO
SEL
Selector binario . OUT := SEL(G, IN0, IN1) .
Significa que OUT := IN0 se G=FALSE; OUT := IN1 se G=TRUE.
IN0, IN1 e OUT pode ser de qualquer tipo de dados , G deve ser BOOL . O resultado da selecção é IN0
se G for FALSE e IN1 se G for TRUE .

Exemplo em IL:
LD TRUE
SEL 3,4
ST Var1 (* Resultado é 4 *)
ou
LD FALSE
SEL 3,4
ST Var1 (* Resultado é 3 *)

Exemplo em FBD:

MAX
Selecção do maior dado . OUT := MAX(IN0, IN1) .
IN0, IN1 e OUT pode ter qualquer tipo de dados .

Exemplo em IL:
LD 90
MAX 30
MAX 40
MAX 77
ST Var1 (* Resultado é 90 *)

Exemplo em FBD:

MIN
Selecção do menor dado . OUT := MIN(IN0, IN1) .
IN0, IN1 e OUT pode ter qualquer tipo de dados .

Exemplo em IL:
LD 90
MIN 30
MIN 40
MIN 77
ST Var1 (* Resultado é 30 *)

Exemplo em FBD:

BRESIMAR <j.andril@bresimar.pt> Cap. II – 11 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

LIMIT
Selecção de limites . OUT := LIMIT(Min, IN , Max).
Significa que MAX é o limite superior e MIN o limite inferior . Se o valor em IN ultrapassar o MAX o
valor na saída OUT será o MAX . Se o valor inferior a MIN o valor na saída OUT será MIN.
MIN, MAX, IN e OUT pode ser de qualquer tipo de dados .

Exemplo em IL:
LD 90
LIMIT 30,80
ST Var1 (* Resultado é 80 *)

MUX
Multiplexador . OUT := MUX(K, IN0,...,INn) .
Significa que o numero colocado em K indicará que o valor da entrada correspondente IN(K) será
colocada na saida OUT .
IN0, IN1, INn, OUT pode ser de qualquer tipo de dados . K deve ser BYTE, WORD, DWORD, SINT,
USINT, INT, UINT, DINT ou UDINT.

Exemplo em IL:
LD 0
MUX 30,40,50,60,70,80
ST Var1 (* Resultado é 30 *)

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 12 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

6 - INSTRUÇÕES de COMPARAÇÃO
GT
Comparação maior que (“>”) . OUT:= IN1 GT IN2 . O valor do resultado OUT será TRUE quando o
1º operando for maior que o 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,
DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 20 > 30 > 40;

Exemplo em IL:
LD 20
GT 30
ST Var1 (* Resultado é FALSE *)

Exemplo em FBD:

LT
Comparação menor que (“<”) . OUT:= IN1 LT IN2 . O valor do resultado OUT será TRUE quando o
1º operando for menor que o 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,
DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 20 < 30 < 40;

Exemplo em IL:
LD 20
LT 30
ST Var1 (* Resultado é TRUE *)

Exemplo em FBD:

GE
Comparação maior ou igual a (“>=”) . OUT:= IN1 GE IN2 . O valor do resultado OUT será TRUE
quando o 1º operando for maior ou igual ao 2º operando . Os operandos podem ser do tipo BOOL,
BYTE, WORD, DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL,
TIME, TIME_OF_DAY, DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 20 > =20;

Exemplo em IL:
LD 20
GE 20
ST Var1 (* Resultado é TRUE *)

Exemplo em FBD:

BRESIMAR <j.andril@bresimar.pt> Cap. II – 13 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

LE
Comparação menor ou igual a (“<=”) . OUT:= IN1 LE IN2 . O valor do resultado OUT será TRUE
quando o 1º operando for menor ou igual ao 2º operando . Os operandos podem se r do tipo BOOL,
BYTE, WORD, DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL,
TIME, TIME_OF_DAY, DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 20 > 30 > 40;

Exemplo em IL:
LD 20
LE 30
ST Var1 (* Resultado é TRUE *)
EQ
Comparação igual (“=”) . OUT:= IN1 EQ IN2 . O valor do resultado OUT será TRUE quando o 1º
operando for igual ao 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,
DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 20 ;

Exemplo em IL:
LD 20
EQ 20
ST Var1 (* Resultado é TRUE *)

Exemplo em FBD:

NE
Comparação não igual (“<>”) . OUT:= IN1 <> IN2 . O valor do resultado OUT será TRUE quando o
1º operando for diferente do 2º operando . Os operandos podem ser do tipo BOOL, BYTE, WORD,
DWORLD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, TIME, TIME_OF_DAY,
DATE_AND_TIME e STRING.

Exemplo em ST:
Var1:= 40 <> 40 ;

Exemplo em IL:
LD 40
NE 40
ST Var1 (* Resultado é FALSE *)

Exemplo em FBD:

BRESIMAR <j.andril@bresimar.pt> Cap. II – 14 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

7 - INSTRUÇÕES de CONVERSÃO
BOOL_TO conversão
Converte uma variável BOOL para qualquer outro tipo . Para variáveis numéricas o resultado é 1
quando o operando é TRUE e 0 quando o operando é FALSE. O resultado é “TRUE” ou “FALSE”
respectivamente para variáveis STRING.

Exemplo em ST:
i:=BOOL_TO_INT(TRUE); (* Resultado é 1 *)
str:=BOOL_TO_STRING(TRUE); (* Resultado é 'TRUE' *)
t:=BOOL_TO_TIME(TRUE); (* Resultado é T#1ms *)
tof:=BOOL_TO_TOD(TRUE); (* Resultado é TOD#00:00:00.001 *)
dat:=BOOL_TO_DATE(FALSE); (* Resultado é D#1970-01-01 *)
dandt:=BOOL_TO_DT(TRUE); (* Resultado é DT#1970-01-01-00:00:01 *)

Conversão TO BOOL
Converte qualquer tipo de variável para o tipo BOOL . O resultado é TRUE quando o operando não é
0 . O resultado é FALSE quando o operando é igual a 0 . O resultado é TRUE no tipo de variável
STRING quando o operando é “TRUE” , caso contrário o resultado é FALSE .

Exemplo em ST:
b := BYTE_TO_BOOL(2#11010101); (* Resultado é TRUE *)
b := INT_TO_BOOL(0); (* Resultado é FALSE *)
b := TIME_TO_BOOL(T#5ms); (* Resultado é TRUE *)
b := STRING_TO_BOOL('TRUE'); (* Resultado é TRUE *)

STRING_TO conversão
Converte uma variável STRING para qualquer outro tipo . O operando da variável do tipo STRING
deve conter um valor que seja valido no tipo de variável que se deseja converter , caso contrário o
resultado é 0 .

Exemplo em ST:
b :=STRING_TO_BOOL('TRUE'); (* Resultado é TRUE *)
w :=STRING_TO_WORD('abc34'); (* Resultado é 0 *)
t :=STRING_TO_TIME('T#127ms'); (* Resultado é T#127ms *)

Conversão TO STRING
Converte qualquer tipo de variável para o tipo STRING .

Exemplo em ST:
str :=TIME_TO_STRING(T#12ms); (* Resultado é 'T#12ms' *)
str :=DATE_TO_STRING(D#2002-08-18); (* Resultado é 'D#2002-08-18' *)
str:=TOD_TO_STRING(TOD#14:01:05.123); (* Resultado é 'TOD#14:01:05.123' *)
str:=BOOL_TO_STRING(TRUE); (* Resultado é 'TRUE' *)
str:=DT_TO_STRING(DT#1998-02-13-14:20); (* Resultado é 'DT#1998-02-13-14:20' *)
k := LREAL_TO_STRING(1.4); (* Resultado is '1.4' *)

TIME_TO conversão
Converte uma variável do tipo TIME para qualquer outro tipo . Os dados serão armazenados
internamente numa DWORD em milissegundos . Só depois é que este valor será convertido . Quando
ocorre uma conversão de um valor de um tipo maior para um menor corremos o risco de perda de
informação . Para o tipo de STRING o resultado é uma constante que corresponde a um tempo.

Exemplo em ST:
dw:=TIME_TO_DWORD(T#5m); (* Resultado é 300000 *)
str :=TIME_TO_STRING(T#12ms); (* Resultado é 'T#12ms' *)

BRESIMAR <j.andril@bresimar.pt> Cap. II – 15 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

DATE_TO conversão
Converte uma variável do tipo DATE para qualquer outro tipo . Os dados serão armazenados
internamente numa DWORD em segundos a contar a partir do dia 1 de Janeiro de 1970. Só depois é
que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo maior para um
menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é uma constante
que corresponde a uma data.

Exemplo em ST:
b :=DATE_TO_BOOL(D#1970-01-01); (* Resultado é FALSE *)
i :=DATE_TO_INT(D#1970-01-15); (* Resultado é 29952 *)
str :=DATE_TO_STRING(D#2002-08-18); (* Resultado é 'D#2002-08-18' *)
vdt:=DATE_TO_DT(D#2002-08-18); (* Resultado é DT#2002-08-18-00:00 *)
udw:=DATE_TO_DWORD(D#2002-08-18); (* Resultado é 16#3D5EE380 *)

TOD_TO conversão
Converte uma variável do tipo TIME_OF_DATE para qualquer outro tipo . Os dados serão
armazenados internamente numa DWORD em milissegundos a contar a partir das 12:00 AM. Só
depois é que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo maior
para um menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é uma
constante que corresponde a uma constante de tempo.

Exemplo em ST:
si:=TOD_TO_SINT(TOD#00:00:00.012); (* Resultado é 12 *)
str:=TOD_TO_STRING(TOD#14:01:05.123); (* Resultado é 'TOD#14:01:05.123' *)
tm:= TOD_TO_TIME(TOD#14:01:05.123); (* Resultado é T#841m5s123ms *)
udi:= TOD_TO_UDINT(TOD#14:01:05.123); (* Resultado é 16#03020963 *)

DT_TO conversão
Converte uma variável do tipo DATE_AND_TIME para qualquer outro tipo . Os dados serão
armazenados internamente numa DWORD em segundos a contar a partir do dia 1 de Janeiro de 1970.
Só depois é que este valor será convertido . Quando ocorre uma conversão de um valor de um tipo
maior para um menor corremos o risco de perda de informação . Para o tipo de STRING o resultado é
uma constante que corresponde a uma data e tempo.

Exemplo em ST:
byt :=DT_TO_BYTE(DT#1970-01-15-05:05:05); (* Resultado é 129 *)
str:=DT_TO_STRING(DT#1998-02-13-14:20); (* Resultado é 'DT#1998-02-13-14:20' *)
vtod:=DT_TO_TOD(DT#1998-02-13-14:20); (* Resultado é TOD#14:20 *)
vdate:=DT_TO_DATE(DT#1998-02-13-14:20); (* Resultado é D#1998-02-13 *)
vdw:=DT_TO_DWORD(DT#1998-02-13-14:20); (* Resultado é 16#34E45690 *)

REAL_TO / LREAL_TO conversão


Converte uma variável do tipo REAL ou LREAL para qualquer outro tipo . Os dados serão
arredondados para cima ou para baixo conforme o valor decimal e convertidos em um novo tipo de
variável excepto para as variáveis de tipo STRING, BOOL, REAL e LREAL. Quando ocorre uma
conversão de um valor de um tipo maior para um menor corremos o risco de perda de informação .
Para o tipo de STRING o numero total de dígitos é limitado a 16 . Se o numero (L)REAL tem
mais dígitos o 16º digito será arredondado . Se o comprimento do STRING é definido curto ele
será truncado começando no fim do lado direito .

Exemplo em ST:
i := REAL_TO_INT(1.5); (* Resultado é 2 *)
j := REAL_TO_INT(1.4); (* Resultado é 1 *)
k := LREAL_TO_STRING(1.4); (* Resultado é '1.4' *)

BRESIMAR <j.andril@bresimar.pt> Cap. II – 16 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

BYTE TO conversão USINT TO conversão SINT TO conversão


WORD TO conversão UINT TO conversão INT TO conversão
DWORD TO conversão UDINT TO conversão DINT TO conversão
Quando ocorre uma conversão de um valor de um tipo maior para um menor corremos o risco de
perda de informação . Se o numero convertido excede o limite máximo, o primeiro “ byte” será
ignorado .

Exemplo em ST:
si := INT_TO_SINT (4223); (* Resultado é 127 . Como o numero inteiro 4223 em Hex é 16#107F em
SINT ( 1 “byte”) só será representado o “byte menos significativo 16#7F que representa 127 *)

Exemplo em IL:
LD 5
INT_TO_REAL
MUL 3.5
ST Var1 (* Resultado é REAL , 17.5*)

TRUNC
Converte uma variável de tipo REAL para INT . Quando ocorre uma conversão de um valor de um
tipo maior para um menor corremos o risco de perda de informação . Se o numero convertido excede
o limite máximo, o primeiro “ byte” será ignorado .

Exemplo em ST:
i:=TRUNC(1.9); (* Result is 1 *)
i:=TRUNC(-1.4); (* Result is -1 *)

Exemplo em IL:
LD 5.5
TRUNC
MUL 3.5
ST Var1 (* Resultado é REAL , 17.5*)

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 17 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology
Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 18 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

8 - INSTRUÇÕES VÁRIAS
INDEXOF
Calcula o índex (posição de memória) interno do POU (“Program Organization Unit”) .

Exemplo em ST:
Var1:= TRUNC (POU2);

Exemplo em IL:
Var1:DINT;
LD POU2 (* Nome da programa , função ou bloco funcional *)
INDEXOF
ST Var1
SIZEOF
Calcula o numero de “bytes” requerido para um dado tipo de dados .

Exemplo em ST:
arr1:ARRAY [0..5] OF INT;
Var1:INT;
Var1:= TRUNC (arr1); (* O resultado é 12 *)

Exemplo em IL:
arr1:ARRAY [0..6] OF INT;
Var1:INT;
LD arr1
SIZEOF
ST Var1 (* O resultado é 14 *)
ADR
Calcula o endereço absoluto de uma variável em DWORLD . Esta função é utilizada para ser tratada
pelos PONTEIROS .

Exemplo em IL:
LD var1
ADR
ST var2

^
Esta identificação referência um PONTEIRO .

Exemplo em ST:
pt:POINTER TO INT
var_int1:INT;
var_int2:INT;
pt:=ADR(var_int1);
var_int2:=pt^;
BITADR
Retorna com o endereço do bit d a variável indicada .

Exemplo em IL:
var1: AT %IX1.0 : BOOL
out : BYTE
LD var1
BITADR
ST out (*Retorna com 08)

Exemplo em ST
bOFF AT %QX10.1 : BOOL
iBitAdr : BYTE
iBit := BITADR (bOFF) ; (*Retorna com 81)

BRESIMAR <j.andril@bresimar.pt> Cap. II – 19 de 20


TWINCAT PLC - Lista de Instruções BECKHOFF New Automation Technology

CAL
Chama em IL uma função bloco . As variáveis que servem como entradas estão colocadas entre
parênteses á direita depois do nome da função bloco .

Exemplo em IL:
CAL INST (par1: 0 , par2:= TRUE)

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. II – 20 de 20


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

III – FUNÇÕES BLOCO “STANDARD”

1 – FUNÇÕES BLOCO “STANDARD” – BIESTAVEL

2 – FUNÇÕES BLOCO “STANDARD” – “TRIGGER”

3 – FUNÇÕES BLOCO “STANDARD” – TEMPORIZADORES

4 – FUNÇÕES BLOCO “STANDARD” – CONTADORES

BRESIMAR <j.andril@bresimar.pt> Cap. III – 1 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. III – 2 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

1 – FUNÇÕES BLOCO “STANDARD” - BIESTAVEL

FUNCTION_BLOCK RS
Biestavel com RESET prioritário Q1 = RS (SET, RESET1) .
Equação lógica implementada internamente no FB , Q1 = NOT RESET1 AND (Q1 OR SET) .
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb (*Para PC*)
VAR_INPUT
VAR_INPUT
SET : BOOL;
RESET1 : BOOL;
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q1 : BOOL;
END_VAR

FUNCTION_BLOCK SR
Biestavel com SET prioritário Q1 = SR (SET1, RESET) .
Equação lógica implementada internamente no FB , Q1 := (NOT RESET AND Q1) OR SET1 .
VAR_INPUT
VAR_INPUT
SET1 : BOOL;
RESET : BOOL;
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q1 : BOOL;
END_VAR

FUNCTION_BLOCK SEMA
Função semáforo .Equação lógica implementada internamente no FB ,é a seguinte :
BUSY := X;
IF CLAIM THEN X:=TRUE;
ELSIF RELEASE THEN BUSY := FALSE;
X:= FALSE;
END_IF
VAR_INPUT
VAR_INPUT
CLAIM : BOOL;
REALEASE : BOOL;
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q1 : BOOL;
END_VAR

BRESIMAR <j.andril@bresimar.pt> Cap. III – 3 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

2 – FUNÇÕES BLOCO “STANDARD” – “TRIGGER”

FUNCTION_BLOCK F_TRIG
Accionamento pelo flanco descendente . A saída Q e a variável interna M manter-se-á FALSE
enquanto a entrada CLK é TRUE . Logo que ocorra a transição de TRUE para FALSE em CLK a saída
Q ficará TRUE e M será posto a TRUE (set) . Isto significa que cada vez que esta função bloco seja
chamada a saída Q mantém-se FALSE até que ocorra uma transição do CLK de TRUE para FALSE .
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb6 (*Para BC*)

VAR_INPUT
VAR_INPUT
CLK : BOOL; (* Sinal a detector*)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Transição detectada *)
END_VAR
VAR
M : BOOL;
END_VAR

FUNCTION_BLOCK R_TRIG
Accionamento pelo flanco ascendente . A saída Q e a variável interna M manter-se-á FALSE enquanto
a entrada CLK é FALSE . Logo que ocorra a transição de FALSE para TRUE em CLK a saída Q
ficará TRUE e M será posto a TRUE (set) . Isto significa que cada vez que esta função bloco seja
chamada a saída Q mantém-se FALSE até que ocorra uma transição do CLK de FALSE para TRUE .

VAR_INPUT
VAR_INPUT
CLK : BOOL; (* Sinal a detector*)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Transição detectada *)
END_VAR
VAR
M : BOOL;
END_VAR

BRESIMAR <j.andril@bresimar.pt> Cap. III – 4 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

3 – FUNÇÕES BLOCO “STANDARD” – TEMPORIZADORES

FUNCTION_BLOCK TOF
Temporizador ao atraso .
VAR_INPUT
VAR_INPUT
IN : BOOL;(* Iniciar temporização quando FALSE*)
PT : TIME; (* Temporização *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (*FALSE passado PT seg depois de PT ter passado T RUE=>FALSE *)
PT: TIME; (* Tempo já decorrido *)
END_VAR

FUNCTION_BLOCK TON
Temporizador ao trabalho .
VAR_INPUT
VAR_INPUT
IN : BOOL;(* Iniciar temporização quando TRUE *)
PT : TIME; (* Temporização *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (*TRUE passado PT seg depois de PT ter passado FALSE=>TRUE *)
PT: TIME; (* Tempo já decorrido *)
END_VAR

BRESIMAR <j.andril@bresimar.pt> Cap. III – 5 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

FUNCTION_BLOCK TP
Temporizador ao trabalho por impulso .
VAR_INPUT
VAR_INPUT
IN : BOOL;(* Iniciar temporização na transição de TRUE para FALSE*)
PT : TIME; (* Temporização *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (*TRUE durante PT tempo, impulso *)
PT: TIME; (* Tempo já decorrido *)
END_VAR

BRESIMAR <j.andril@bresimar.pt> Cap. III – 6 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

4 – FUNÇÕES BLOCO “STANDARD” – CONTADORES

FUNCTION_BLOCK CTD
Contador decrescente . Quando LOAD é TRUE a variável CV será inicializada com o valor que se
encontra na variável PV . Se CD transitar de FALSE para TRUE , CV decrementa 1. Quando CV for
menor ou igual a zero Q irá a TRUE .

VAR_INPUT
VAR_INPUT
IN : BOOL;(* Contar com a transição positiva (FALSE=>TRUE) *)
LOAD : BOOL; (* Ordem de carregar valor inicial PV *)
PV : WORD; (* Valor inicial *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Finalização de contagem *)
CV: WORD; (* Contagem corrente *)
END_VAR

FUNCTION_BLOCK CTU
Contador crescente . A variável CV será inicializada com o RESET a TRUE . Quando ocorre uma
transição de FALSE para TRUE o contador incrementa 1 . Quando CV for maior ou igual a PV
Q irá a TRUE .

VAR_INPUT
VAR_INPUT
CU : BOOL;(* Contar com a transição positiva (FALSE=>TRUE) *)
RESET : BOOL; (* Ordem de por a zero o contador *)
PV : WORD; (* Valor final *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Finalização de contagem *)
CV: WORD; (* Contagem corrente *)

BRESIMAR <j.andril@bresimar.pt> Cap. III – 7 de 8


TWINCAT PLC – Funções bloco “standard” BECKHOFF New Automation Technology

FUNCTION_BLOCK CTUD
Contador crescente e decrescente . Combinação das mesmas características dos blocos funcionais de
contagem anteriores .( CTU e CTD ) .

VAR_INPUT
VAR_INPUT
CU : BOOL;(* Contagem crescente *)
CU : BOOL;(* Contagem crescente *)
RESET : BOOL; (* Ordem de por a zero o contador *)
LOAD : BOOL; (* Ordem de carregar valor inicial PV *)
PV : WORD; (* Valor final *)
END_VAR

VAR_OUTPUT
VAR_OUTPUT
QU : BOOL; (* Finalização de contagem *)
QD : BOOL; (* Finalização de contagem a zero *)
CV: WORD; (* Contagem corrente *)

Notas :

BRESIMAR <j.andril@bresimar.pt> Cap. III – 8 de 8


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

IV – FUNÇÕES “STANDARD”

1 – FUNÇÕES “STANDARD” – “STRING”

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 1 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 2 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

1 – FUNÇÕES “STANDARD” – “STRING”

CONCAT
Combina 2 “strings” .
Nome das livrarias : Standard.lb (*Para PC*) e Standard.lb (*Para PC*)

FUNCTION CONCAT : STRING(255)


VAR_INPUT
VAR_INPUT
STR1 : STRING(255);
STR2 : STRING(255);
END_VAR

Exemplo em ST:
Var1: CONCAT (‘SUSI’ , ‘WILLI’) ;

Exemplo em IL:
LD ‘SUSI’
CONCAT ‘WILLI’
ST Var1 (* Resultado é ‘SUSIWILLI’ *)

DELETE
Apaga uma parte de um STRING a partir de uma dada posição .
DELETE (STR, L, P) significa o seguinte :
Apaga L caracteres do “string” STR a partir do carácter nº P .

FUNCTION DELETE : STRING(255)


VAR_INPUT
VAR_INPUT
STR : STRING(255);
LEN : INT;
POS : INT;
END_VAR

Exemplo em ST:
Var1: = DELETE (‘SUXYSI’ , 2 , 2 ) ;

Exemplo em IL:
LD ‘SUXYSI’
DELETE 2,2
ST Var1 (* Resultado é ‘SYSI’ *)

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 3 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

FIND
Função de procura de uma parte (frase) dentro de um STRING .
FIND (STR1, STR2) significa o seguinte :
Encontra a posição , desde o 1º carácter , da frase STR1 dentro da STR2 .

FUNCTION FIND : INT


VAR_INPUT
VAR_INPUT
STR1 : STRING(255);
STR2 : STRING(255);
END_VAR

Exemplo em ST:
Var1: = FIND (‘SUXYSI’ , ‘XY’ ) ;

Exemplo em IL:
LD ‘SUXYSI’
FIND ‘XY’
ST Var1 (* Resultado é 3 *)

INSERT
Função de inserção de uma parte (frase) dentro de um STRING .
INSERT (STR1, STR2, POS) significa o seguinte :
Insere STR2 depois da posição POS na frase STR1 .

FUNCTION INSERT : STRING(255)


VAR_INPUT
VAR_INPUT
STR1 : STRING(255);
STR2 : STRING(255);
POS : INT;
END_VAR

Exemplo em ST:
Var1: = INSERT (‘SUSI’ , ‘XY’ , 2) ;

Exemplo em IL:
LD ‘SUSI’
INSERT ‘XY’ , 2
ST Var1 (* Resultado é ‘SUXYSI’ *)

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 4 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

LEFT
Selecciona um nº caracteres de um STRING a começar pela esquerda .
LEFT (STR, SIZE) significa o seguinte :
Selecciona na frase STR , SIZE caracteres a começar pela esquerda .

FUNCTION LEFT : STRING(255)


VAR_INPUT
VAR_INPUT
STR : STRING(255);
SIZE : INT;
END_VAR

Exemplo em ST:
Var1: = LEFT (‘BRESIMAR’ , 2) ;

Exemplo em IL:
LD ‘BRESIMAR’
LEFT 2
ST Var1 (* Resultado é ‘BR’ *)

LEN
Calcula o tamanho de um STRING (nº de caracteres) .

FUNCTION LEN : INT


VAR_INPUT
VAR_INPUT
STR : STRING(255);
SIZE : INT;
END_VAR

Exemplo em ST:
Var1: = LEN (‘BRESIMAR’ ) ;

Exemplo em IL:
LD ‘BRESIMAR’
LEN
ST Var1 (* Resultado é 8 *)

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 5 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

MID
Selecciona um nº caracteres de um STRING a partir de uma dada posição .
MID (STR, LEN, POS) significa o seguinte :
Selecciona na frase STR , LEN caracteres a começar da posição POS (a contar da
esquerda).

FUNCTION MID : STRING(255)


VAR_INPUT
VAR_INPUT
STR : STRING(255);
LEN : INT;
POS : INT;
END_VAR

Exemplo em ST:
Var1: = MID (‘BRESIMAR’ , 2 , 3) ;

Exemplo em IL:
LD ‘BRESIMAR’
MID 2 , 3
ST Var1 (* Resultado é ‘ES’ *)

REPLACE
Cola um STRING a partir de uma dada posição de um dado STRING e eliminando um nº de caracteres
definidos .
REPLACE (STR1, STR2, L, P) significa o seguinte :
Cola a frase STR2 a partir da posição P da frase STR1 e eliminando em STR1 L
caracteres .

FUNCTION REPLACE : STRING(255)


VAR_INPUT
VAR_INPUT
STR1 : STRING(255);
STR1 : STRING(255);
L : INT;
P : INT;
END_VAR

Exemplo em ST:
Var1: = REPLACE (‘BRESIMAR’ , ‘ASA’ , 2 , 3) ;

Exemplo em IL:
LD ‘BRESIMAR’
REPLACE ‘ASA’ , 2, 3
ST Var1 (* Resultado é ‘BASAIMAR’ *)

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 6 de 7


TWINCAT PLC – Funções “standard” BECKHOFF New Automation Technology

RIGTH
Selecciona um nº caracteres de um STRING a começar pela direita .
RIGTH (STR, SIZE) significa o seguinte :
Selecciona na frase STR , SIZE caracteres a começar pela direita .

FUNCTION RIGTH : STRING(255)


VAR_INPUT
VAR_INPUT
STR : STRING(255);
SIZE : INT;
END_VAR

Exemplo em ST:
Var1: = RIGTH (‘BRESIMAR’ , 3) ;

Exemplo em IL:
LD ‘BRESIMAR’
RIGTH 3
ST Var1 (* Resultado é ‘MAR’ *)

BRESIMAR <j.andril@bresimar.pt> Cap. IV – 7 de 7


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

V – EXEMPLOS PRÁTICOS

1 – ARRANQUE DIRECTO DE MOTOR TRIFÁSICO

2 – INVERSÃO DE ROTAÇÃO DE MOTOR TRIFÁSICO

3 – ARRANQUE ESTRELA-TRIANGULO DE MOTOR TRIFÁSICO

Neste capitulo vão ser apresentados exemplos de automatismos e respectivas soluções


utilizando instruções pertencentes a PLC´s “Beckhoff” .
As aplicações abordam circuitos eléctricos simples e comuns nos automatismos electro-
mecânicos industriais . O estudo destes exemplos tem por finalidade aprofundar os conhecimentos
adquiridos nos capítulos anteriores e , ao mesmo tempo , possibilitar a prática das instruções base do
“TwinCAT-PLC” .
Compreendidos os exemplos propostos , adquirem-se os conhecimentos necessários para se
abordar situações mais complexas , ou seja , o caminho fica aberto para que se torne possível enfrentar
a concepção , realização e manutenção de automatismos usando o “TwinCAT” .
Chamo á atenção , que os exemplos de programação apresentados foram escritos a titulo
didáctico . Por isso , podem não estar previstas todas as situações de funcionamento real . Deste modo ,
o seu uso em programas de aplicação industrial pode necessitar de adaptações que assegurem todas as
possibilidades de utilização e o respeito pelas normas de segurança em vigor no sector de actividade
onde vão ser utilizadas .

BRESIMAR <j.andril@bresimar.pt> Cap. V – 1 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 2 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1 – ARRANQUE DIRECTO DE MOTOR TRIFÁSICO


Com este circuito pretende-se comandar um motor trifásico através de duas botoneiras com
contactos normalmente abertos (N.A.) “S1” e “S2” e executado por um algoritmo ( programa de PLC
- “Beckhoff“) . A colocação em marcha do motor é feita quando se pressiona “S2” e a paragem quando
se pressiona “S1”. A paragem também ocorre se a protecção térmica do motor contra sobrecargas for
actuada. Se tal acontecer , é actuado o contacto normalmente fechado (N.F.) “F2” (circuito abre ) .
Equação lógica do circuito :
KM1 = /F2 . /S1 . ( S2 + KM1)

BRESIMAR <j.andril@bresimar.pt> Cap. V – 3 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.1 - Edição a texto

1.1.1 - ST - “Structured Text”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 4 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.1.2 - IL - “Instruction List”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 5 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.2 - Edição gráfica

1.2.1 - LD - “Ladder Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 6 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.2.2 - FBD - “Function Block Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 7 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.2.3 - CFC - “Continuos Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 8 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.3 - Edição por GRAFCET

Para quem utilizar o método de diagrama funcional GRAFCET , teremos para o circuito
anterior a seguinte estrutura :

GRAFCET NÍVEL 1 (Especificações funcionais)

GRAFCET NÍVEL 2 (Especificações tecnológicas)


Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , estando o sistema em
repouso (motor parado) . Para que o motor trabalhe é necessário que o GRAFCET evolua para a etapa
1.
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição
lógica de transição ( F2 . /S1 . S2 ) for verdadeira ( o botão de pressão “S2“ foi pressionado , não está
pressionado o botão “S1“ e nem o relé térmico “F2” foi actuado ). Nesta situação o GRAFCET evolui
para a etapa 1 e a acção associada a esta etapa é realizada (bobina do contactor é alimentada e o motor
M1 é accionado).
Estando o motor em funcionamento (etapa 1) se desejarmos desligar o motor teremos de
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S1 ) for
verdadeira ( o botão de pressão “S1“ foi pressionado ou o relé térmico “F2” disparou ) .

BRESIMAR <j.andril@bresimar.pt> Cap. V – 9 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.3.1 - SFC - “Sequencial Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 10 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

1.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 11 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2 – INVERSÃO DE ROTAÇÃO DE MOTOR TRIFÁSICO


Com este circuito pretende-se comandar o sentido de rotação de um motor trifásico através de
duas botoneiras com contactos normalmente abertos (N.A.) “S7” (marcha para a direita) e “S8” (para a
esquerda) . A paragem efectua-se quando se pressiona o botão “S6” (N.A)ou se a protecção térmica
do motor contra sobrecargas for actuada . Se tal acontecer , é actuado o contacto normalmente fechado
(N.F.) “F2” ( contacto abre) .
Equação lógica do circuito :
KM5 = /F2 . /S6 . /KM6 . ( S7 + KM5)
KM6 = /F2 . /S6 . /KM5 . ( S8 + KM6)

BRESIMAR <j.andril@bresimar.pt> Cap. V – 12 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.1 - Edição a texto

2.1.1 - ST - “Structured Text”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 13 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.1.2 - IL - “Instruction List”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 14 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.2 - Edição gráfica

2.2.1 - LD - “Ladder Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 15 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.2.2 - FBD - “Function Block Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 16 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.2.3 - CFC - “Continuos Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 17 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.3 - Edição por GRAFCET

Para quem utilizar o método de diagrama funcional de GRAFCET , teremos para o circuito anterior a
seguinte estrutura :

GRAFCET NÍVEL 1 (Especificações funcionais)

GRAFCET NÍVEL 2 (Especificações tecnológicas)


Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , o motor está parado .
Para que o motor trabalhe é necessário que o GRAFCET evolua para a etapa 1 ou 2.
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição
lógica de transição ( F2 . /S6 . /S8 . S7 ) for verdadeira ( o botão de pressão “S7“ foi pressionado e não
está pressionado o botão “S6“ nem o “S8” e nem o relé térmico “F2” foi actuado ). Nesta situação o
GRAFCET evolui para a etapa 1 e o motor irá rodar para a direita . Para o motor rodar para a esquerda
, a etapa 2 terá de ser activada , em alternativa á etapa 1 , sendo necessário que o motor esteja parado (
etapa 0) e a condição de transição ( F2 . /S6 . /S7 . S8 ) seja verdadeira .
Estando o motor em funcionamento (etapa 1 ou 2) se desejarmos desligar o motor teremos de
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S6 ) for
verdadeira ( o botão de pressão “S6“ foi pressionado ou o relé térmico “F2” disparou ) .

BRESIMAR <j.andril@bresimar.pt> Cap. V – 18 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.3.1 - SFC - “Sequencial Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 19 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

2.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 20 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 21 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3 – ARRANQUE ESTRELA-TRIANGULO DE MOTOR TRIFÁSICO


Com este circuito pretende-se efectuar o arranque estrela - triangulo de um motor assíncrono
trifásico com rotor em curto-circuito. O arranque ocorre quando se pressiona o botão de pressão “S10”.
A paragem efectua-se quando se pressiona o botão “S9” (N.A) ou se a protecção térmica do motor
“F2” (N.F.)contra sobrecargas for actuada .
Equação lógica do circuito :
KM1 = /F2 . /S9 . ( S10 + KM2 . KM1) . /KM2(t1) . /KM3
KM2 = /F2 . /S9 . ( S10 . KM1+ KM2)
KM3 = /F2 . /S9 . ( S10 . KM1+ KM2) . /KM1

BRESIMAR <j.andril@bresimar.pt> Cap. V – 22 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.1 - Edição a texto

3.1.1 - ST - “Structured Text”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 23 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.1.2 - IL - “Instruction List”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 24 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 25 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.2 - Edição gráfica

3.2.1 - LD - “Ladder Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 26 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 27 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.2.2 - FBD - “Function Block Diagram”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 28 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 29 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.2.3 - CFC - “Continuos Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 30 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.3 - Edição por GRAFCET

Para quem utilizar o método de diagrama funcional de GRAFCET , teremos a seguinte estrutura :

GRAFCET NÍVEL 1 (Especificações funcionais)

GRAFCET NÍVEL 2 (Especificações tecnológicas)


Na etapa inicial (etapa 0) o automatismo não executa qualquer acção , o motor esta parado .
A etapa 1 é activada se a transição for válida , ou seja , se a etapa 0 estiver activa e a condição
lógica de transição ( F2 . /S9 . S10 ) for verdadeira ( o botão de pressão “S10“ foi pressionado e não
está pressionado o botão “S9“ e nem o relé térmico “F2” foi actuado ). Nesta situação o GRAFCET
evolui para a etapa 1 e o motor irá arrancar em modo “estrela” durante o tempo “t1” (seg.) . Nesta
etapa está accionado o contactor “KM1” e “KM2” .Passado esse tempo “t1” o sistema passará para
a etapa 2 , que corresponde ao modo “triangulo” . Nesta etapa o contactor “KM1” está desligado , o
contactor “KM2” mantém-se ligado e é ligado o contactor “KM3” .
Estando o motor em funcionamento (etapa 1 ou 2) se desejarmos desligar o motor teremos de
passar , no GRAFCET , para a etapa 0 . Isso acontece quando a condição lógica ( /F2 + S9) for
verdadeira ( o botão de pressão “S9“ foi pressionado ou o relé térmico “F2” disparou ) .

BRESIMAR <j.andril@bresimar.pt> Cap. V – 31 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.3.1 - SFC - “Sequencial Function Chart”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 32 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 33 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

3.3.2 - “GRAFCET com instruções Set / Reset (Biestavel)”

BRESIMAR <j.andril@bresimar.pt> Cap. V – 34 de 35


TWINCAT PLC – Exemplos práticos BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Cap. V – 35 de 35


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

Anexo A – RESUMO DE INSTRUÇÕES E FUNÇÕES “STANDARD”

1 – RESUMO DE INSTRUÇÕES DO “TwinCAT PLC”

2 – RESUMO DAS FUNÇÕES BLOCO “STANDARD”

3 – RESUMO DAS FUNÇÕES “STANDARD”

BRESIMAR <j.andril@bresimar.pt> Anexo A – 1 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Anexo A – 2 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

1 – RESUMO DE INSTRUÇÕES DO “TwinCAT PLC”


NUMERICAS IL ST LD
ABS - Valor absoluto LD in out:=ABS(in);
ABS
ST out
ACOS - Arco de co- LD in out:=COS(in);
seno ACOS
ST out
ASIN - Arco de seno LD in out:=ASIN(in);
ASIN
ST out
ATAN - Arco de LD in out:=ATAN(in);
tangente ATAN
ST out
COS - Co-seno LD in out:=COS(in);
COS
ST out
EXP - Exponencial LD in out:=EXP(in);
EXP
ST out
EXPT - Expo. de in1 LD in1 out:=EXPT(in1,
levantado a in2 EXPT in2 in2);
ST out

LN - Logaritmo natural LD in out:=LN(in);


LN
ST out
LOG - Logaritmo de LD in out:=LOG(in);
base 10 LOG
ST out
SIN - Seno LD in out:=SIN(in);
SIN
ST out
SQRT - Raiz quadrada LD in out:=SQRT(in);
SQRT
ST out
TAN - Tangente LD in out:=TAN(in);
TAN
ST out

ARITMETICAS IL ST LD
ADD - Soma LD in1 out:= in1+in2;
ADD in2
ST out

MUL - Multiplicação LD in1 out:= in1*in2*in3;


MUL in2,in3
ST out

SUB - Subtracção LD in1 out:= in1-in2;


SUB in2
ST out

BRESIMAR <j.andril@bresimar.pt> Anexo A – 3 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

DIV - Divisão LD in out:= in1 / in2;


DIV in2
ST out

MOD - Resto da divisão LD in out:= in1 MOD in2;


MOD in2
ST out

LOGICAS IL ST LD
AND - “E” (produto LD in1 out:= in1 AND in2;
lógico) AND in2
( BOOL , BYTE , WORD , ST out
DWORD )
OR - “OU” (soma LD in out:= in1 OR in2;
lógica) OR in2
( BOOL , BYTE , WORD , ST out
DWORD )
XOR - “OU EX” ( LD in out:= in1 XOR in2;
“OU” exclusivo) XOR in2
( BOOL , BYTE , WORD , ST out
DWORD )
NOT - “NÃO” LD in out:= NOT in;
(negação lógica) NOT
( BOOL , BYTE , WORD , ST out
DWORD )

DESLOCAÇÃO IL ST LD
SHL - Deslocação de in LD in out:= SHL (in,n);
em n bits a direita com SHL n
preenchimento á ST out
esquerda
( BYTE , WORD , DWORD )
SHR - Deslocação de in LD in out:= SHR (in,n);
em n bits á esquerda SHR n
com preenchimento á ST out
direita
( BYTE , WORD , DWORD )
ROL - Deslocação de in LD in out:= ROL (in,n);
em n bits á direita com ROL n
entrada á esquerda ST out
( BYTE , WORD , DWORD )

ROR - Deslocação de in LD in out:= ROR (in.n);


em n bits á esquerda ROR n
com entrada á direita ST out
( BYTE , WORD , DWORD )

SELECÇÃO IL ST LD
SEL - Selector binário LD TRUE out:=SEL(g,in1,in2);
SEL in1,in2
ST out

MAX - Selecção do LD in1 out:=MAX (in1,in2,in3);


maior dado MAX in2
MAX in3
ST out

MIN - Selecção do LD in1 out:=MIN(in1,in2,in3);


menor dado MIN in2,in3
ST out

BRESIMAR <j.andril@bresimar.pt> Anexo A – 4 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

LIMIT - Selecção de LD min out:=LIMIT(min,in,max);


limites LIMIT in , max
ST out

MUX - Multiplexador LD k out:=MUX(K,in0,in1,in2,in3,in4)


MUX ;
in0,in1,in2,
In3,in4
ST out

COMPARAÇÃO IL ST LD
GT – “>” (maior que) LD in1 out:= in1 > in2;
GT in2
ST out
LT – “<” (menor que) LD in1 out:= in1 < in2;
LT in2
ST out
GE – “>=” (maior ou LD in1 out:= in1 >= in2;
igual a) GE in2
ST out
LE – “<=” (menor ou LD in1 out:= in1 <= in2;
igual a) LE in2
ST out
EQ – “=” (igual a) LD in1 out:= in1 = in2;
EQ in2
ST out
NE – “<>” (não igual LD in1 out:= in1 <> in2;
a) NE in2
ST out

CONVERSÃO IL ST LD
BOOL_TO_tipo LD in out:=BOOL_TO_INT(in);
(16 conversões) BOOL_TO_INT
ST out

BYTE_TO_tipo LD in out:=BYTE_TO_WORD(in);
(16 conversões) BYTE_TO_WORD
LD
ST out
WORD_TO_tipo LD in out:=WORD_TO_INT(in);
(16 conversões) WORD_TO_INT
ST out

DWORD_TO_tipo LD in out:=DWORD_TO_BOOL(in);
(16 conversões) DWORD_TO_BOOL
ST out

USINT_TO_tipo LD in out:=USINT_TO_INT(in);
(16 conversões) USINT_ TO_DINT
ST out

UINT_TO_tipo LD in out:=UINT_TO_USINT(in);
(16 conversões) UINT_ TO_USINT
ST out

UDINT_TO_tipo LD in out:=UDINT_TO_USINT(in);
(16 conversões) UDINT_ TO_USINT
ST out

BRESIMAR <j.andril@bresimar.pt> Anexo A – 5 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

SINT_TO_tipo LD in out:=SINT_TO_USINT(in);
(16 conversões) SINT_ TO_USINT
ST out

INT_TO_tipo LD in out:=INT_TO_USINT(in);
(16 conversões) INT_ TO_USINT
ST out

DINT_TO_tipo LD in out:=DINT_TO_USINT(in);
(16 conversões) DINT_ TO_USINT
ST out

REAL_TO_tipo LD in out:=REAL_TO_USINT(in);
(16 conversões) REAL_ TO_USINT
ST out

LREAL_TO_tipo LD in out:=LREAL_TO_USINT(in);
(16 conversões) LREAL_ TO_USINT
ST out

STRING_TO_tipo LD in out:=STRING_TO_USINT(in);
(16 conversões) STRING_TO_USINT
ST out

TIME_TO_tipo LD in out:=TIME_TO_USINT(in);
(16 conversões) TIME_ TO_USINT
ST out

TOD_TO_tipo LD in out:=TOD_TO_UINT(in);
(16 conversões) TOD_ TO_UINT

“TIME_OF_DAY” ST out

DATE_TO_tipo LD in out:=DATE_TO_UINT(in);
(16 conversões) DATE_TO_UINT
ST out

DT_TO_tipo LD in out:=DT_TO_UINT(in);
(16 conversões) DT_TO_UINT

“DATE_AND_TIME” ST out

TRUNC – Truncar LD in out:=TRUNC(in);


variável TRUNC
ST out

VÁRIAS IL ST LD
INDEXOF – index LD in out:=INDEXOF(in);
interno do POU INDEXOF
ST out
SIZEOF – nº de LD in out:=SIZEOF(in);
“bytes” da variável SIZEOF
ST out
ADR – endereço pt:POINTER TO INT
absoluto da variável var_int1:INT;
^ – indicação de var_int2:INT;
ponteiro
pt:=ADR(var_int1);
var_int2:=pt^;
BITADR – endereço do LD in out:=BITADR(in);
bit na variável BITADR
ST out

BRESIMAR <j.andril@bresimar.pt> Anexo A – 6 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

CAL – chamada de uma


função bloco

2 – RESUMO DAS FUNÇÕES BLOCO “STANDARD”


BIESTAVEL IL ST LD
RS – Biestavel com CAL rs1 rs1(SET:=in1 , RESET1:=in2 ,
RESET prioritário (SET := in1, Q1=> out1);
RESET1 :=
in2)
LD rs1.Q1
ST out1
SR – Biestavel com LD in1 sr1(SET1:=in1 , RESET:=in2 ,
SET prioritário ST sr1.SET1 Q1=> out1);
CAL sr1
(RESET:=in2)
LD rs1.Q1
ST out1
SEMA – Função CAL sema1 sema1(CLAIM:=in1,RESET:=in
semáforo (CLAIM:=in1, 2,BUSY=>out1);
RELEASE:=in
2,
BUSY=>out1)
”TRIGGER” IL ST LD
F_TRIG – CAL ftrig1 ftrig1(CLK:=in1 , Q=>out1 );
Accionamento pelo (CLK := in1)
flanco descendente LD ftrig1.Q
ST out1
R_TRIG – CAL rtrig1 rtrig1(CLK:=in1 , Q=>out1 );
Accionamento pelo (CLK := in1)
flanco ascendente LD rtrig1.Q
ST out1

TEMPORIZADORES IL ST LD
TOF – Temporizado ao CAL tof1 tof1(IN:=in1 , PT:=T#2s ,
repouso (IN := in1 , Q=>out1 , ET=>tempor );
PT := T#2s ,
Q=>out1 ,
ET=>tempor)
LD tof1.Q
ST out1
LD tof1.ET
ST tempor

TON – Temporizado CAL ton1 ton1(IN:=in1 , PT:=T#4s ,


ao trabalho (IN := in1 , Q=>out1 , ET=>tempor );
PT := T#4s ,
Q=>out1 ,
ET=>tempor)

BRESIMAR <j.andril@bresimar.pt> Anexo A – 7 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

TP – Temporizado ao CAL tp1 tp1(IN:=in1, PT:=T#6s );


trabalho por impulso (IN := in1,
PT:=T#6000ms out1:=tp1.Q;
)
LD tp1.Q tempor:=tp1.ET;
ST out1
LD tp1.ET
ST tempor

CONTADORES IL ST LD
CTD – Contador CAL tof1 tof1(IN:=in1 , PT:=T#2s ,
decrescente (IN := in1 , Q=>out1 , ET=>tempor );
PT := T#2s ,
Q=>out1 ,
ET=>tempor)
LD tof1.Q
ST out1
LD tof1.ET
ST tempor

CTU – Contador CAL ton1 ton1(IN:=in1 , PT:=T#4s ,


crescente (IN := in1 , Q=>out1 , ET=>tempor );
PT := T#4s ,
Q=>out1 ,
ET=>tempor)
CTUD – Contador CAL tp1 tp1(IN:=in1, PT:=T#6s );
crescente / decrescente (IN := in1,
PT:=T#6000ms out1:=tp1.Q;
)
LD tp1.Q tempor:=tp1.ET;
ST out1
LD tp1.ET
ST tempor

3 – RESUMO DAS FUNÇÕES “STANDARD”


BIESTAVEL IL ST LD
CONCAT – Combina LD ‘S.’ (* Resultado é ‘S.WILLI’ *)
2 “strings” . CONCAT Var1:=CONCAT(‘S.’,‘WILLI’);
‘WILLI’
ST Var1
DELETE – Apaga uma LD ‘SUXYSI’ (* Resultado é ‘SYSI’ *)
parte de um STRING a DELETE 2,2 Var1: = DELETE (‘SUXYSI’ , 2
partir de uma dada ST Var1 ,2);
posição .

FIND – Função de LD ‘SUXYSI’ (* Resultado é 3 *)


procura de uma parte FIND ‘XY’ Var1: = FIND (‘SUXYSI’ , ‘XY’
(frase) dentro de um ST Var1 );
STRING .

INSERT – Função de LD ‘SUSI’ (* Resultado é ‘SUXYSI’ *)


procura de uma parte INSERT Var1: = INSERT (‘SUSI’ , ‘XY’
(frase) dentro de um ‘XY’,2 , 2) ;
STRING . ST Var1

BRESIMAR <j.andril@bresimar.pt> Anexo A – 8 de 9


TWINCAT PLC – Resumo de Instruções BECKHOFF New Automation Technology

LEFT – Selecciona LD (* Resultado é ‘BR’ *)


um nº caracteres de um ‘BRESIMAR’ Var1: = LEFT (‘BRESIMAR’ ,
STRING a começar pela LEFT 2 2) ;
esquerda . ST Var1

LEN – Calcula o LD (* Resultado é 8 *)


tamanho de um ‘BRESIMAR’ Var1: = LEN (‘BRESIMAR’ ) ;
STRING (nº de LEN
caracteres) . ST Var1

MID – Selecciona um LD (* Resultado é ‘ES’ *)


nº caracteres de um ‘BRESIMAR’ Var1: = MID (‘BRESIMAR’ , 2 ,
STRING a partir de uma MID 2 , 3 3) ;
dada posição . ST Var1

REPLACE – Cola um LD (* Resultado é ‘BASAIMAR’ *)


STRING a partir de uma ‘BRESIMAR’ Var1: = REPLACE
dada posição de um REPLACE (‘BRESIMAR’ , ‘ASA’ , 2 , 3) ;
dado STRING e ‘ASA’ , 2, 3
eliminando um nº de ST Var1
caracteres definidos .

RIGTH – Selecciona LD (* Resultado é ‘MAR’ *)


um nº caracteres de um ‘BRESIMAR’ Var1: = RIGTH (‘BRESIMAR’ ,
STRING a começar pela RIGTH 3 3) ;
direita . ST Var1

BRESIMAR <j.andril@bresimar.pt> Anexo A – 9 de 9


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology

Anexo B – LISTA DE ERROS DE COMPILAÇÃO DE PROGRAMA

1 – ERROS DE COMPILAÇÃO

BRESIMAR <j.andril@bresimar.pt> Anexo B – 1 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Anexo B – 2 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology

1 – ERROS DE COMPILAÇÃO

Neste capitulo encontrará as mensagens de erro ( em “italics” ) e as suas possíveis causas . Para
uma melhor interpretação e como o software TwinCAT é o usado a versão inglesa , optamos em deixar a
tabela na mesma língua .

1.1 - CHAMADAS DE ATENÇÃO (“Warnings”)


Nº men. Mensagem de atenção Possível causa
1100 Unknown function An external library is used. Please check, whether all
'<name>' in library. functions, which are defined in the .hex file, are also defined
in the .lib file.
1101 Unresolved symbol The code generator expects a POU with the name
'<Symbol>'. <Symbol>. It is not defined in the project. Define a
function/program with this name.
1102 Invalid interface for The code generator expects a function with the name
symbol '<Symbol>'. <Symbol> and exactly one scalar input, or a program with
the name <Symbol> and no input or output.
1103 The constant '<name>' A string constant exceeds the 16K page boundary. The
at code address system cannot handle this. It depends on the runtime system
'<address>' overwrites whether the problem could be avoided by an entry in the
a 16K page boundary! target file. Please contact the PLC manufacturer.
1200 Task '%s', call of '% Variables, which are only used at a function block call in the
Access variables in the task configuration, will not be listed in the cross reference
parameter list are not list.
updated
1300 File not found '<name>' The file, to which the global variable object is pointing, does
not exist. Please check the path.
1301 Analyze-Library not The analyze function is used, but the library analyzation.lib is
found! Code for missing. Add the in the library manager.
analyzation will not be
generated.
1302 New externally Since the last download you have linked a library containing
referenced functions functions which are not yet referenced in the runtime system.
inserted. Online For this reason you have to download the complete project.
Change is therefore no
longer possible!
1400 Unknown Pragma This pragma is not supported by the compiler. See keyword
'<name>' is ignored! ‘pragma’ for supported directives.
1401 The struct '<name>' The structure with name <name> does not contain any
does not contain any elements. But Variables of this type will use 1 Byte of
elements. memory.
1500 Expression contains no The result of this expression is not used. For this reason
assignment. No code there is no code generated for the whole expression.
was generated.
1501 String constant passed The constant may not be written within the POU, because
as 'VAR_IN_OUT': there no size check is possible.
'<name>' must not be
overwritten!
1502 Variable '<name>' has A variable is used, which has the same name
the same name as a
POU. The POU will not Example:
be called!
PROGRAM a
...
VAR_GLOBAL
a: INT;
END_VAR
...
a; (* Not POU a is called but variable a is loaded.. *)

BRESIMAR <j.andril@bresimar.pt> Anexo B – 3 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
1503 The POU ‘<name>’ has The Output pin of a POU which has no outputs, is connected
no outputs. Box result in FBD or KOP. The assignment automatically gets the value
is set to 'TRUE'. TRUE.
1504 <name>’ (‘<number>’): Eventually not all branches of the logic expression will be
Statement may not be executed. Example:
executed due to the IF a AND funct(TRUE) THEN
evaluation of the logical If a has is FALSE then funct will not be called.
expression
1505 Side effect in '<name>'! The first input of the POU is FALSE, for this reason the side
Branch is probably not branch, which may come in at the second input, will not be
executed ! executed.
1506 Variable '%s' has the Rename the variable or the action.
same name as a local
action. The action will
not be called!
1600 Open DB unclear The original Siemens program does not tell, which POU is
(generated code may openend.
be erroneous).
1700 Input box without An input box is used in CFC which has no assignment. For
assignment. this no code will be generated.
1800 <name>(element The visualization element contains an expression which
#<element number>): cannot be monitored. Check variable name and placeholder
Invalid watchexpression replacements.
'%s'
1801 '<name> (number): No In the configuration of the visualization object at field input a
Input on Expression composed expression is used. Replace this by a single
'<name>' possible variable.
1900 POU '<name>' (main The Start-POU (z.B. PLC_PRG) will not be available, when
routine) is not available the project is used as library.
in the library
1901 Access Variables and Access variables and variable configuration are not stored in
Variable Configurations the library.
are not saved in a
library!
1902 '<name>': is no Library The .obj file of the lib was generated for another device.
for the current machine
type!
1903 <name>: is no valid The file does not have the format requested for the actual
Library target.

1.2 – ERROS DE COMPILAÇÃO


Nº erro Mensagem de erro Possível causa
3100 Code too large. The maximum program size is exceeded. Reduce project
Maximum size: size.
'<number>' Byte
(<number>K)
3101 Total data too large. Memory is exceeded. Reduce data usage of the application.
Maximum size:
'<number>' Byte
(<number>K)
3110 Error in library file The .hex file is not in INTEL Hex format.
'<name>'.
3111 Library '<name>' is too The .hex file exceeds the set maximum size.
large. Maximum size:
64K
3112 Nonrelocatable The .hex file contains a nonrelocatable instruction. The
instruction in library. library code cannot be linked.
3113 Library code overwrites The ranges for code and function tables are overlapping.
function tables.
3114 Library uses more than The tables and the code in the .hex file use more than one
one segment. segment.
3115 Unable to assign The internal pointer format for string constants cannot get
constant to converted to the internal pointer format of VAR_IN_OUT,
VAR_IN_OUT. because the data are set "near" but the string constants are
Incompatible data types . set " huge" or "far". If possible change these target settings.

BRESIMAR <j.andril@bresimar.pt> Anexo B – 4 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
3120 Current code-segment The currently generated code is bigger than 64K. Eventually
exceeds 64K. to much initializing code is created.
3121 POU too large." A POU A POU may not exceed the size of 64K.
may not exceed the
size of 64K.
3122 Initialisation too large. The initialization code for a function or a structure POU may
Maximum size: 64K not exceed 64K.
3130 User-Stack too small: The nesting depth of the POU calls is to big. Enter a higher
'<number>' DWORD stack size in the target settings or compile build project
needed, '<number>' without option ‚Debug’ (can be set in dialog ‘Project’
DWORD available. ‘Options’ ‘Build’).
3131 User-Stack too small: Please contact the PLC manufacturer.
'<number>' WORD
needed, '<number>'
WORD available.
3132 System-Stack too Please contact the PLC manufacturer.
small: '<number>'
WORD needed,
'<number>' WORD
available.
3150 Parameter <number> of Use a intermediate variable, to which the result of the IEC
function '<name>': function is assigned.
Cannot pass the result
of a IEC-function as
string parameter to a C-
function.
3160 Can't open library file A library <name> is included in the library manager for this
'<name>'. project, but the library file does not exist at the given path.
3161 Library '<name>' A .obj file of a library at least must contain one C function.
contains no Insert a dummy function in the .obj file, which is not defined
codesegment in the .lib file.
3162 Could not resolve The .obj file contains a not resolvable reference to another
reference in Library symbol. Please check the settings of the C-Compiler.
'<name>'(Symbol
'<name>', Class
'<name>', Type
'<name>')
3163 Unknown reference The .obj file contains a reference type, which is not
type in Library resolvable by the code generator. Please check -the settings
'<name>' (Symbol of the C-Compiler.
'<name>' , Class
'<name>' , Type
'<name>')
3200 "%s (%d): Boolean The temporary memory of the target system is insufficient for
expression to complex the size of the expression. Divide up the expression into
several partial expressions thereby using assignments to
intermediate variables.
3201 <name> (<network>): A Internal jumps can not be resolved. Activate option "Use 16
network must not result bit Sprungoffsets" in the 68k target settings.
in more than 512 bytes
of code
3202 Stack overrun with A nested function call CONCAT(x, f(i)) is used. This can lead
nested to data loss. Divide up the call into two expressions.
string/array/structure
function calls
3203 Expression too complex Divide up the assignment in several expressions.
(too many used
address registers).
3204 A jump exceeds 32k Jump distances may not be bigger than 32767 bytes.
Bytes
3205 Internal Error: Too In a POU there at the most 3000 string constants may be
many constant strings" used.
In a POU there at the
most 3000 string
constants may be used.
3206 Function block data A function block may produce maximum 32767 Bytes of
exceeds maximal size code.
3207 Array optimization The optimization of the array accesses failed because during

BRESIMAR <j.andril@bresimar.pt> Anexo B – 5 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
index calculation a function has been called.
3208 Conversion not A conversion function is used, which is not implemented for
implemented yet the actual code generator.
3209 Operator not A operator is used, which is not implemented for this data
implemented type and the actual code generator. MIN(string1,string2).
3210 Function '<name>' not A function is called, which is not available in the project.
found
3211 Max string usage A variable of type string can be used in one expression 10
exceeded times at the most.
3250 Real not supported for The target is currently not supported.
8 Bit Controller
3251 date of day types are The target is currently not supported.
not supported for 8 Bit
Controller
3252 size of stack exceeds The target is currently not supported.
<number> bytes
3253 Could not find hex file: The target is currently not supported.
'<name>'
3254 Call to external library The target is currently not supported.
function could not be
resolved.
3400 An error occurred The .exp file contains an incorrect access variables section.
during import of Access
variables
3401 An error occurred The .exp file contains an incorrect configuration variables
during import of section.
variable configuration
3402 An error occurred The .exp file contains an incorrect global variables section.
during import of global
variables
3403 Could not import The section for object <name> in the .exp file is not correct.
<name>
3404 An error occurred The section for the task configuration the .exp file is not
during import of task correct.
configuration
3405 An error occurred The section for the PLC configuration in the .exp file is not
during import of PLC correct.
configuration
3406 Two steps with the The section for the SFC POU in the .exp file contains two
name '<name'. Second steps with equal names. Rename one of the steps in the
step not imported. export file.
3407 Predecessor step The step <name> is missing in the .exp file.
'<name>' not found
3408 Successor step The step <name> is missing in the .exp file.
'<name>' not found
3409 No successional In the .exp file a transition is missing, which requires step
transition for step ‘<´name>' <name> as preceeding step.

3410 No successional step In the .exp file a step is missing which requires the transition
for transition '<name>' <name> as preceeding condition.
3411 Step '<name>' not In the .exp file the connection between step <name> and the
reachable from initial step initial step is missing.

3450 PDO'<PDO-name>': Click on the button ‚Properties’ in the PLC configuration


Missing COB-Id! dialog for the module and enter a COB ID for the PDO <PDO
Name>.
3451 Error during load: EDS- Eventually the device file needed for the CAN configuration
File '<name>' could not is not in the correct directory. Check the directory setting for
be found, but is configuration files in ‚Project' 'Options' 'Directories'.
referenced in hardware
configuration!
3452 The module '<name>' The device file for module <name> does not fit to the current
couldn't be created! configuration. Eventually it has been modified since the
configuration has been set up or it is corrupted.
3453 The channel '<name>' The device file for channel <name> does not fit to the current
couldn't be created! configuration. Eventually it has been modified since the
configuration has been set up or it is corrupted.
3454 The address '<name>' Option 'Check for overlapping addresses' is activated in the

BRESIMAR <j.andril@bresimar.pt> Anexo B – 6 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
points to an used dialog ‚Settings’ of the PLC configuration and an overlap has
memory! been detected. Regard, that the area check is based on the
size which results of the data types of the modules, the size
which is given by the entry ‚size’ in the configuration file.
3455 Error during load: GSD- Eventually the device file required by the Profibus
File '<name>' could not configuration is not in the correct directory. . Check the
be found, but is directory setting for configuration files in ‚Project' 'Options'
referenced in hardware 'Directories'.
configuration!
3456 The profibus device The device file for module <name> does not fit to the current
'<name>' couldn't be configuration. Eventually it has been modified since the
created! configuration has been set up or it is corrupted.
3457 Error in module Please check the device file of this module.
description!
3500 No 'VAR_CONFIG' for Insert a declaration for this variable in the global variable list
'<name>' which contains the 'Variable_Configuration'.
3501 No address in Assign an address to this variable in the global variable list
'VAR_CONFIG' for which contains the 'Variable_Configuration'.
'<name>'.
3502 Wrong data type for In the global variables list which contains the‚
'<name>' in 'VAR_CONFIG ‘Variable_Configuration’ the variable is declared with a
different data type than in the POU.
3503 Wrong data type for In the global variables list which contains the‚
'<name>' in 'VAR_CONFIG' ’Variable_Configuration’ the variable is declared with a
different address than in the POU.
3504 Initial values are not A variable of the ‚Variable_Configuration’ is declared with
supported for address and initial value. But an initial value can only be
'VAR_CONFIG defined for input variables without address assignment.
3505 '<name>’is no valid The Variable_Configuration contains a nonexisting variable.
instance path
3506 Access path expected In the global variable list for Access Variables the access
path for a variable is not correct. Correct:
<Identifier>:'<Access path>':<Type> <Access mode>
3507 No address The global variable list for Access Variables contains an
specification for address assignment for a variable. This is not allowed. Valid
'VAR_ACCESS'- variable definition: <Identifier>:'<Access path>':<Type>
variables <Access mode>
3550 Duplicate definition of There are two tasks are defined with an identic same name.
identifier '<name>' Rename one of them.
3551 The task '<name>' must Insert a program call or delete task.
contain at least one
program call
3552 Event variable There is an event variable set in the ‘Single’ field of the task
'<name>' in task '%s' properties dialog which is not declared globally in the project.
not defined Use another variable or define the variable globally.
3553 "Event variable Use a variable of type BOOL as event variable in the ‘Single’
'<name>' in task '%s' field of the task properties dialog.
must be of type 'BOOL'
3554 Task entry '<name>' In the field ‚Program call’ a function or a not defined POU is
must be a program or entered. Enter a valid program name.
global function block
instance
3555 The task entry In the field ‚Append program call’ there are parameters used
'<name>' contains which do not comply with the declaration of the program
invalid parameters POU.
3600 Implicit variables not Use command ‚Rebuild all’. If nevertheless you get the error
found! message again please contact the PLC manufacturer.
3601 <name> is a reserved The given variable is declared in the project, although it is
variable name reserved for the codegenerator. Rename the variable.
3610 '<name>' not supported The given feature is not supported by the current version of
the programming system.
3611 The given compile There is an invalid directory given in the ‚Project’ ‚Options’
directory '<name>' is ‚Directories’ for the Compile files.
invalid
3612 Maximum number of Too many POUs and data types are used in the project.
POUs (<number>) Modify the maximum number of POUs in the Target
exceeded! Compile is Settings / Memory Layout.
aborted.

BRESIMAR <j.andril@bresimar.pt> Anexo B – 7 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
3613 Build canceled The compile process was cancelled by the user.
3614 Project must contain a Create an init POU of type Program (e.g. PLC_PRG) or set
POU named up a task configuration.
'<name>' (main routine)
or a task configuration
3615 <name> (main routine) A init POU (e.g. PLC_PRG) is used in the project which is
must be of type not of type Program.
program
3616 Programs musn't be The project which should be saved as an external library
implemented in external contains a program. This will not be available, when the
libraries library will be used.
3617 Out of memory Increase the virtual memory capacity of your computer.
3618 BitAccess not The code generator for the currently set target system does
supported in current not support bit access on variables.
code generator!
3700 POU with name A POU name is used in the project, which is already used for
‘<name>' is already in a library POU. Rename the POU.
library '<name>'
3701 Name used in interface Use command ‘Project’ ‘Rename object’ to rename the POU
is not identical with in the object organizer, or change the name of the POU in
POU Name the declaration window. There the POU name has to be
placed next to one of the keywords PROGRAM, FUNCTION
or FUNCTIONBLOCK.
3702 Overflow of identifier list Maximum 100 identifiers can be entered in one variable
declaration.
3703 Duplicate definition of Take care that there is only one identifier with the given
identifier '<name>' name in the declaration part of the POU.
3905 data recursion: A FB instance was used, which needs itself.
<POU 0> -> <POU 1> -
> .. -> <POU 0>
3720 Address expected after Add a valid address after the keyword AT or modify the
'AT' keyword.
3721 Only 'VAR' and Put the declaration to a VAR or VAR_GLOBAL declaration
'VAR_GLOBAL' can be area.
located to addresses
3722 Only 'BOOL' variables Modify the address or modify the type of the variable to
allowed on bit which the address is assigned.
addresses
3729 Invalid type '<name>' at The type of this variable cannot be placed on the given
address: '<name>' address. Example: For a target system working with
‘alignment 2’ the following declaration is not valid: var1 AT %
IB1:WORD;
3740 Invalid type: '<name>' An invalid data type is used in a variable declaration.
3741 Expecting type A keyword or an operator is used instead of a valid type
specification identifier.
3742 Enumeration value In the definition of the enumeration type an identifier is
expected missing after the opening bracket or after a comma between
the brackets.
3743 Integer number Enumerations can only be initialized with numbers of type
expected INT.
3744 Enum constant Check if you have followed the following rules for the
'<name>' already definition of enumeration values:
defined. - Within one enum definition all values have to be unique.
- Within all global enum definitions all values have to be
unique.
- Within all local enum definitions all values have to be
unique
3745 Subranges are only Subrange types can only be defined resting on integer data
allowed on Integers! types.
3746 Subrange '<name>' is One of the limits set for the range of the subrange type is out
not compatible with of the range which is valid for the base type.
Type '<name>'
3747 unknown string length: There is a not valid constant used for the definition of the
'<name>' string length.
3748 More than three More than the allowed three dimensions are given in the
dimensions are not definition of an array. If applicable use an ARRAY OF
allowed for arrays ARRAY.
3749 lower bound '<name>' There is a not defined constant used to define the lower limit

BRESIMAR <j.andril@bresimar.pt> Anexo B – 8 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
not defined for a subrange or array type.
supported in current not support bit access on variables.
code generator!
3700 POU with name A POU name is used in the project, which is already used for
‘<name>' is already in a library POU. Rename the POU.
library '<name>'
3701 Name used in interface Use command ‘Project’ ‘Rename object’ to rename the POU
is not identical with in the object organizer, or change the name of the POU in
POU Name the declaration window. There the POU name has to be
placed next to one of the keywords PROGRAM, FUNCTION
or FUNCTIONBLOCK.
3702 Overflow of identifier list Maximum 100 identifiers can be entered in one variable
declaration.
3703 Duplicate definition of Take care that there is only one identifier with the given
identifier '<name>' name in the declaration part of the POU.
3905 data recursion: A FB instance was used, which needs itself.
<POU 0> -> <POU 1> -
> .. -> <POU 0>
3720 Address expected after Add a valid address after the keyword AT or modify the
'AT' keyword.
3721 Only 'VAR' and Put the declaration to a VAR or VAR_GLOBAL declaration
'VAR_GLOBAL' can be area.
located to addresses
3722 Only 'BOOL' variables Modify the address or modify the type of the variable to
allowed on bit which the address is assigned.
addresses
3729 Invalid type '<name>' at The type of this variable cannot be placed on the given
address: '<name>' address. Example: For a target system working with
‘alignment 2’ the following declaration is not valid: var1 AT %
IB1:WORD;
3740 Invalid type: '<name>' An invalid data type is used in a variable declaration.
3741 Expecting type A keyword or an operator is used instead of a valid type
specification identifier.
3742 Enumeration value In the definition of the enumeration type an identifier is
expected missing after the opening bracket or after a comma between
the brackets.
3743 Integer number Enumerations can only be initialized with numbers of type
expected INT.
3744 Enum constant Check if you have followed the following rules for the
'<name>' already definition of enumeration values:
defined. - Within one enum definition all values have to be unique.
- Within all global enum definitions all values have to be
unique.
- Within all local enum definitions all values have to be
unique
3745 Subranges are only Subrange types can only be defined resting on integer data
allowed on Integers! types.
3746 Subrange '<name>' is One of the limits set for the range of the subrange type is out
not compatible with of the range which is valid for the base type.
Type '<name>'
3747 unknown string length: There is a not valid constant used for the definition of the
'<name>' string length.
3748 More than three More than the allowed three dimensions are given in the
dimensions are not definition of an array. If applicable use an ARRAY OF
allowed for arrays ARRAY.
3749 lower bound '<name>' There is a not defined constant used to define the lower limit
not defined for a subrange or array type.
3903 Invalid duration The notation of the constant does not comply with the
constant IEC61131-3 format.
3904 Overflow in duration The value used for the time constant cannot be represented
constant. in the internal format. The maximum value which is
representable is t#49d17h2m47s295ms
3905 Invalid date constant The notation of the constant dies not comply with the
IEC61131-3 format.
3906 Invalid time of day The notation of the constant dies not comply with the
constant IEC61131-3 format.
3907 Invalid date and time The notation of the constant dies not comply with the
constant IEC61131-3 format.

BRESIMAR <j.andril@bresimar.pt> Anexo B – 9 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
3908 Invalid string constant The string constant contains an invalid character.
4000 Identifier expected Enter a valid identifier at this position.
4001 Variable '<name>' not Declare variable local or global.
declared
4010 Type mismatch: Cannot Check what data type the operator expects (Browse Online
convert '<name>' to Help for name of operator) and change the type of the
'<name>'. variable which has caused the error, or select another
variable.
4011 Type mismatch in The data type of the actual parameter cannot be
parameter '<name>' of automatically converted to that of the formal parameter. Use
'<name>': Cannot a type conversion or use another variable type.
convert '<name>' to
'<name>'.
4012 Type mismatch in A value with the invalid type <Typ2> is assigned to the input
parameter '<name>' of variable '<name>'. Replace the variable or constant to one of
'<name>': Cannot type <Typ1> or use a type conversion respectively a
convert '<name>' to constant with type-prefix.
'<name>'.
4013 Type mismatch in A value with the invalid type <Typ2> is assigned to the
output '<name>' of output variable '<name>'. Replace the variable or constant to
'<name>': Cannot one of type <Typ1> or use a type conversion respectively a
convert '<name>' to constant with type-prefix.
'<name>'.
4014 Typed literal: Cannot The type of the constant is not compatible with the type of
convert '<name>' to the prefix. Example: SINT#255
'<name>
4015 Data type ‘<name>' Direct bit addressing is only allowed for Integer- and Bitstring
illegal for direct bit data types. You are using a variable var1 of type
access REAL/LREAL or a constant in bit access <var1>.<bit>.
4016 Bit index '<number>' You are trying to access a bit which is not defined for the
out of range for variable data type of the variable.
of type '<name>
4017 'MOD' is not defined for The operator MOD can only be used for integer and bitstring
'REAL data types.
4020 Variable with write Replace the first operand by a variable with write access.
access or direct
address required for
'ST', 'STN', 'S', 'R'
4021 No write access to Replace the variable by a variable with write access.
variable '%s' allowed
4022 Operand expected Add an operand behind the command.
4023 Number expected after Enter a digit.
'+' or '-'
4024 <operator 0> or Enter a valid operand at the named position.
<operator 1> or ...
expected before
'<name>'
4025 ':=' or '=>' expected Enter one of the both operators at the named position.
before '<name>'
4026 'BITADR' expects a bit Use a valid bit address (e.g. %IX0.1).
address or a variable
on a bit address
4027 Integer number or Enter a integer number or the identifier of a valid constant.
symbolic constant
expected
4028 'INI' operator needs Check the data type of the variable, for which the INI
function block instance operator is used.
or data unit type
instance
4029 Nested calls of the At not reentrant target systems and in simulation mode a
same function are not function call may not contain a call of itself as a parameter.
possible. Example: fun1(a,fun1(b,c,d),e); Use a intermediate table.
4030 Expressions and Replace the constant or the expression by a variable or a
constants are not direct address.
allowed as operands of
'ADR'
4031 'ADR' is not allowed on Use BITADR. Please note: The BITADR function does not
bits! Use 'BITADR' return a physical memory address

BRESIMAR <j.andril@bresimar.pt> Anexo B – 10 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
instead.
4032 ’<number>’ operands Check how many operands the named operator requires and
are too few for add the missing operands.
'<name>'. At least
‘<number>’ are needed
4033 ’<number>’ operands Check how many operands the named operator requires and
are too many for remove the surplus operands.
'<name>'. At least
‘<number>’ are needed
4034 Division by 0 You are using a division by 0 in a constant expression. If you
want to provocate a runtime error, use – if applicable - a
variable with the value 0.
4035 ADR must not be An address access on constants for which the direct values
applied on 'VAR are used, is not possible. If applicable, deactivate the option
CONSTANT' if ‚Replace Constants’ in ‚Project’ ‚Options’ ‚Build’.
'replaced constants' is
activated
4040 Label '<name>' is not Define a label with the name <LabelName> or change the
defined name <LabelName> to that of a defined label.
4041 Duplicate definition of The label '<name>' is multiple defined in the POU. Rename
label '<name>' the label or remove one of the definitions.
4042 No more than %d The number of jump labels is limited to '<Anzahl>'. Insert a
labels in sequence are dummy instruction.
allowed
4043 Format of label invalid. The label name is not valid or the colon is missing in the
A label must be a name definition.
optionally followed by a
colon.
4050 POU '%s' is not defined Define a POU with the name '<name>' using the command
‘Project’ ‘Add Object’ or change '<name>' to the name of a
defined POU.
4051 '%s' is no function Use instead of <name> a function name which is defined in
the project or in the libraries.
4052 '%s' must be a declared Use an instance of data type '<name>' which is defined in
expected before
'<name>'
4025 ':=' or '=>' expected Enter one of the both operators at the named position.
before '<name>'
4026 'BITADR' expects a bit Use a valid bit address (e.g. %IX0.1).
address or a variable
on a bit address
4027 Integer number or Enter a integer number or the identifier of a valid constant.
symbolic constant
expected
4028 'INI' operator needs Check the data type of the variable, for which the INI
function block instance operator is used.
or data unit type
instance
4029 Nested calls of the At not reentrant target systems and in simulation mode a
same function are not function call may not contain a call of itself as a parameter.
possible. Example: fun1(a,fun1(b,c,d),e); Use a intermediate table.
4030 Expressions and Replace the constant or the expression by a variable or a
constants are not direct address.
allowed as operands of
'ADR'
4031 'ADR' is not allowed on Use BITADR. Please note: The BITADR function does not
bits! Use 'BITADR' return a physical memory address
instead.
4032 ’<number>’ operands Check how many operands the named operator requires and
are too few for add the missing operands.
'<name>'. At least
‘<number>’ are needed
4033 ’<number>’ operands Check how many operands the named operator requires and
are too many for remove the surplus operands.
'<name>'. At least
‘<number>’ are needed
4034 Division by 0 You are using a division by 0 in a constant expression. If you
want to provocate a runtime error, use – if applicable - a

BRESIMAR <j.andril@bresimar.pt> Anexo B – 11 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
variable with the value 0.
4035 ADR must not be An address access on constants for which the direct values
applied on 'VAR are used, is not possible. If applicable, deactivate the option
CONSTANT' if ‚Replace Constants’ in ‚Project’ ‚Options’ ‚Build’.
'replaced constants' is
activated
4040 Label '<name>' is not Define a label with the name <LabelName> or change the
defined name <LabelName> to that of a defined label.
4041 Duplicate definition of The label '<name>' is multiple defined in the POU. Rename
label '<name>' the label or remove one of the definitions.
4042 No more than %d The number of jump labels is limited to '<Anzahl>'. Insert a
labels in sequence are dummy instruction.
allowed
4043 Format of label invalid. The label name is not valid or the colon is missing in the
A label must be a name definition.
optionally followed by a
colon.
4050 POU '%s' is not defined Define a POU with the name '<name>' using the command
‘Project’ ‘Add Object’ or change '<name>' to the name of a
defined POU.
4051 '%s' is no function Use instead of <name> a function name which is defined in
the project or in the libraries.
4052 '%s' must be a declared Use an instance of data type '<name>' which is defined in
4202 Unexpected end of text Insert a closing bracket after the text.
in brackets
4203 <name> in brackets not The operator <name> is not valid in a IL bracket expression.
allowed (not valid are: 'JMP', 'RET', 'CAL', 'LDN', 'LD', 'TIME')
4204 Closing bracket with no Insert an opening bracket or remove the closing one.
corresponding opening
bracket
4205 No comma allowed Remove comma after closing bracket.
after ')'
4206 Label in brackets not Shift jump label so that it is outside of the brackets.
allowed
4207 'N' modifier requires The N modifier requires a data type, for which a boolean
operand of type negation can be executed.
'BOOL', 'BYTE',
'WORD' or 'DWORD'
4208 Conditional Operator Make sure that the expression gives out a boolean result or
requires type 'BOOL' use a type conversion.
4209 Function name not Replace the function call by a variable or a constant.
allowed here
4210 'CAL', 'CALC' and Declare an instance of the function block which you want to
'CALN' require a call.
function block instance
as operand
4211 Comments are only Shift the comment to the end of the line or to an extra line.
allowed at the end of
line in IL
4212 Accumulator is invalid The accu is not defined. This happens if an instruction is
before conditional preceeding which does not submit a result (e.g. 'CAL').
statement
4213 'S' and 'R' require Use a boolean variable at this place.
'BOOL' operand
4250 Another 'ST' statement The line does not start with a valid ST instruction.
or end of POU
expected
4251 Too many parameters There are more parameters given than are declared in the
in function '%s' definition of the function.
4252 Too few parameters in There are less parameters given than are declared in the
function '%s' definition of the function.
4253 'IF' or 'ELSIF' require Make sure that the condition for IF or ELSIF is a boolean
'BOOL' expression as expression.
condition
4254 'WHILE' requires Make sure that the condition following the ‘WHILE’ is a
'BOOL' expression as boolean expression.
condition
4255 'UNTIL' requires 'BOOL' Make sure that the condition following the ‘UNTIL’ is a

BRESIMAR <j.andril@bresimar.pt> Anexo B – 12 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
expression as condition boolean expression.
4256 'NOT' requires 'BOOL' Make sure that the condition following the ‘NOT’ is a boolean
operand expression.
4257 Variable of 'FOR' Make sure that the counter variable is of an integer or
statement must be of bitstring data type (e.g. DINT, DWORD).
type 'INT'
4258 Expression in 'FOR' Replace the counter variable by a variable with write access.
statement is no variable
with write access
4259 Start value in 'FOR' The start value in the ‚FOR' instruction must be compatible
statement is no variable to the type of the counter variable.
with write access
4260 End value of 'FOR' The end value in the ‚FOR' instruction must be compatible to
statement must be of the type of the counter variable.
type 'INT'
4261 Increment value of The incremental value in the ‚FOR' instruction must be
'FOR' statement must compatible to the type of the counter variable.
be of type 'INT'
4262 'EXIT' outside a loop Use 'EXIT' only within 'FOR', 'WHILE' or 'UNTIL' instructions.
4263 Expecting Number, Within a ‘CASE' expression you only can use a number or a
'ELSE' or 'END_CASE' 'ELSE' instruction or the ending instruction 'END_CASE'.
4264 'CASE' requires Make sure that the selector is of an integer or bitstring data
selector of an integer type (e.g. DINT, DWORD).
type
4265 Number expected after ',' In the enumeration of the CASE selectors there must be
inserted a further selector after a comma.
4266 At least one statement Insert an instruction, at least a semicolon.
is required
4267 Function block call The identifier in the functionblock call is no instance. Declare
requires function block an instance of the desired functionblock or use the name of
instance an already defined instance.
4268 Expression expected Insert an impression here.
4269 'END_CASE' expected Terminate the 'CASE' instruction after the 'ELSE' part with an
after 'ELSE'-branch 'END_CASE'.
4270 'CASE' constant '%ld' A 'CASE' selector may only be used once within a ‘CASE'
already used instruction.
4271 The lower border of the Modify the area bounds for the selectors so that the lower
range is greater than border is not highte than the upper border.
the upper border.
4272 Exptecting parameter You can edit a function call in that way, that also the
'%s' at place %d in call parameter names are contained, not only the parameter
of '%s'! values. But nevertheless the position (sequence) of the
parameters must be the same as in the function definition.
4273 Parts of the 'CASE'- Make sure that the areas for the selectors which are used in
Range '%ld..%ld' the CASE instruction, don’t overlap.
already used in Range
'%ld..%ld'
4274 Multiple 'ELSE' branch A CASE instruction may not contain more than one ‚ELSE'
in 'CASE' statement instruction.
4300 Jump requires 'BOOL' Make sure that the input for the jump respectively the
as input type RETURN instruction is a boolean expression.
4301 POU '%s' need exactly The number of inputs does not correspond to the number of
%d inputs VAR_INPUT and VAR_IN_OUT variables which is given in
the POU definition.
4302 POU '%s' need exactly The number of outputs does not correspond to the number of
%d outputs VAR_OUTPUT variables which is given in the POU
definition.
4303 '%s' is no operator Replace '<name>' by a valid operator.
4320 Non-boolean The switch signal for a contact must be a boolean
expression '<name>' expression.
used with contact
4321 Non-boolean The output variable of a coil must be of type BOOL.
expression '<name>'
used with coil
4330 Expression expected at Assign an input or an expression to the input EN of POU
input 'EN' of the box '<name>’.
'<name>'
4331 Expression expected at The input <number> of the operator POU is not assigned.

BRESIMAR <j.andril@bresimar.pt> Anexo B – 13 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
input '<number>' of the
box '<name>'
4332 Expression expected at The input of the POU is of type VAR_IN_OUT and is not
input '<name>' of the assigned.
box '<name>'
4333 Identifier in jump The given jump mark is not a valid identifier.
expected
4334 Expression expected at Assign a boolean expression to the input of the jump. If this
the input of jump is TRUE, the jump will be executed.
4335 Expression expected at Assign a boolean expression to the input of the RETURN
the input of the return instruction. If this is TRUE, the jump will be executed.
4336 Expression expected at Assign a suitable expression to the output box.
the input of the output
4337 Identifier for input Insert a valid expression or identifier in the input box.
expected
4338 Box '%s' has no inputs To none of the inputs of the operator POU '<name>' a valid
expression is assigned.
4339 Typemismatch at The type of the expression in the output box is not
output: Cannot convert compatible to that of the expression which should be
'<name>' to '<name>'. assigned to it.
4340 Jump requires 'BOOL' Make sure that the input for the jump is a boolean
as input type expression.
4341 Return requires 'BOOL' Make sure that the input for the RETURN instruction is a
as input type boolean expression.
4342 Expression expected at Assign a valid boolean expression to the EN input of the box.
input 'EN' of the box
'<name>'
4343 Values of Constants: Input '<name>' of box '<name>' is declared as VAR_INPUT
‘<name>’ CONSTANT. But to this POU box an expression has been
assigned in the dialog 'Edit Parameters' which is not type
compatible.
4344 'S' and 'R' require Insert a valid boolean expression after the Set resp. Reset
'BOOL' operand instruction.
4345 Invalid Type for An expression is assigned to input '<name>' of POU box
parameter '<name>' of '<name>' which is not type compatible.
'<name>': Cannot
convert '<type>' to
'<type>'.
4346 Not allowed to use a You can only assign an output to a variable or a direct
constant as an output" address with write access.
4347 'VAR_IN_OUT' To VAR_IN_OUT parameters only variables with write
parameter needs access can be handed over, because these can be modified
variable with write within the POU.
access as input.
4350 An SFC-Action can not SFC actions only can be called within the SFC POU in which
be accessed from they are defined.
outside!
4351 Step name is no Rename the step or choose a valid identifier as step name.
identifier: '<name>'
4352 Extra characters Remove the not valid characters in the step name.
following valid step
name:'<name>'
4353 Step name duplicated: Rename one of the steps.
'<name>'
4354 Jump to undefined Choose an existent step name as aim of the jump resp.
Step: '<name>' insert a step with name ‚<name>’.
4355 A transition must not A transition must be a boolean expression.
have any side effects
(Assignments, FB-Calls
etc.)
4356 Jump without valid Step Use a valid identifier as aim (mark) of the jump.
Name: '<name>'
4357 IEC-Library not found Check whether the library iecsfc.lib is inserted in the library
manager and whether the library paths defined in ‘Project’
‘Options’ ‘Paths’are correct.
4358 Action not declared: '% Make sure that in the object organizer the action of the IEC
s'. step is inserted below the SFC POU and that in the editor
the action name is inserted in the box on the right hand of

BRESIMAR <j.andril@bresimar.pt> Anexo B – 14 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
the qualifier.
4359 Invalid Qualifier: '%s' In the box on the left hand of the action name enter a
qualifier for the IEC action.
4360 Time Constant Enter next to the box on the left hand of the action name a
expected after qualifier time constant behind the qualifier.
'%s'
4361 '%s' is not the name of Enter next to the box on the right hand of the qualifier the
an action name of an action or the name of a variable which is defined
in the project.
4362 Nonboolean expression Insert a boolean variable or a valid action name.
used in action: '%s'
4363 IEC-Step name already Please rename the step or the variable.
used for variable:
'<name>'
4364 A transition must be a The result of the transition expression must be of type
boolean expression BOOL.
4365 Time Constant Open dialog ‚step attributes’ for the step '<name>' and enter
expected after qualifier a valid time variable or time constant
'<name>'
4366 The label of the parallel Enter a valid identifier next to the triangle which marks the
branch is no valid jump label.
identifier: '<name>'
4367 The label '<name>' is There is already a jump label or a step with this name.
already used Please rename correspondingly.
4368 Action '<name>' is used The action '<name>' is used in the POU as well as in one or
in multiple step chains, several actions of the POU.
where one is containing
the other!
4369 Exactly one network There are used several FBD resp. LD networks for a
required for a transition transition. Please reduce to 1 network.
4370 Additional lines found Remove the not needed lines at the end of the transition.
after correct IL-
transition
4371 Invalid characters Remove the not needed characters at the end of the
following valid transition.
expression: '<name>
4400 Import / conversion of The POU cannot be converted to IEC 61131-3 completely.
POU '%s' contains
errors resp. is not
complete.
4401 S5 time constant %lu There is no valid BCD coded time in the accu.
seconds is too big
(max. 9990s).
4402 Direct access to I/Os Make sure that you only access variables which are defined
allowed only. as input or output.
4403 STEP5/7 instruction Some STEP5/7 commands are not convertable to IEC
invalid or not 61131-3, e.g. CPU commands like MAS.
convertible to IEC
61131-3.
4404 STEP5/7 operand Some STEP5/7 operands are not convertable to IEC 61131-
invalid or not 3 respectively an operand is missing.
convertible to IEC
61131-3.
4405 Reset of a STEP5/7 The corresponding IEC timer have no reset input.
timer cannot be
converted into IEC
61131-3.
4406 STEP5/7 Counter There is no valid BCD coded counter constant in the accu.
constant out of range
(max. 999).
4407 STEP5 instruction not Some STEP5/7 instructions cannot be converted to IEC
convertible to IEC 61131-3, e.g. DUF.
61131-3.
4408 Bit access of timer or Special timer/counter commands are not convertable into
counter words not IEC 61131-3.
convertible into IEC
61131-3.
4409 Contents of ACCU1 or A command, which connects the both accus, cannot be

BRESIMAR <j.andril@bresimar.pt> Anexo B – 15 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
ACCU2 undefined, not converted, because the accu values are not defined.
convertible into IEC
61131-3.
4410 Called POU not in Import the called POU.
project.
4411 Error in global variable Please check the SEQ file.
list.
4412 Internal error no.11 Please contact the PLC manufacturer.
4413 Error in format of line in In the code which should be imported there is an erroneous
data block date.
4414 FB/FX name missing. In the original S5D file the symbolic name of an (extended)
POU is missing.
4415 Instruction after block A protected POU cannot get imported
end not allowed.
4416 Invalid Command The S5/S7 command cannot be disassembled.
4417 Comment not closed Close the comment with "*)".
4418 FB/FX-Name too long The symbolic name of an (extended) POU is to long.
(max. 8 characters)
4419 Expected format of line Correct the line correspondingly.
""(* Name: <FB/FX-
Name> *)""
4420 Name of FB/FX Check the POUs.
parameter missing
4421 Type of FB/FX Check the POUs.
parameter invalid
4422 Type of FB/FX Check the POUs.
parameter missing
4423 Invalid FB/FX call Check the interface of the POU.
parameter
4424 Warning: FB/FX for call The called POU is not imported yet or is not correct or has
either missing or no parameters (in the last case you can ignore the error
parameters invalid or message).
has '0' parameters
4425 Definition of label The aim (label) of the jump is not defined.
missing
4426 POU does not have a Modify the POU name.
valid STEP 5 block
name, e.g. PB10
4427 Timer type not declared Add a declaration of the timer in the global variables list.
4428 Maximum number of You may not use more than seven open brackets.
open STEP5 brackets
exceeded
4429 Error in name of formal The parameter name may not exceed four characters.
parameter
4430 Type of formal In IEC 61131-3 Timer, counter and POUs cannot be
parameter not IEC- converted as formal parameters.
convertible
4431 Too many A POU may not contain more than 16 formal parameters as
'VAR_OUTPUT' outputs.
parameters for a call in
STEP5 STL
4432 Labels within an In IEC 61131-3 jump labels may not be inserted at any
expression are not desired position.
allowed
4434 Too many labels A POU may not contain more than 100 labels.
4435 After jump / call, a new After jump or call a Load command LD must follow.
expression must start
4436 Bit result undefined, not The command which is used by VKE cannot get converted,
convertible to IEC because the value of the VKE is not known.
61131-3.
4437 Type of instruction and A bit command is used for a word operand or the other way
operand are not round.
compatible
4438 No data block opened Insert a „A DB“.
(insert instruction C DB
before)
4500 Unrecognized variable The watch variable is not declared within the project. By
or address pressing <F2> you get the input assistant which lists the

BRESIMAR <j.andril@bresimar.pt> Anexo B – 16 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology
declared variables.
4501 Extra characters Remove the surplus signs.
following valid watch
expression
4520 Error in Pragma: Flag The pragma is not correct. Check whether ‘<name>' is a
expected before valid flag.
'<name>'!
4521 Error in Pragma: Check whether pragma is composed correctly.
Unexpected element
'<name>'!
4522 "flag off' pragma The switch off of the pragma is missing, add a 'flag off'
expected! instruction.
4550 Index out of defined Ensure that the index is within the area which is defined in
range : Variable OD the target settings/ networkfunctionality.
"number>, Line <line
number>.
4551 Subindex out of defined Ensure that the subindex is within the area which is defined
range : Variable OD in the target settings /networkfunctionality.
"number>, Line <line
number>.
4552 Index out of defined Ensure that the index is within the area which is defined in
range : Parameter OD the target settings /networkfunctionality
"number>, Line <line
number>.
4553 Subindex out of defined Ensure that the subindex is within the area which is defined
range : Parameter OD in the target settings /networkfunctionality.
"number>, Line <line
number>.
4554 Variablename invalid: Enter a valid project variable in the filed ‚variable’. Use the
Variable OD <number>, syntax <POU name>.<variable name> resp. for global
Line <line number>. variables .<variable name>
4555 Empty table-entry, input You must make an entry in this field.
not optional: Parameter
OD <number>, Line
<line number>
4556 Empty table-entry, input You must make an entry in this field.
not optional: Variable
OD <number>, Line
<number>

BRESIMAR <j.andril@bresimar.pt> Anexo B – 17 de 18


TWINCAT PLC – Lista de erros BECKHOFF New Automation Technology

BRESIMAR <j.andril@bresimar.pt> Anexo B – 18 de 18

Вам также может понравиться