Sunteți pe pagina 1din 21

Manufacturing Automation using PLCs

CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Chapter 8: PLC Timers, Counters, Registers and Analog Input/Outputs 8.1 Timer function. 8.2 Counter function.
8.2.1 Single channel up-counter (low speed counter). 8.2.2 Two channel up-down counter.

8.3 Manual control cycle. 8.4 Working with PLC Registers and Analog Input/Output
8.4.1 Devices and registers for Toshiba T1/T1S PLC. 8.4.2 Moving data or constant between PLC registers: 8.4.3 Analog inputs/outputs using PLC registers 8.4.4 Analog inputs/outputs Programming Technique using PLC registers 8.4.5 Analog input/output PLC programming: 8.4.6 Comparing the content of a register 8.4.7 Simple Math operations using PLC registers.

8.1

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

PLC Timers, Counters, Registers and Analog Inputs/Outputs


Most industrial processes involve a time delay between sequencing processes. Some of these processes also involve counting event, e.g. counting products traveling on a conveyer. Others involve reading or writing analog signal before or during the control sequence. This chapter will cover different types of timer functions and counting instructions. It will also provide more information on using PLC registers and import or export analog signals from PLC ports.

8.1

Timer function

PLC timer function is an instruction that waits a set amount of time before doing an actuation. Different types of timers are available with different manufacturers. Here are some of them: On-Delay timer ; this covers delays turning on. For example, after detecting the input from a sensor a delay of time is considered before activating a solenoid valve. This is the most common timer. It is often called TON (timer on-delay), TIM (timer) or TMR (timer). Off-Delay timer ; this type of timers is the opposite of the on-delay timer listed above. This timer simply "delays turning off ". For example, when the solenoid actuator switched off, the solenoid valve (output) will turn off after a delay of x-seconds. It is called a TOF (timer off-delay) and is less common than the on-delay type listed above. (i.e. few manufacturers include this type of timer). Single-Shot timer ; this type of timer function used to switch an actuator on for specific period of time. This timer function used mostly with open loop control machine sequence. It is often called SS (single shot timer).

The question is how to use and enable these functions. Most PLC timer functions have 16-bit registers and no floating points are used, only integer valve is used. This because most of these PLCs use integer valve for all its registers, although more advance is (costly) PLC have floating point registers. For example, some manufacturers provide BCD for time register having integer value between 0 to 9999 or binary number (or tick) between 0 to 65535 which cover a 16-bit or 2-byte register. Each tick of this clock represents x-seconds or x-milliseconds (1/1000 seconds). For example, Toshiba PLCs offer three types of timer instructions given as follows: On-delay timers (most commonly used), Off-delay timers, and Single-shot timers The timer registers of Toshiba PLCs have five digits from 00001 to 32767. The timer valves are in tenths of second (0.1) or in hundredths of seconds (0.01) depending on the timer address selected. For example, a timer value of 12000 could mean 1200.0 second or 120.00 seconds depends on the timer address. The address of these timers along with their time value for T1-PLC is given as follows: Timer address (in decimal) T000 through T063 T064 through T255 Time value 0.1 second. 0.01 second.

Fig. 8.1 show how the timer instructions are used with illustrated examples.

8.2

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

INPUT

TON

OUTPUT
Timer address from T001 to T225 Timer function; TON, TOF or SS Timer valve 00001 to 32767

TON Execution condition (most frequently used) Input OFF ON Operation No operation (timer is not updated) Elapsed time < preset time (timer is updated) Elapsed time preset time (timer is not updated)

Output OFF OFF ON

TOF Execution condition Input OFF ON Operation Elapsed time < preset time (timer is updated) Elapsed time preset time (timer is not updated) No operation (timer is not updated) Output ON OFF ON

SS Execution condition Input OFF ON


(Start) (Stop)
X002

X001 R00 Elapsed

Operation

R00

Method 1

time < preset time (timer is updating)

Output ON OFF ON OFF

R00 (M1+) Y21 Elapsed time preset time (timer is not updating) Y21 00450 TON T002 R0A Elapsed time < preset time (timer is updating) R0A (M2+) Y22 Y22 00450 T003 Elapsed time TON preset time (timer is not R0B updating) R0B (M3+) Y23

X000/START R01 R01

Example 8.1; Three motors started as follows : (M1+, delay 45 seconds, M2+, delay 45 seconds, M3+). Develop RLL for the given sequence ? (where M1+ stand the relay driving X001/STOP R01 the motor start for motor #1, same applied for M2+ and M3+)
Timer value Timer-register address Solution : Two methods can be used develop the RLL given as follows: R00
R00 (Start) X001 (Stop) X002 R00 Method 2

Y025 Y21 (M1+) On-delay, or Off-delay or Single-shot


00900 TON T003 (M2+) (M3+)

00300

TON
R0A R0B

T013 00450

TON

T002

R0A R0B Y22 Y23

Fig.8.1, Timer functions and its application, see above example TON function; running the output Y025 after 30 seconds from pressing START push button through the internal relay R01. TOF function; switching off the output Y025 after 30 seconds from pressing STOP push button through the internal relay R01. M1+ output Y025 sec, keep SS function; can be used to switch on the 45 sec ,M2+ 45 andM3+ it on for one shot of time equal to 30 seconds after pressing START push button pressed through M1+ the internal relay R01.
M2+ M3+ 8.3

Sequencing Chart for Motor runs, Example 8-1. Fig. 8.2 RLL and sequencing chart for example 8.1.

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

A+ 20s delay AG1

B+
G2

10s delay C+

B-

C-

G3 Input switches

Address START X00 Aa+ X01 R01 aX02 B+ b+ X04 R01 a+ BR03 R02 bExample 8.2 ; Develop RLL for the given machine sequence using non-sustain andX05 sustain c+ X06 C+ R02 Flip-flop output signals ? Draw the sequencing chart of the machine sequence for both casesX07 ? cModules. CSTOP(not shown) X03 Cylinders. c+ R02 On-delay function can cR03 A+ cases. be used with both Group memory Address R03 AFlip-flop1 Machine control sequence : START, A+, 10s delay, A-,B+, 10s delay, C+, B-, C-.R01 Flip-flop2 R02 B+ R01 A+ Group I | Group II Flip-flop3| Group III R03 BR02 100 TON T01 AOutputs Address The RLL can be developed using on-delay and/or off-delay functions depend of type of control C+ A+ Y20 signals (non-sustainCR02 a- and/or sustain signals) as illustrated below, see Figs. 8.3 and 8.4; B+ AY21 Solenoids B+ Y22 R03 TON A-) , B+ , (10s TON C+), B- , CA+ START, A+, (10s BNon-sustain NonBY23 Group I | Group II B+ | Group III sustain. C+ Y24 R02 b+ 100 TON T02 C+ CY25 C+ START, (10s TOF A+), A-, B+, (10s TON C+), B- , CSustain R03 bCOutput Group I | Group II | Group III .a+ Modules Solenoids .aSustain. (a) Relay ladder logic for non-sustain outputs .b+ 100 TOF T01 R01 A+ .bR02 aB+ .c+ Switches R02 b+.c-100 TON T02 C+ START A+ R02 R01 R03 8.4 Start bOutput Modules

(b) Relay ladder logic for sustain outputs

Fig. 8.4 Sequencing chart for machine sequence given for example 8-2 using non-sustain and non-sustain and sustain Fig. 8.3 RLL usingsustain control signals. output signals for example 8.2.

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Laboratory work 8.1 : As laboratory work simulate the machine control sequence using Toshiba PLC for Example 8.2.

8.2 Counter Function


Programmable counter is a device that carries out count function. Two types of counters are exist; 1) single channel up-counter, and 2) two channels up/down-counter. The most common counter is the former type, which used to count number of events, when reached to preset value it generates an output signal. Two channel up/down counters are special counter devices used to count in either direction up or down, or both. For example, incremental optical encoder that generates two pules (A and B pules), an example of using two channel up/down counters. Furthermore, counter device can be low speed and high speed counters. The high-speed counter device is hardware integrated circuit built in inside the PLC structure, while low speed counter is a software counter (like a do loop in conventuals computer programming). The high-speed counter used for counting an event or pulses at very high frequency, which requires counter IC build-in inside the PLC. Number of the high-speed counter channels are

8.5

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

fixed specified by manufacture and must be considered when shopping PLC, e.g. 2 or 4 channels. 8.2.1 Single channel up-counter (low-speed counter) Single channel up-counter required two rungs for inputs. The first input COUNT (C) which is the pulse input, and RESET or ENABLE (E) input. Both inputs require contacts to operate. Furthermore, counter function has an output (Q). The ladder expression for counter function is as follows:
Count input Enable input
C E

CNT A

Output

FUNCTION While the enable input is ON, the counter will start to count the input pulses, which change from OFF to ON (rising edge counter). The count value stored in the counter register B. When the count value reaches the set value A, the output (Q output) that corresponding to the counter device B are turn ON. When the enable input comes OFF, B is cleared to 0 and the output and the counter device are turned OFF. The preset value for counter, A value, is in the range from 0 to 65535. EXECUTION CONDITION
Enable Input OFF ON Operation No operation (B is cleared to 0) Count value (B) < set value (A) Count value (B) set value (A) Output OFF OFF ON

Example 8.3; Consider the following RLL for single channel counter;

X001 X002 C010 C.010 Y021


5 3 4 1 2 1 2 3

Pulse input. Enable/Reset input. Counted event (register B). Preset Value (register A). Counter Output.
X01 C CNT Q C010 X00 Y25 R01

Example 8.4 ;
X001 : START contact switch. X000 : STOP contact switch. The START cycle will be executed for 5 times only as long as the counter enables (when X04 set high). The cycle will be no longer executed when the number of start push button reached 5 cycles.
X04 E 0005 X01 Y25

R01

8.6

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Example 8.5 : Modify example 7.4, see Chapter 7, to have specific repeated number of cycles using counter function, e.g. 5 repeated cycles. Modify the same RLL to have this feature. The machine cycle can be rewritten again as follows: START , A+ , repeat 5 cycles ( B + , C + , B , C ) , A . START , G1, ( G2 , G3, G 4 ) G5
START R2 E.STOP R1

The modified RLL is shown in Fig. 8.5. Note, the xp replaced by R6 memory. In this case R1 ,setting the R6 value to a logic 1 is carried out, when the counter register reaches a count number of 5. 8.2.2 Two channels up/down counter
Direction input R2 Count input Enable inputR2 U U/D C Ec+ A
Q

R1

a+

R3 E.STOP

R2

R4 R6 cThe expression of two channels up/down counter is given as follows: Output R4 E.STOP R3 Input Address START X0 E.STOP X1 R3 .a+ X2 Function .aX3 While the enableR3 input b- ON,R5 instruction counts the number of the count-input changes is this R2 E.STOP R4 .b+ X6 .bX7 from OFF to ON. The count direction (up count or down count) is selected by the state of the R4 count value is stored in the counter register A. The count value range is .c+ X8 direction input. The .cX9 from 0 to 65535.R4 R6 ca- E.STOP R5 .xp XA

Up count when the direction input is ON Down countR5 when the direction input is OFF Output Address Y21 When the enable input is OFF, the counter register A is cleared toA+ 0. .c+ R6 AY22 Execution condition
Enable input OFF ON R2 Operation R3 No operation (A is cleared to 0) Count value is not limit value (0 or 65535) R4 Count value is limit value and count input is ON C Q R1 R5 R2 R3 R2 R4 b+ E 0005 C10 B+ BOutput C+ COFF OFF ON A+ AB+ BC+ CY23 Y24 Y25 Y26

8.7

Fig. 8.5 Modified RLL using counter function for machine sequence that has option repeat of 5 times, for machine sequence steps, example 8.5.

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Example 8.6 ; Consider the following two channels up/down counter ;

Note
X005 X006 R010 C005 C.005 3 1 2 2 1 1 2 3

The transitional contact is required for the count input. Otherwise, counting is executed every scan while X005 is ON in this example.

8.3 Manual Control Cycle


In general, machine automation cycle involves an operation of a manual control cycle to resolve any possible improper operations or machine setup. For example, in some cases there are machine-jamming condition, hence it is required to resolve the problem and return the machine to its original working condition (machine parking condition). In this case, manual control cycle (some time called JOG cycle) is enabled and the automatic cycle is disabled. During manual cycle different push buttons and/or selector switches are enabled for machine user to activate/deactivate the machine actuators and resolve the machine jamming conditions or to carry out machine setup. In this section, some of these operation circuits are illustrated including the method of enable/disable both manual and automatic control cycles. Simple case is given in the beginning, such as running a motor or energizing a solenoid (called Jog mode) with/without flip-flop circuit. Followed, expanding the technique to any machine control cycle, e.g. similar to those given in Chapter 7. Two types of user interface switches can be used with manual control cycle, mainly, push button and selector switches. Some of these switches could have a mechanical memory and are mainly used with sustain control signals. In other hand, non-mechanical memory switches are used with non-sustain control signals. Fig. 8.6 shows examples of different types of user interface switches used with manual control cycle; push-button, selector and emergency push button switches. 1. Jog Control Cycle In jog control circuit, the motor turned on as long as the Jog push button is held down, as shown in Fig. 8.7. The Jog circuit can also be added to flip-flop circuit as shown in Fig. 8.7(a). The flip/flop R000 used to run the motor as automatic cycle using START and STOP push buttons, in addition to the JOG cycle, as shown in Fig. 8.7(b).

8.8

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Push-button switch. 0 0 1 11 1

Two positions (0 and 1) selector switch having a mechanical memory.

Three positions selector (0, 1 and 11) switch with spring return (no mechanical memory)

Returned to its original, .by spring action. Rotated by user.

Emergency push button switch operation : pressing and rotating for switch release. Emergency push-button switch.

Fig. 8.6 Different types of user interface push button, selector and emergency switches.

X000 (Jog)

Y21 (Motor or solenoid)

(a)
X000 (Start) X001(Stop) R000 R000 (Jog) X002 (Motor) Y21 R000

(b)

Fig. 8.7 Jog control cycle, (a) simple case using NO switch, (b) using flip-flop.

8.9

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

2. Manual and Automatic Cycles It is very easy to include the manual control cycle with any automatic cycle such as those given in Chapter 7. This operation circuits requires three types of user interface switches, which have different functions and given as follows: a) Two position selector switches with mechanical memory is used to select between two AUTO and MAN cycles, as shown in Fig. 8.6. This switch is used with both flip-flop and output modules. b) Two or three positions selector switch with spring return is used to operate actuators having non-sustain control signal and used with MAN control cycle. Two positions selector switch with mechanical memory is used to operate actuators having sustain control signal. These switches are used with output modules. c) Emergency push-button switch is used to stop the AUTO cycle in case of emergency condition, such as work piece jamming. This type of switch, as shown in Fig. 8.6, is used to reset the flip-flop modules. To illustrate how to include the manual cycle to any machine control cycle, consider the following example. Example 8.7; Consider example 8.2. It is required to modify the control cycle to have Auto/Manual cycle selection and to include Emergency Push-Button switch. The machine cycle will be modified by adding the following user-interface switches: Two positions selector switch has a mechanical memory, is used to switch between AUTO and MAN cycles. Setting the selector switched to logic 1 will enable the AUTO cycle and disable the MAN cycle. A NO contact push-button switch is used as EMERGENCY STOP switch. Pressing this switch will reset all the flip/flops during the AUTO cycle. Three-position selector switch with return spring (without mechanical memory) is used with MAN cycle and non-sustain control signals, to actuate the solenoids in forward and backward directions. The neutral position of this selector switch when both solenoids are deactivated. Two-position selector switch with mechanical memory is used with MAN cycle and sustain control signals to activate and deactivate the solenoid. The amended RLL is shown in Fig. (8.8a) and (8.8b).
Start Auto/Man R01 R01 R02 R02 R03 c+ c E.Stop R03 a+ R03 E.Stop R02 Flip-flop Module R02 E.Stop R01 Input switches Start a+ ab+ bc+ cEmerg.Stop Auto/Man Address X00 X01 X02 X04 X05 X06 X07 X03 X08

Fig. 8.8a Modified flip-flop module with Auto/Man cycles for example 8.7.
8.10

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs. Input switches Address Start X00 R01 A+ 8.4 Working with PLC Registers and Analog Input/Output a+ X01 aX02 Auto/Man Man and a+ Like microprocessor A+ computer CPU; PLCs have registers or memory locations inside the b+ X04 CPU of the PLC. The registers have different functions, some of themX05 as address or used bc+ temporary memory while othersT01 used as address for data registers.X06 are These registers consist R02 100 TON AX07 of bits and grouped together to form a byte. Bytes arec- grouped together to form a word. also Auto/Man Man A- aE.STOP X03 For example, the length of the word can be one byte or two bytes or even more for larger Auto/Man X08 CPU computers. Man A+ X09 R02 aB+ Man A- functions for their PLCs. The X0A Each PLC manufacturer assigns different configurations and Man B+ X0B reader Auto/Man Man B+hardware manual for PLC manufacturer for details on types of PLC may consult the b+ Man BX0C registers and its functions. Man C+ X0D Man CX0E R03 BIn this section Toshiba PLC (series T1/T1S) is considered as an example to illustrate how

PLC registers are used to perform and assist different control functions. Auto/Man Man B- bGroup memory Address Devices and registers for Toshiba T1/T1S PLC Flip-flop1 R01
R02 b+ structure of C+ Fig. 8.9 shows the layout100 TON T02 a Toshiba T1/T1s PLC. This structure type called block Flip-flop3 R03 Auto/Man common with type PLC and isMan C+ c+ many PLC manufactures. The T1s PLC is extension for T1 Outputs Address PLC, that have more memory capacity or program storage memory than T1 PLC. Fig. 8.9 A+ Y20 shows also the general layout and technique C- can be used to expand the PLC input/output that R0 bAY21 modules. B+ Y22 BY23 Auto/Man Man C- cC+ Y24 The T1/T1Scompatible consists of bit-based instructions that handle ON/OFF information, IBM-PC program T1-16 CY25 personal computer
Peripheral tool T1 basic unit

Flip-flop2

R02

such as contact and coil instructions (called devices). It also consists of a register-based (16Modified output module with Auto/Man cycles bit) instructions, such as those used for data transfer, arithmetic operations, and analogue For non-sustain output signals input/outputs and called registers. Devices are used to store the ON/OFF information of contacts and coils, while registers areT1-28 to store/exit 16-bit data word. R01 100 TOF T01 used A+
T-PDS Devices are divided into six types: software

Auto/Man R02

Man A+

Option cards

X Y R S T. C.

External input devices (e.g. Switch input devices) T1-40 Auto/Man Man B+ External output devices (e.g. Relay output devices) Handy programmer Auxiliary relay devices (e.g. Temporary memory for input devices) HP911A R02 b+ 100 TON T02 C+ Special devices (e.g. flashing output function) Expansion unit T1-40S Timer devices R03 bCounter devices
Auto/Man Man C+ Modified output module with Auto/Man cycles Computer link Expansion rack For sustain output signals External function input registers. (e.g. It can be used with analog input register)

a-

B+

Registers are divided into eight types:

XW MMI/SCADA YW External output registers. T2 I/O modules be used with analog output register) (e.g. it can system RW Auxiliary relay registers. (e.g. it can be used as temporary memory register). signals, Fig. 8.8b Modified RLL output module for non-sustain and sustain output SW Special registers. (see example 8.7). T Timer registers (used with timer function, see section 8.1) slotslot C Counter registers (used with counter function, see2section 8.2) -4 Fig. 8.9 Structure layout of T1/T1S Toshiba PLC with input/output modules [8.1].

8.11

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

D Data registers (used to store data values, e.g. the content of counter register or the content of timer register, and varied from D0000 to D1023 for T1-PLC and from D0000 to D4096 for T1S PLC) I, J and K are Index registers (e.g. it can be used with do loop instruction) The content of the registers can be specified during RLL development and also can be updated using user interface station, (as shown in Fig. 8.10). X devices share the same memory area as XW registers. Device X014, for example, represents the number 4 bit in the XW01 register. Bit position / Number (MSB) (LSB) F E D C B A 9 8 7 6 5 4 3 2 1 0 XW01 1 X014 Thus,8.10 User ON" means that bit[8.1] can4 ofused to is 1. Fig. "X014 is interface stations number be XW01 update the PLC registers. Y, R, and S devices work in a similar manner. Addressing devices A device number of X, Y, R and S devices consists of a register number and a bit position as follows. X 01 4 Represents bit position 0 to F in the register. Decimal number representing the register containing the corresponding device. Represents the type of device. (X, Y, R, or S) As for the timer (T.) and the counter (C.) devices, a device number is expressed as follows. T. 12 Corresponding register number. (decimal number) Represents the type of device. (T. or C.) Dot (.) is used to identify a device. Addressing registers A register number except the index registers is expressed as follows. XW 01 Register number. (decimal number)
8.12

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Represents the type of register. (XW, YW, RW, SW, T, C or D) The index registers (I, J and K) do not have the number. J I, J, or K

Moving data or constant between PLC registers: Example 8.8: Moving constant to a register:
R001 12345 MOV D0100

When R001 is ON, a constant data (12345) is stored in D0100 Example 8.9: Moving data to the counter register:
X000 00005 MOV D0100 Y20 X001 X002
C

CNT D0100 C010

A constant data 5 is moved to register D0100, next, the content of register D0100 is moved to counter register C010. Hence, the output Y20 will be ON after 5 push button from OFF to ON for switch X001. Example 8.10: Moving data to timer register T010:
X000 R010 R010 Y20 01000 MOV D0100 R010

D0100

TON

T010

Here a constant data 1000 is moved to register D0100. Next, the content of register D0100 is moved to timer register T10. This will result in, switching the output Y20 after delay 100 seconds (1000 * 0.010 since timer address less than T032), after pressing setting the flip-flop R010. Where timer base time for T1/T1S PLC as follows:
8.13

Manufacturing Automation using PLCs


CHAPTER 8 Time base s 0.01 s 0.1 PLC Timer, Counter , Registers and Analog Input/Outputs. T1 T000 to T031 T032 to T063 T1S T000 to T063 T064 to T255

Note, both registers D0100 and T10 can be updated using operator interface station, (as shown in Fig. 8.9). Analog inputs/outputs using PLC registers As an option extension for T1/T1S of Toshiba PLC, it is possible to add a maximum of two small interface cards to the T1/T1S expansion slot. Where there is two slots available for customer configuration, (as shown in Fig. 8.11).

Fig. 8.11 Optional cards can be added to the expansion slot of the T1/T1s PLC There are different optional cards, see table below;
Type DI116 DO116 DD116 AD121 AD131 DA121 DA131 FR112 Description 16 points input, 24 Vdc - 5 mA 16 points output, 24 Vdc - 100 mA 8 points input, 24 Vdc - 5 mA + 8 points output, 24 Vdc - 100 mA 1 channel analog input, 0 to 5 V / 0 to 20 mA 1 channel analog input, 10 V 1 channel analog output, 0 to 20 mA 1 channel analog output, 10 V TOSLINE-F10 remote station, 1 word input + 1 word output Power supply Supplied from the basic unit (5 Vdc)

Two optional cards were installed to be in the T1/T1S PLC expansion slot, these are AD131 and DA131. The first card is used to read analog signal from analog sensor, e.g. pressure sensor, while the second is used to write or output analog signal, e.g. used as command signal for servo-drive. Each card has its address. These addresses are allocated automatically using the T-PDS32 software (user program for RLL development). The automatic allocated addresses for both cards are given as follows:

8.14

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Card Name AD131 DA131

Allocated register address XW004 YW005

Analog inputs/outputs Programming Technique using PLC registers All the registers of the T1/T1S PLC are integer type, i.e. no floating point. The floating point registers are available with larger (costly) PLC. Hence, the read voltage is converted to digital (integer) value. The input voltage is in range from 10V to +10V, and converted to digital value form 2000 to +2000. The digital value of 2000 is corresponding to 10V , and +2000 to +10V. Hence, the relationship between the digital and analog values are given as follows: D = 200 * A A = 0.005 * D Equation (8.1) Equation (8.2)
For Analog input card, card model AD131. For Analog Output card, card model DA131.

where D; digital value, and A; analog value in volts. The following chart shows the relationship between the two values:
Digital Value +2000 +1000 -10V -5V 0 +5V +10V -2000 -1000 +10V +5V 0 -5V Analog voltage -2000 +10V Digital voltage +1000 +2000 Analog Value

-1000

Conversion chart for analog input card.

Conversion chart for analog output card.

Analog input/output PLC programming: Analog input programming can be achieved very simply by moving the data from the assigned AD register (XW004 address) to any PLC data register, e.g. D0100. The digital value X000 calculated using equation 8.1. See the RLL below for analog input function:
XW004 MOV D0100 When the switch X000 is closed : the voltage converted to digital value and moved from AD register (XW004) to the PLC Data register (D0100).

8.15

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Similarly, analog output programming can be achieved by moving the digital value to DA register (YW005) (the value is calculated using equation 8.2, which corresponds to the X000 required voltage). See the RLL below for analog output:
When the switch X000 is closed : the digital value (900) is moved to the analog output register YW005. The 900 digital value corresponding to 0.005*900=4.5 V.
900 MOV YW005

Comparing the content of a register Comparing the content of a register and take a control action is important in both logic and continuous controls. This function is similar to IF statement in traditional computer programming. Study the following example: Example 8.11: Read the analog voltage and compare, IF the voltage is grater than 4.5V , switch the output on (address Y023):
XW004 MOV D0100 Y23 1st Rug move, covert the analog voltage and move the digital D0100 > 900 value form the AD register (XW004) to PLC register D0100. 2nd Rug compare the digital value if it is grater that 900 (which corresponds to 4.5V), then switch the output Y23 on, otherwise the output Y23 is off.

Y23 Here rung 1 is canceled and the analog input register used XW004 > 900 directly in the comparison operation.

8.16

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs. Greater than compare function.Similarly, Greater than or equal compare function. Less than or equal compare function. Equal compare function. Not equal compare function.

Input Input Input Input Input

A > B A >= B A <= B A = B A <> B

Output Output Output Output Output

the

following compare functions can be applied:

Simple Math operations using PLC registers It is also possible to carry out math operations using PLC registers. Consider the following math operations (note; some of the output math operations requires two registers; such as the multiplication operation) : Example 8.12; Write a RLL program that will Add, Subtract, Multiple, or Divide two registers and assign the output or results in D205 register.
Rung 1 Rung 2Device

00010 MOV D0200

00005 MOV D0201

Destination Register

X00 Rung 3X01 X02 Rung 4X03


Rung 5RLL

ON X00 Operation Add Subtract X01 Multiply Divide X02

Source D0201 -> D0200 + Registers D0205

D200=10, D201=5 D205=15 D200=10, D201=5 D205=05 D0200 - D0201 -> D0205 D200=10, D201=5 D206.D205=50 D200=10, D201=5 D205=02 D0200 - D0201 -> D0206 . D0205

Output Device Y22 Y23 Y24 Y25

Y22 Y23 Y24

program given as follows;

8.17

Y25 X03 D0200 / D0201 -> D0205 In rung 1: Constants 10 and 5 are moved to registers D0200 and D0201, respectively. In rung 2: If switch X00 is closed, and D0200 added to D0201 and result (D0205) greater than 32767 or less than 32768 the output Y22 is switched ON, else the output Y22 is OFF. In rung 3: Similarly if switch X01 is closed, and D0200 subtracted from D0201 and the results greater than 32767 or less than 32768 the output Y23 is witched ON, else the output Y23 is OFF. In rung 4 and rung 5: It is different here: when the input X02 is closed and the multiplication or division is executed the output Y24 is switched ON. For division case : if D0200 = 2894 and D0201 = 325 , D0205 = 2894/325 = 8 and 294 is the remainder. The results of integer division is stored in register D0205 and the remainder value is stored in next register i.e. register D0206. In multiplication case : If D0200 = 1500 and D0201 = 20, the results is stored in two 16 bit registers D0206 . D0205 = 30 000 Lower 16-bit word Upper 16-bit word

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

PROBLEMS 8.1) Given the following machine control sequence for double acting cylinders A, and B. Start , A+ ,10 s delay, A , A+ ,10 s delay, A ,10 s delay, B + , B . (a) Re-arrange the machine sequence as Cascade groups using on-delay and/or off-delay functions. Assuming non-sustain output signal for the solenoid A and sustain output signal for solenoid B? (b) Develop RLL and sequencing chart? (c) Modify the machine RLL program given in (b) to have Auto/Man cycles selector switch and two-position selector switch for each Man. Output operation? Specify the type of the selector switches used in this application? 8.2) and B. Given the following machine control sequence for double acting cylinders A,

A Start , A+ ,10 s delay, + 20 s delay, B . B


8.18

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

(a) Re-arrange the machine sequence using on-delay and/or off-delay functions. (b) Develop RLL for the given machine sequence assuming non-sustain outputs for both cylinders A and B. (c) Modify the RLL for the given machine sequence assuming non-sustain output signal for cylinder A and sustain output signal for cylinder B. 8.3) Given the following machine control sequence: A A+ + + Start , A ,10 s delay, B , , + ,20 s delay, B , A . B B

(a) Re-arrange the machine sequence using on-delay and/or off-delay functions. (b) Develop RLL for the given machine sequence assuming non-sustain outputs for both cylinders A and B. (c) Modify the machine RLL program given in (b) to have Auto/Man cycles selector switch and two-position selector switch for each Man. Output operation? Specify type of the selector switches used in this application? 8.4) Given the following machine control sequence: Start , A+ ,10 s delay, B + , repeat n times; (C + , C ) , B ,20 s delay, A . (a) Re-arrange the machine sequence using on-delay and/or off-delay functions. (b) Develop RLL for the given machine sequence assuming non-sustain outputs for all cylinders A , B and C. (c) Modify the machine RLL program given in (b) to have Auto/Man cycles selector switch and two-position selector switch for each Man. Output operation? Specify the type of the selector switches used in this application?

8.5)

Given the following machine control sequence: Start , A+ ,10 s delay, repaet 3 times; ( B + , C + ,20 s delay, C , B ) , A .

(a) Re-arrange the machine sequence using on-delay and/or off-delay functions. (b) Develop RLL for the given machine sequence assuming non-sustain outputs for all cylinders?. (c) Modify the RLL for the given machine sequence assuming non-sustain control output signal for cylinder A only? (d) Modify the machine RLL program given in (b) to have Auto/Man cycles selector switch and two-position selector switch for each Man. Output operation? Specify the type of the selector switches used in this application? 8.6) Given the following machine control sequence:
+ +

A A+ ,10 s delay, ,20 s delay, B , A . Start , A ,10 s delay, B , B+ B


8.19

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

Re-arrange the machine sequence using on-delay and/or off-delay functions. Develop RLL for the given machine sequence assuming non-sustain outputs for all cylinders? Modify the machine RLL program given in (b) to have Auto/Man cycles selector switch and two-position selector switch for each Man. Output operation? Specify the type of the selector switches used in this application Develop RLL for single path machine sequence and analog input. The machine sequence will not start until the analog voltage is greater than or equal to 2.5V. Use equations 8.1 and 8.2 for analog conversion and use address of XW004 for analog input register. The machine sequence given as follows:
8.7)

( ( Start ).( AD = 2.5Volts ) ) , B + , C + ,10 s delay, B , C .


Given the following machine sequence; Develop the RLL for non-sustain output signals. Note, cylinder C+ will not actuated if the analog input signal is less than 2.5V. Use equations 8.1 and 8.2 for analog conversion and use address of XW004 for analog input register:
8.8)

Start , B + , (C + ).( AD 2.5V ) , B , C . A DC servomotor and drive amplifier used to adjust the motor speed, using the analog output developed by PLC. The command signal (which is proportional to motor speed) is function of three select switch setting. The following table shows the analog output voltage as a function of the input of the three selector switches;
8.9)

Sw3 0 0 0 0 1 1 1 1

Selector Switches Sw2 0 0 1 1 0 0 1 1

Sw1 0 1 0 1 0 1 0 1

Voltage 0 0.25 0.5 0.75 1.0 1.25 1.5 2.0

Develop RLL to produce analog output signal required to control motor speed as shown in above table. (Given the analog output register address YW005, use equations 8.1 and 8.2 for analog output conversion between analog and digital values).

8.20

Manufacturing Automation using PLCs


CHAPTER 8 PLC Timer, Counter , Registers and Analog Input/Outputs.

8.21

S-ar putea să vă placă și