Sie sind auf Seite 1von 39
UNIT 9 Keypad Control UNIT OBJECTIVE When you have completed this unit, you will be able to control the Keypad module of PLC Trainer and use it in a digital lock. DISCUSSION Keypads are widely used in consumer products and industrial equipments for data entry and control purposes. The Keypad module of PLC-200 PLC Trainer is shown in Fig. 9-1. KEYPAD. R3. R2 R1 RO co C1 C2 C3 Fig. 9-1 Keypad module The Keypad module is a 4-row by 4-column multiplexed keyboard, which contains ten numerical keys 0 to 9 and six function keys F1 to F6. In hardware implementation, the 4 column lines CO to C3 of keypad are internally connected to PLC inputs 10.6 to 11.1 and the 4 row lines RO to R3 are internally connected to PLC outputs Q0.0 to Q0.3. EQUIPMENT REQUIRED 4, Personal Computer 2. PLC-200 PLC Trainer 3. _USB/PPI Multi-Master Cable 4. AC Adapter on Exercise 9-1 Keypad Operation EXERCISE OBJECTIVE After completing this exercise, you should be able to: 1. Understand the operating principle of the Keypad module. 2. Control the Keypad module using basic instructions. DISCUSSION This exercise demonstrates the operation of Keypad module. Fig. 9-1.1 shows the ladder diagram of keypad control The state of function keys (memory bits M1.1 to M1.6) and the code of numerical keys (in the register VW50) will be observed using the STEP 7-Micro/WIN. tomes k ew enol 3} a vy urhan Ly") somes. 2 Ly } — oly auth too. 3 Lt} KA my 92 watwok 5 t 4°} len ‘ENC 4 ‘te et Hetwak7 mm ne ay HK? HA a youd 4-47-44 /—/b en eo — "t 1" ee nou m wo 7 TO bt 8d 03 no na vos. OWT wr, ") | y . - ‘ outs TOW 107 ne Jy no. 1. 17F— | 1 sto__out ws TNT - ex enol} ’ — t4*K— tH TT rda___ourh wea 04 Netw 10 oa ms vo 0 we HF t 1¢t 17k 17 t 1 | exo} ed uthses us no we ws wo HH" Kt A F $9 o our} ns ne 7 we wo tJ 't 1 1/f 17k ext youths m1 wo v7 ws a3 1 -—'t 17 1/ exot e cls ahr Fig. 9-1.1 Ladder diagram of keypad operation (Examples\Keypad01.mwp) Network 1: On first scan or the current value of up counter C1 is equal to 4 (C1 is on), Network 2: load 1 into QBO. (Initial scan code = 1) On first scan, load 0 into MB1. (Initial value = 0) Network 3-4: When 10.6, 10.7, 11.0, and 1.1 are OFF, generate 10 ms pulse train. Network 5: On every rising edge of 10 ms pulse train, shift the scan code in QB0 left one bit in that order: (0000 0001)2=(1)10, (0000 0010)2=(2):0, (0000 0100)2=(4)10, (0000 1000).=(8)10 ‘Sequence | QB0 (Binary) Q03 | a0.2 T a0.1 | 00.0 1 ‘0000 0001 0 0 0 1 [2 ‘0000 0010 0 0 1 0 3 ‘0000 0100 0 1 0 0 4 ‘0000 1000 1 0 o 0 Network 6: On every rising edge of 10 ms pulse, increment the current value of up counter C1. When the current value of counter C1 is equal to 4 or on first ‘scan, reset the up counter C1. Network 7: When scan code=1 (0.0 activated), read numerical keys 0 to 3 and load the key code into VW50: key 0=0, key 1=1, key 2=2, key 3=3. Network 8: When scan code=2 (Q0.1 activated), read numerical keys 4 to 7 and load the key code into VW50: key 4=4, key 5=5, key 6=6, key 7=7. Network 9: When scan code=4 (Q0.2 activated), read numerical keys 8 and 9 and load the key code into VW50: key 8=8, key 9=9. Read function keys F1 and F2 and load the key code into MB1: F1=2 (M1.1=1), F2=4 (M1.2=1). Network 10: When scan code=8 (Q0.3 activated), read function keys F3 to F6 and load the key code into MB1: F3=8 (M1.3=1), Fa=16 (M1.4=1), F5=32 (M1.5=1), F6=64 (M1.6=1). 96 PROCEDURE 1. With power off, place all Enable switches SW2-SW8 in OFF position. Set input switches 10.0-11.5 to OFF and set Thumbwheel Switches to 0000. Connect PLC Trainer's Port 0 to your PC's USB port using the USB/PPI cable. 2. Start the STEP 7-Micro/WIN. 3. Create a new project by selecting the File >> New menu command. Complete the ladder diagram of keypad operation shown in Fig. 9-1.1 4, Tum power on. 5. Download the project to PLC unit by selecting the File >> Download menu command orclicking the 2 icon in Toolbar. 6. Run the ladder program by selecting the PLC >> Run menu command or clicking the > icon in Toolbar. 7. Press function keys as shown in Table 9-1.1. Observe and record the state of memory bits M1.1 to M1.6 using the SETP 7-MicroWIN. Only a bit will be on (=1) at a time and the state will remain unchanged until another function key is pressed. Table 9-1.1 The state of M1.1 to M1.6 Function Key| M11 | M12 | M13 | M14 | M15 | M16 FL F2 F3 F4 FS F6 8. Press numerical keys and observe the key codes in the register VW50 using the SETP 7-Micro/WIN. The register VWS0 should contain the code of the numerical key you pressed. Exercise 9-2 Digital Lock Control EXERCISE OBJECTIVE After completing this exercise, you should be able to: 1. Understand the operating principle of a digital lock, 2. Control a digital lock. DISCUSSION In this exercise you will simulate a digital lock using the Keypad and Buzzer modules. The Buzzer module of the PLC Trainer is shown in Fig. 9-2.1._ When a positive voltage is applied to BZ+ terminal and BZ- terminal is connected to ground, the Buzzer will be on. BL Fig. 9-2.1 Buzzer module This exercise simulates a digital lock with a default password of 1234. When a person wants to unlock the digital lock, he or she must enter a 4-digit password from keypad. If the password entered matches the default, the Buzzer will be on to represent that the digital lock is unlocked. Only the supervisor has the privilege of changing password. To unlock the digital lock, follow the sequence: Press F1 -> Enter a 4-cigit password — Press F6 If the password entered matches the default, the buzzer will be on for one second, entry is error, nothing will be done. Ifthe 98 Only the supervisor has the privilege of changing password. The sequence to change the password is the following: Press F1 —> Enter a 4-digit password — Press F2 If the password entered matches the default, a new password can be entered by the following sequence; otherwise, nothing will be done. Press F1 -> Enter a new 4-digit password > Press F3 The new password is set. Each sequence must be complete within 5 seconds; otherwise, the entry will be aborted. Memory Fill Instruction (FILL_N) Ladder Symbol [VO |DataType | Valid Operands EN, [Boolean | Power Flow ENO N integer TW, OW, VW, MW, SMW, SW, LW, AIW, T, C, AC, *VD, *LD, *AC, Constant ‘OUT integer IW, GW, VW, MW, SMW, SW, LW, AQW, T, C, *VD, *LD, *AC N Byte 1B, QB, VB, MB, SMB, SB, LB, AC, “VD, “LD, *AC, Constant ‘The Memory Fill (FILL_N) instruction writes N consecutive words, beginning at address OUT, with the word value contained in address IN. N has a range of 1 to 255. The ladder diagram of digital lock is shown in Fig. 9-2.2. Network 1 sw TOE I vex a 14_aut aso Network 2 uot WOE lex eno} of__out we TOW len ena ved outkwro Network 3 sMo1 WOW t len enol ofa out ws TOW en exo] WOW ee ee d_out} were FIN Jen "eno —¥ cour vwaoe 9-10 wer os wo no m1 12 Loy 7A Rt HA He vole tad ona 5 12 ony one Lf {eb a | csolu ——_ourfoso vl tate? en a I Ly A ve ley seta 8 mth, na, 6 RR], 47 44 t NC LH Hy bof 5 lv uchiven ns no we 0s WO] KA Rt Ff 9 we are 1’ + |} 4/+ 1’ + jen eNO] ) mts wor 06 HRs 1 a i Et 0") oun Network 8 ba a 0d 5 1 a ed 5) stun La tt a on engl 5 ee ee Kt Et a el 5 La} a fe el 5 ‘S4UN___gutws0 Lt 7 Een eno] 1 fo Frc] 9-12 Network 11 M61 -—1'F— ) saa 18 88 ws ver ao 47-4 , utr 4 eo ITE {+} eb exo ves vwofoata by -_—jr HI worond ra. os La} a en of 9 cle uh soma t2 Lt} 7 > we Network 15 woo WOT cody orf weaos wore maT a sandr ovr woe TW fw ewo} 3} vwaro|n out weato Network 16 woo CF 1 tL) } on le evo} v2 wor wt rd’ bs Notwork 17 swag WOT 4 | le eno} waned our vwata | | TET le eno} J wwantdnn ——ourbvware vwwsos4iua__] on le eno} — waned ourbvwens woreda 914 rT HK "3 Lin) ere faa —— os by "3 > nor 1°} ew ew of ourfwan is Asad wooden Ly") 13 a a2, 4 «F/-—Ca) ay 4° en exo} tte 24 {H+ +t x 999 Lye) Fig. 9-2.2 Ladder diagram of digital lock (Examples\Keypad02.mwp) Network 1: On first scan, or the current value of up counter C1 is equal to 4 (C1 is on), load 1 into QBO. (Initial scan code = 1) Network 2: On first scan, load 0 into MB1 (Initial value = 0) and load 1234 into VW10 (default password). Network 3: On first scan load 0 into VWS0, create a Table (max. number of entries = 5, entry count = 4) starting with VW204 and clear the Table. Also, reset M3.1 to M365. Networks 4-5: When 10.6, 10.7, 11.0, and I1.1 are OFF, generate 10 ms pulse train. Network 6: On every rising edge of 10 ms pulse train, shift the scan code in QBO left one bit in that order: (0000 0001)2=(1):0, (0000 0010)2=(2)10, (0000 0100},=(4)so, (0000 1000),=(8):0 Sequence | QB0 (Binary) | 00.3 | G02] a01 | ado 4 0000 0001 0 0 0 1 2 (0000 0010 oto [4 0 3 ‘0000 0100 0 1 0 0 4 ‘0000 1000. 1 foo to 9-16 Network 7: Network 8: Network 9: Network 10: Network 11: (On every rising edge of 10 ms pulse train, increment the current value of up counter C1. When the current value of counter C1 is equal to 4 or on first scan, reset the up counter C1. When scan code=1 (0.0 activated), read numerical keys 0 to 3 and load the corresponding code into VW50: key 0=0 and set M5.0, key 1=1 and set M5.1, key 2=2 and set M5.2, key 3=3 and set M5.3. ‘When scan code=2 (Q0.1 activated), read numerical keys 4 to 7 and load the corresponding code into VW50: key 4=4 and set M5.4, key 5=5 and set M5.5, key 6=6 and set M5.6, key 7=7 and set M5.7. When scan code=4 (0.2 activated), read numerical keys 8 and 9 and load the corresponding code into VWS50: key 8=8 and set M6.0, key 9=9 and set M6.1. Read function keys F1 and F2 and load the corresponding code into MB1: F1=2 (M1.1=1), F2=4 (M1.2=1) ‘When scan code=8 (Q0.3 activated), read function keys F3 to F6 and load the corresponding code into MB1: F3=8 (M1.3=1), F4=16 (M1.4=1), F5=32 (M1.5=1), F6=64 (M1.6=1). Networks 12-13: If any key of numerical keys 0 to 4 is pressed, reset M2.0. If any key of Network 14: Network 15: Network 16: Network 17: Network 18: numerical keys 5 to 9 is pressed, reset M2.1 On the rising edge of M2.0 or M2.1 (a numerical key depressed), copy the corresponding key code to table. Multiply the value of memory location VW204 by 1000 and load the result into VW304 (thousands digit). Multiply the value of memory location W206 by 100 and load the result into VW306 (hundreds digit). Multiply the value of memory location VW208 by 10 and load the result into VW308 (tens digit). Copy the value of memory location VW210 to VW310 (units digit) On the falling edge of M2.0 or M2.1 (a numerical key just released), remove the first table value from location VW204 to location VW400. ‘Add the values of locations VW304, VW306, VW308, and VW310 and load the result into location VW316 (4-digit value). When F1 key is pressed, set bit M3.1 to on and clear the memory locations (W204 to VW222) to 0 (table reset). Networks 19-20: If the 4-digit value is equal to the default password after F1 key is pressed and F6 key is pressed, activate Buzzer to on for one second to indicate the digital lock is unlocked, Networks 21-23: If the 4-digit value is equal to the default password after F1 key is pressed and F2 key is pressed, reset M3.1 and set M3.2 to enable the 10 ms timer T34 (10 ms x 500 = 5 8). The system operates in password change mode and a new password must be entered within 5 seconds. After a 5-second delay, reset M3.1 and M3.2 and table. In password change mode, F1 and F3 keys are pressed, load the 4-digit value (new password) into memory location VW10. 9-18 PROCEDURE 1. With power off, connect DC 24V- “+" terminal to OUTPUT-RC6 terminal, OUTPUT-RQ1.1 terminal to BUZZER-BZ+ terminal, BUZZER-BZ- terminal to DC 24V- —" terminal, as shown in Fig. 9-2.3. Fig. 9-2.3 Wiring diagram of digital lock 2. Place Enable switch SW7 in ON and other Enable switches SW2-SW6, SW8 in OFF Position. Set input switches 10.0-I1.5 to OFF and set Thumbwhee! Switches to 0000 Connect PLC Trainer's Port 0 to your PC's USB port using the USB/PPI cable. 3. Start the STEP 7-Micro/WIN. 4. Create a new project by selecting the File >> New menu command. Complete the ladder diagram of digital lock shown in Fig. 9-2.1 9-19 Turn power on. Download the project to PLC unit by selecting the File >> Download menu command or clicking the + icon in Toolbar. . Run the ladder program by selecting the PLC >> Run menu command or clicking the > icon in Toolbar. To unlock the digital lock, follow the sequence: Press F1 -> Enter 1234 -> Press F6. Buzzer should be on. This indicates that the digital lock is unlocked. To change password, follow the sequence: Press F1 —> Enter 1234 > Press F2. Then follow the sequence to specify a new password: Press F1 —> Enter a new 4-digit password (e.g., 6789) Press F3. At this time the new Password should be set To unlock the digital lock again, follow the sequence: Press F1 —- Enter 6789 —> Press F6. Buzzer should be on. 9-20 UNIT 10 DC motor Control UNIT OBJECTIVE When you have completed this unit, you will be able to understand the operating principles of DC motor, micro and proximity switches and construct a control system. DISCUSSION Fig. 10-1 shows the Micro Switch/24V Motor/Proximity Sensor module of PLC-200 PLC Trainer. MICRO SWITCH 7 24V_MOIOR ROXIMITY SENSOR Fig. 10-1 Micro Switch/24V Motor/Proximity Sensor module This module consists of a micro switch with terminals N.C., COM and N.O., 24V DC motor with terminals M+ and M-, and a proximity sensor with output terminal PS. The SPEED ADJ is used to control the speed of DC motor. The DC motor is a permanent magnet (PM) DC motor. The field of PM motors is supplied by permanent magnets. The permanent magnets pass a flux through the armature, creating two or more poles. Since the flux remains basically constant at all motor speeds, the speed-torque and current-torque curves are linear. With the stator magnetic field generated by a permanent magnet, external electrical power is not required in the stator structure. This simplifies power requirements and eliminates iron losses in the field windings. It follows then, that there is no field control in this type of motor, which is a disadvantage in some industrial applications 10-1 The motor runs either clockwise (CW) or counterclockwise (CCW) depending on the direction of the current through the armature. The speed of a DC motor is directly proportional to the applied armature voltage. The proximity switch is an inductive type, which is activated by ferrous material. Ferrous objects in close proximity to the sensor face upset the magnetic field of the switch, tripping the contacts of its relay. The micro switch is operated when a moving machine or moving part of a machine hits the operating lever, activating the switch. EQUIPMENT REQUIRED Personal Computer PLC-200 PLC Trainer USB/PPI Multi-Master Cable AC Adapter sens 10.2 Exercise 10-1 PWM Speed Controller EXERCISE OBJECTIVE After completing this exercise, you should be able to: 1. Connect the DC motor to PLC transistor outputs. 2. Control DC motor speed using PWM. DISCUSSION Generally a DC motor runs at several thousands revolutions per minute. It is difficult to identify the speed variation by eye. To overcome this disadvantage, the DC motor of PLC Trainer is equipped with a gear-reduction mechanism to reduce the motor speed to ‘one revolution per second. Unfortunately the additional gear-reduction mechanism causes a nonlinear relationship between DC motor speed and PWM output. In this exercise, the PWM function of the PLS instruction (discussed in Exercise 3-2) will be used to control the DC motor speed. For convenience, the PTO/PWM control registers and the PTO/PWM control byte reference are described again. Table 10-1.1 describes the registers used to control the PTO/PWM operation. You can use Table 10-1.2 as a quick reference to determine the value to place in the PTO/PWM control register to invoke the desired operation. Please refer to Exercise 3-2 or SIMATIC ‘7-200 Programmable Controller System Manual for more information, 103 Table 10-1.1 SM locations of the PTO/PWM control registers. 20.0 [01 | Status Bits SM66.4 | SM76.4_| PTO profile aborted (delta calculation error): 0= no error, 1 = aborted ‘SM66.5_| SM76.5_| PTO profile aborted due to user command: 0 = no abort, 1 = aborted '5M66.6_| SM76.6_| PTO pipeline overflow/underfiow: 0 = no overflow, 1 = overflow/underfiow ‘SM66.7_| SM76.7_| PTO idle: 0 =in progress; 1= PTO idle @0.0 [04 | Control Bits ‘SM67.0_| SMT77.0_| PTO/PWM update the cycle time: 0 = no update, 1 = update oycle time ‘SM67.1"_| SMT77.1_| PWM update the pulse width time: 0 = no update; 1 = update pulse width ‘SM67.2_| SM77.2__| PTO update the pulse count value: 0= no update, 1 = update pulse count ‘SM67.3_| SM77.3_| PTO/PWM time base: 0 = 1 usitick, 1= 1 msfick ‘SM67.4_| SM77.4_| PWM update method: 0 =asynchronous; 1 = synchronous ‘SM67.5_| SM77.5_| PTO single/multiple segment operation: O= single; 1 = multiple ‘SM67.6_| SM77.6_| PTO/PWM mode select: 0= PTO; 1 = PWM ‘SM67.7_| SM77.7_| PTO/PWM enable: 0 = disable; 1 = enable 20.0 [0.1 | Other PTO/PWM Registers ‘smwes_| SMW78_ | PTO/PWM cycle time value (2 to 65,535) ‘SMW70_| SMWE0_| PWM pulse width value (0 to 65,535) ‘sm72_ | SMD&2_| PTO pulse count value (1 to 4,204 967,295) smp16s | SMB176 or of the segment in progress, Mulliple-segment PTO operation a | se | Se RS SERRE i ST '5MB170 | SMB180_| Linear profile status byte ‘SMB171 | SMB181_| Linear profile result register ‘SMD172 | SMD182_| Manual mode frequency register 10-4 Table 10-1.2 _ PTO/PWM control byte reference Controf Result of Executing the PLS Instruction Register [Enable | Select | PTO PWM | Time Pulse | Pulse] Cycle Mode | Segment | Update | Base Count | Width | Time (Hex) Operation | Method 16481 [Yes [PTO | Single 1 usicycle Load 1684 [Yes | PTO | Single ‘ipsioycie | Load 16485 [Yes | PTO | Single ‘psioycle | Load Load 16489 [Yes [PTO | Single 1 ms/cycle Load 1e#8c [Yes [PTO | Single ‘msicycle | Load 16480 [Yes | PTO | Single Amsicycle | Load Load’ 7e#a0__[Yes | PTO | Multiple 1 usicycle 16#a8_ [Yes | PTO | Multiple ‘Tmsicycle 16x01 [Yes | PWM Syne | 1s/cycle Load 16402 [Yes | PWM Syne__| 1us/cycle Load 16403 [Yes | PWM Syne [ tusicycle Load [Load 16409 [Yes | PWM ‘Sync [ 1 ms/eycle Load 640A [Yes | PWM ‘Sync [ 1 ms/eycle Load 16xDB | Yes | PWM ‘sync | 1 ms/eycle Load | Load The ladder diagram of DC motor control is shown in Fig. 10-1.1. Network 1 oo Network 2 ‘01 Neto Tle 03 WoW bueno} —y sm ourvwo k len enol odin ourbvwo los ‘Network 2 03 OVW 7 $$ fen “enol — ow ourbwo Network 4 Hetwotk Tie swoo TOE ev enol reroed our swasr TOW en ew} 2ovdiN_out swe [ow] ew enol —>} wow. out}smw7 7S er loo Fig. 10-1.1 Ladder diagram of PWM speed controller (Examples\Motor01.mwp) Network 1: When 10.3 (Motor Run/Stop) and 10.0 (low speed) are ON, load 45 into WO (low speed). Network 2: When 10.3 (Motor Run/Stop) and 10.1 (full speed) are ON, load 200 into \W0=200 (full speed). Network 3: When 10.3 (Motor Run/Stop) is OFF, load 0 into VW0 (stop). Network 4: Configure PWM 0: time base 1 ms/cycle, PWM cycle time = 200 x 1 ms =200 ms, PWM pulse width = VWO x 1 ms=45 ms (low speed), 200 ms (full speed), ‘or O ms (stop). Pulse output to Q0.0 (M+) The register and controls are the following: W\0 register - saves motor speed value 10.0 input - controls DC motor speed (low speed) 10.1 input - controls DC motor speed (full speed) 10.3 input - controls the DC motor to run or stop 10-6 PROCEDURE 1. Connect the circuit as shown in Fig. 10-1.2, With power off, connect DC 24V- *—* terminal to 24V MOTOR-M- terminal, 24V MOTOR-M+ terminal to TRANSISTOR OUTPUT-Q0.0 terminal. Turn the 24V MOTOR-SPEED ADJ knob fully clockwise (max). Fig. 10-1.2 Wiring diagram of PWM speed controller 2. Place all the Enable switches SW2-SW8 in OFF position. Set input switches 10.0-I1.5 to OFF and set Thumbwheel Switches to 0000. Connect PLC Trainer's Port 0 to your PC's USB port using the USB/PPI cable, 3. Start the STEP 7-MicroMWIN. 4. Create a new project by selecting the File >> New menu command. Complete the ladder diagram of PWM speed controller shown in Fig. 10-1.1. 10-7 . Turn power on. Download the Project to PLC unit by selecting the Download menu command or clicking the icon in Toolbar. CAUTION: Keep your fingers and objects far away from the rotating parts when the DC motor is running. |. Run the ladder program by selecting the PLC >> Run menu command or clicking the > icon in Toolbar. ”. Set input switches 10.0 to ON and 10.1 to OFF. Set input switch 10.3 to ON. The DC motor should run at low speed. You can measure the motor speed by counting the number of hits that the motor pointer strikes the operating lever of micro switch within one minute. Set input switch 10.3 to OFF. The DC motor should stop. |. Set input switches 10.0 to OFF and 10.1 to ON. Set input switch 10.3 to ON. The DC motor should run at full speed. You can measure the motor speed by counting the number of hits that the motor pointer strikes the operating lever of micro switch within one minute. 10-8 Exercise 10-2 Proximity and Micro Switches EXERCISE OBJECTIVE After completing this exercise, you should be able to: 1. Understand the operating principles of proximity and micro switches. 2. Sense a moving machine with proximity or micro switch, DISCUSSION Limit sensing switches are designed to pass an electrical signal when a predetermined limit is reached. This limit may be a speci n for a machine part, a critical temperature, pressure or the level of a liquid. ‘These devices take the place of a human operator and are often used under conditions where it would be impossible for the operator to be present. ‘A micro switch or limit switch is operated when a moving machine or moving part of a machine hits the operating lever, activating the switch. The size, operating force and stroke are critical factors to consider when installing a limit switch. A proximity switch is used to detect metallic objects that approach its sensing face in any direction. The most common actuation methods, however, are head-on and slide-by operations. Proximity switches function on three prin eddy current. les of operation: inductive, capacitive and Aproximity switch that operates on the inductive principle is activated by ferrous material. Ferrous objects in close proximity to the sensor face upset the magnetic field of the switch, tripping the contacts of its relay. ‘A proximity switch that operates on the capacitive principle is activated by ferrous or non-ferrous material. When a material passes between the two parallel plates of the 109 capacitor, the dielectric changes, and a change in voltage appears across the plates of the capacitor. This voltage change is used to activate the contacts. A proximity switch that operates on the eddy current principle is activated by ferrous material. When a metal object approaches the switch, the electromagnetic field generated by the sensing coil is absorbed by the metal target, generating eddy current. These eddy currents reduce the intensity of the oscillator signal which is detected to operate the contacts. These switches must be located within a specified distance from the object they sense. This is usually no further than a few centimeters for correct operation. Filings and other materials must be kept clear of the sensor face, since erratic operation of the switch may occur. The ladder diagram of proximity and micro switches is shown in Fig. 10-2.1. Network 1 Netw Tie 103 oy Network 2 no cr oo THD 07 }—_—In odpy Network 2 ma 2 Ha oar Fig. 10-2.1 Ladder diagram of proximity & micro switches (Examples\ Switches01.mwp) 10-10 Network 1: When 10.3 (Motor Run/Stop) is ON, Q0.0 is energized and DC motor runs. When 10.3 is OFF, Q0.0 is de-energized and DC motor stops. Network 2: When receiving an actuation signal of micro switch the current value of C1 increments. The counter C1 is reset when 10.7 is on. Network 3: When receiving an actuation signal of proximity switch the current value of C2 increments. The counter C2 is reset when 10.7 is on. The functions of input switches, registers, and control knob are the following: 10.3 input - controls the DC motor to run or stop 10.7 input - resets counters C1 and C2 11.0 input - receives the actuation signal of micro switch 11.1 input - receives the actuation signal of proximity switch C1 counter - counts the number of micro switch's actuation signal received C2 counter - counts the number of proximity switch's actuation signal received 24V MOTOR-SPEED ADJ. Knob - controls the motor speed by hardware ‘When the 10.3 switch is placed in ON position, the DC motor runs at the speed controlled by the SPEED ADJ knob. When the motor pointer approaches the sensor face of proximity switch, the switch is activated and the actuation LED lights, and the contents of counter C2 increment. When the motor pointer strikes the operating lever of micro switch, the N.O. contacts of the switch close, and the contents of counter C1 increment. The current values of the counters C1 and C2 can be observed by us 7-MicroWIN. The DC motor stops when the 10.3 is OFF. the SETP 10-11 PROCEDURE 1. With power off, connect the circuit as shown in Fig. 10-2.2. Connect DC 24V- “+” terminal to OUTPUT-RCO terminal, OUTPUT-RQO.0 terminal to 24V MOTOR-M+ terminal, 24V MOTOR-M- terminal to DC 24V- *—" terminal, INPUT-C terminal to MICRO SWITCH-COM terminal, MICRO SWITCH-N.O. terminal to INPUT-I1.0 terminal, PROXIMITY SENSOR-PS terminal to INPUT-I1.1 terminal. ‘Tum 24V MOTOR-SPEED ADJ knob fully clockwise (max), Fig. 10-2.2 Wiring diagram of proximity and micro switch contro! 2. Place Enable switch SWS in ON and other Enable switches SW2-SW4, SW6-SW8 in OFF position. Set input switches 10.0-11.5 to OFF and set Thumbwheel Switches to 0000. Connect PLC Trainer's Port 0 to your PC's USB port using the USB/PPI cable. 3. Start the STEP 7-Micro/WIN. 4. Create a new project by selecting the File >> New menu command. Complete the ladder diagram of proximity and micro switch control shown in Fig. 10-2.1 10-12 5. Tum power on. Download the Project to PLC unit by selecting the File >> Download menu command or clicking the icon in Toolbar. CAUTION: Keep your fingers and objects far away from the rotating parts when the DC motor is running. 6. Run the ladder program by selecting the PLC >> Run menu command or clicking the b icon in Toolbar. 7. To clear the contents of counters C1 and C2, pull down and release the input switch 10.7. 8. Set input switch 10.3 to ON. The DC motor should run. When the motor pointer approaches the sensing face of proximity switch, the actuation LED and the PLC input indicator 11.1 should light. When the motor pointer strikes the operating lever of the micro switch, the PLC input indicator 11.0 should be on. 9. Turn the SPEED ADJ. Knob to adjust the motor speed for observation. 10. Observe the current values of PLC Counters C1 (micro) and C2 (proximity) using the SETP 7-Micro/WIN. 14. Set input switch 10.3 to OFF, The DC motor should stop. 10-13 Exercise 10-3 Automatic Speed Control EXERCISE OBJECTIVE ‘After completing this exercise, you should be able to: 1. Control the speed of DC motor using the micro switch 2. Control the sequence of DC motor operation using the proximity switch. DISCUSSION This exercise is a combination of Exercises 10-1 and 10-2. The ladder diagram is ‘shown in Fig. 10-3.1 The registers and controls are the following: 10.3 input - controls the DC motor to run or stop 11.0 input - receives the actuation signal of micro switch 1.1 input - receives the actuation signal of proximity switch C1 counter - counts the number of micro switch's actuation signal C2 counter - counts the number of proximity switch’s actuation signal \W0 register - saves DC motor speed value When I0.3-ON, the DC motor initially runs at full speed of 1 rev/second. At this time, the proximity switch is ignored. When the motor pointer strikes the operating level of micro switch once, the current value of counter C1 will increment one. When the number of hits is equal to 5, the counter C1 will be cleared and the DC motor speed decreases to low speed (about 1 revolution per 1.5 seconds). In this case, the micro switch is ignored. When the motor pointer approaches the sensor face of proximity switch (actuation LED on) twice, the counter C2 will be cleared and the DC motor stops for 2 seconds, then the sequence is repeated. The sequence repeats Until the input switch 10.3 is tumed to OFF. The current value of counters C1 and C2 can be observed using the SETP 7-MicroWIN. 1-14 Network 1 ox 03 St} Network 2 woe 103 TOW ' uo t+} { | ew eno} sda out wwo Network 2 109 TOW I vt a | Nas od outkwo Netw 4 Neto Tele woo TOE HH len eof 5} vevoe4n___outhswer TOW a x0. out sss TOW en ew} vom our siw70 PS 10-15 Network ax wo2 td JH 8) wax a) 1 Network 7 wo2 c2 waa, PIF: 3) waa >) 1 Network @ waa 12 To rooder__10 mJ Network 9 12 wa 1° 8) wa, a) Network 10 no or { nf a7 sway a wos ofey { N woe 1 “I 10-16 Network 11 na sma Mo. Ma Fig. 10-3.1 Ladder diagram of automatic speed control (Examples\Motor02.mwp) Network 1: Network 2: Network 3: Network 4: Network 5: Network 6: Network 7: Network 8: Network 9: Network 10: Network 11 ‘When 10.3 (Motor Run/Stop) is ON and MO.1 (full speed) is ON, load 200 into memory location VWO. When 10.3 (Motor Run/Stop) is ON and M0.2 (slow speed) is ON, load 45 into memory location VWO. When 10.3 (Motor Run/Stop) is OFF or M0.3 (stop) is ON, load 0 into VWo. Configure PWM 0: time base = 1 ms/cycle, PWM cycle time = 200 x 1 ms =200 ms, PWM pulse width = VWO x 1 ms = 45 ms (low speed), 200 ms (full speed), or 0 ms (stop). Pulse output to Q0.0 (M+). On the rising edge of 10.3 (Motor Run/Stop), MO.1 is set to on. When MO0.1 is on and the current value of counter C1 is equal to 5, reset MO.1 and set MO.2. The DC Motor runs at low speed. When M0.2 is on and the current value of counter C2 is equal to 2, reset M0.2 and set M0.3 to stop the DC Motor. When M0.3 is on (Motor stops), enable the 1 timer T33 (10 ms x 200 = 2s), After a 2-second delay, reset MO.3 and set M0.1. DC Motor runs at full speed, ‘When receiving an actuation signal of micro switch the current value of C1 increments. On first scan or the falling edge of M0.1 (transition from full speed to slow speed) or the falling edge of M0.2 (transition from slow speed to stop), clear the counter C1. ‘When receiving an actuation signal of proximity switch the current value of C2 increments. On first scan or the falling edge of MO.1 (transition from full speed to slow speed) or the falling edge of M0.2 (transition from slow speed to stop), clear the counter C2. 10-17 PROCEDURE 1. Connect the circuit as shown in Fig. 10-3.2. With power off, connect DC 24V- *—" terminal to 24V MOTOR-M- terminal, INPUT-C terminal to MICRO SWITCH-COM terminal, MICRO SWITCH-N.O. terminal to INPUT-I1.0 terminal, PROXIMITY SENSOR-PS terminal to INPUT-I1.1. terminal. Rotate the 24V MOTOR-SPEED ADJ knob fully clockwise (max) Fig. 10-3.2 Wiring diagram of automatic speed contro! 2. Place all the Enable switches SW2-SW8 in OFF position. Set input switches 10.0-11.5 to OFF and set Thumbwheel Switches to 0000. Connect PLC Trainer's Port 0 to your PC's USB port using the USB/PPI cable. 3. Start the STEP 7-Micro/WIN. 4. Create a new project by selecting the File >> New menu command. Complete the ladder diagram of automatic speed control shown in Fig. 10-3.1 10-18 Turn power on. Download the Project to PLC unit by selecting the File >> Download menu command or clicking the +2 _icon in Toolbar. CAUTION: Keep your fingers and objects far away from the rotating parts when the DC motor is running. Run the ladder program by selecting the PLC >> Run menu command or clicking the icon in Toolbar. . Set input switch 10.3 to ON. The DC motor should run at full speed. When the motor rotates five revolutions, the motor speed should decrease to low speed. When the motor rotates two revolutions, it should stop for 2 seconds and run again. The sequence should repeat until the input switch 10.3 is set to OFF. |. Observe the current values of counters C1 (micro) and C2 (proximity) using the SETP 7-MicroWIN. 10-19

Das könnte Ihnen auch gefallen