12
Structured lab text problems

Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Embed Size (px)

Citation preview

Page 1: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Structured lab text problems

Page 2: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Latching

• In ladder logic it is very easy to latch.• Consider the following implementation of the

seal circuit on the next slide

Page 3: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next
Page 4: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

To implement this program in structured text we need to implement a latch

Page 5: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Structured text programIF (NO_PB=TRUE AND NC_PB=TRUE AND Int_relay=FALSE THEN(*conditions to latch the output on - not latch must be off and the latch is set when the

output goes on*)Int_relay:=TRUE; (*latch is set*)Output:=TRUE; (*turns on output*)END_IF

IF (NC_PB=FALSE AND Int_relay=TRUE) THEN (*conditions to latch the output off - note latch must be set to enter into this routinet*)Int_relay:=FALSE;(*latch is reset*)Output:=FALSE;(*turns off output*)END_IF

Page 6: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Program definitions

• PROGRAM PLC_PRG• VAR• Int_relay: BOOL :=FALSE;• END_VAR

Page 7: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Global variables that interact with the operator screen

• VAR_GLOBAL• NC_PB: BOOL:=1; (*static declaration*)• NO_PB: BOOL;• Output: BOOL;• END_VAR

Page 8: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Implementation of a timer using structured text

• To implement a time one calls up the timer function.

• Consider the following problem• A Normally open pushbutton (NO_PB) causes

a delayed start to a motor of 10s.• If the stop push button has been pressed again

the motor switches off and the timer is reset.

Page 9: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next
Page 10: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Structured text code

IF NO_PB=TRUE THENmotor_start:=TRUE;END_IF

timer(IN:= motor_start, PT:= t#10s , Q=>motor_on , ET=> );

IF NC_PB=FALSE THENmotor_start:=FALSE;END_IF

Page 11: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Local variables

PROGRAM PLC_PRGVAR

motor_start: BOOL;timer:TON;

END_VAR

(*note that the timer has been assigned the type timer_on ‘TON’ which is created by the insertion of a function block TON)

Page 12: Structured lab text problems. Latching In ladder logic it is very easy to latch. Consider the following implementation of the seal circuit on the next

Global Variables

• VAR_GLOBAL• motor_on: BOOL;• NO_PB: BOOL;• NC_PB: BOOL:=1;• END_VAR

• (*note these are to interface with the operator screen*)