277_Lab09_Hints

advertisement

EET 277 Lab 9: Some Basic PLC Programming pieces

When separate instructions control the same bit:

This is a classic example of how PLC logic is different that wored-logic. First, this could not ever be wired using relays because the 2 rungs that control coil 2/0 would have to be done on one rung because it is only one coil. In a PLC you can change an output multiple times, which frequently leads to strange results that are very frustrating. So if you ever see a situation like Rungs 000 or 001 in which an input is true, but the output is false or vice versa, you can bet that later in the program you change the same output another time. Where it gets really tricky is when the output bit is controlledd by a word instruction. See the Move/Masked-Move example.

Self-Resetting Timer:

This is a very useful piece of programming if you want something to happen every so often, like if you want a sequencer to go on to the next step every

5 seconds, or you want to run a lubricating subroutine every 2 hours.

Cycle-Timer (Toggle Timers)

This is a useful program if you want to cycle an output for a different on/off time. This program will allow you to turn an output on for 1 second and off for 1 second as long as I:1/0 is on.

This is useful for communicating problems using an indicator light.

EET 277 Lab 7: PLC Hints Page 1 of 5

EET 277 Lab 9: Some Basic PLC Programming pieces

Free-Running Clock Bits:

If you want to flash a light every ½, 1, 2 or 4 seconds (the same time on as off) a simpler solution that the cycle timer is the “Free-Running-Clock” bits in the PLC CPU. This clock is in a PLC’s CPU to keep track of time and to perform other tasks, and in RSLogix you can make use of it. This clock is in the Status File (S:4).

Please note that there is a huge difference in how a specific bit will work in an RSLogix 500, 1000 and 1500. In

LogixPro the speed of these bits is controlled by the Sim/Scan control (the slide-pointer) in the PLC Panel.

The easiest way to enter these bits into your LogixPro program is to type the address exactly as you see it:

“S:4/11” or “S:4/8”.

Using a Push-Button and timer in increment and decrement a number:

If you cannot use number-entry to increment or decrement a setting, an up-and down push-button can serve:

You may want to put in a couple of

MOV statements to move a base time into the accumulators when the

Run switch is off.

You will need a second Move statement to change the preset of the other timer.

EET 277 Lab 7: PLC Hints Page 2 of 5

EET 277 Lab 9: Some Basic PLC Programming pieces

Move: Changing all of the outputs in a card at one time:

Sometines it is useful to to turn all of the outputs in a card off or on in one instruction. The Move command will do this, but it will over-write ALL of the bits in the word.

Masked Move:

This command will do the same thing as the Move Command, but it will allow you to leave certain bits alone if you need to.

EET 277 Lab 7: PLC Hints Page 3 of 5

EET 277 Lab 9: Some Basic PLC Programming pieces

Using BCD I/O:

If you do have a Thumbwheel-device that can be used to set a number the FRD abd TOD commands are useful.

FRD will convert a BCD number into Decimal. “999” in BCD is not that same as 999 in decimal because of the way the number is fed into a PLC. A PLC uses 4 bits for each digit in a BCD input, while 4 bits can actually represent 16 possible states. As a result, BCD “99” would actually be understood as Hex “99” which is

10011001b = 153 decimal. The good news is that you don’t have to know how make the conversion, you just need to know when to use the command to do it for you.

In this case the Preset of T4:1 will be controlled by the Thumbwheel switch connected to 1:5 if I:1/4 is on. The Preset of T4:2 will remain

10, but could be changed with a second FRD command if you want.

The partner to the FRD command is the TOD command which converts a deciaml number into the BCD number to send to a BCD display.

EET 277 Lab 7: PLC Hints Page 4 of 5

EET 277 Lab 9: Some Basic PLC Programming pieces

All Of Problems should be completed in one program file. At the beginning of each Program section add a rung comment to show the Problem Number:

E-mail your program to your instructor as an attachment.

1) Program the first circuit (multiple rungs controlling the same output) and add a rung comments to explain why each rung operates as it does.

2) Build a Self-Resetting Timer to cause a counter to increment every .5 seconds If Input 2 is on. When the counter indicates 2 seconds has passed, turn on Output 2 and stop the timer. When Input 2 is turned off reset the counter. (Hint: Add the counter done bit (i.e.: C5:0/DN) to the self-resetting timer rung.

3) Set up a Toggle-Timer to control Output 4. When Input 4 is on, Output 4 will be on for 0.7 seconds and off for 1.0 seconds, starting in the on-state as soon as Input 4 is closed (but off if Input 4 is off).

4) Using the same Toggle Timer as number 3, have the same input control Output 6, but Output 6 should start out in the off condition, and be on when Input 4 is off. Output 6 should be off is Input 4 is off.

5) Use the Free-running clock bit 8 to control when Output 8 is on, if input 8 is on. Note that Input 8 will not actually start the FRC, it will simply use the bits that are already in-progress. It is like turning on the TV and catching a program already in progress.

6) Use an on/off switch for Input 10 to allow Output 10 to flash on and off for a default time of 1 second. If

Input 11 is closed increment the on-and-off-time 1 second for every second Input 11 is held closed. Decrement the on-and-off-time 1 second for every 1 second Input 9 is held closed. When Input 10 is turned off, return the on-and-off-times to 1 second. This will be similar to the example above, but you will need to move 10 into the counter accumulator when I/10 is off to set the base time of 1 second.

7) If Input 12 is closed use the BCD input to control how fast Output 12 flashes. Start with Output 12 off, with the first delay in the off-state. The BCD will set the delay in 10ths of a second so a setting of 10 would result in a 1 second delay. Display the accumulated time (both incrementing and decrementing ) on the BCD output display.

8) If input 14 is pressed turn off Outputs 0, 2, 4, 6, 8, 10, 12 and 14. And turn on all of the other Outputs. Use

N7:0 to store this binary number. If Input 14 is off, momentarily turn off all of the outputs. Use an OSR (One-

Shot-Rising) to control the second move instruction (when the outputs are cleared). Make these rungs the last instructions in the program because they will over-write all of the other output instructions.

EET 277 Lab 7: PLC Hints Page 5 of 5

Download