Vous êtes sur la page 1sur 3

Chapter 4 - Advanced Programming Techniques

Chapter 4 Review Questions and Problems


1.

Draw the ladder rung for an R-S type flip flop that will energize when both IN1
AND IN2 are on and will de-energize when both IN3 AND IN4 are ON. The
condition where all inputs are on will not be a defined state for this problem,
i.e., it will not be allowed to occur so you do not have to plan for it.

2.

Draw the ladder diagram for a T flip flop CR1 which will toggle only when IN1
and IN2 are both OFF.

3.

Develop the ladder for a system of two T flip flops which will function as a two
bit binary counter. The least significant bit should be CR1 and the most
significant bit should be CR2. The clock input should be IN17.

4.

Develop the ladder diagram for a 3 bit shift register using J-K flip flops that
will shift each time IN1 is switched from OFF to ON. The input for the shift
register is to be IN2. The three coils for the shift register may be any coil
numbers you choose.

5.

Design the ladder diagram for a BCD counter using T flip flops. The LSB of
the counter is to be CR1 and the MSB is to be CR4. The clock input is IN2.

6.

Design the ladder diagram for a device that will count parts as they pass by
an inspection stand. The sensing device for the PLC is a switch that will
close each time a part passes. This switch is connected to IN1 of the PLC.
A reset switch, IN2, is also connected to the PLC to allow the operator to
manually reset the counter. After 15 parts have passed the inspection stand,
the PLC is to reset the counter to again begin counting parts and turn on a
light which must stay on until reset by a second reset switch connected to
IN3. The output from the PLC that lights the light is OUT111.

7.

Design the ladder diagram for a program which needs a timer which will
cause a coil CR24 to energize for one scan every 5.5 seconds.

4-22

Chapter 5 - Mnemonic Programming Code

Chapter 5 - Mnemonic Programming Code


5-1.

Objectives

Upon completion of this chapter, you will know


why mnemonic code is used in some cases instead of graphical ladder language.
some of the more commonly used mnemonic codes for AND OR and INVERT
operations.
how to represent ladder branches in mnemonic code.
how to use stack operations when entering mnemonic coded programs.
5-2.

Introduction

All discussions in previous sections have considered only the ladder diagram in all
program example development. The next thing to be considered is how to get the ladder
diagram into the programmable controller. In higher order controllers, this can be
accomplished through the use of dedicated personal computer software that allows the
programmer to enter the ladder diagram as drawn. The software then takes care of
translating the ladder diagram into the code required by the controller. In the lower order,
more basic controllers, this has to be performed by the programmer and entered by hand
into the controller. It is this type of language and the procedure for translating the ladder
diagram into the required code that will be discussed in this chapter. This will be
accomplished by retracing the examples and ladder diagrams developed in earlier chapters
and translating them into the mnemonic code required to program a general controller.
This controller will be programmed in a somewhat generic type of code. As the code is
learned, comparisons will be presented with similar types of statements found in controller
use. The student will have only to adapt to the statements required by the type of controller
being used to develop a program for that controller.
5-3.

AND Ladder Rung

Let us begin with the ladder diagram of Figure 5-1. This is the AND combination of
two contacts, IN1 and IN2 controlling coil OUT1.

5-1

Chapter 5 - Mnemonic Programming Code

Figure 5-1 - Ladder Diagram for AND Function

Ladder diagrams are made up of branches of contact logic connected together which
control a coil. For instance, IN1 AND IN2 can be considered a branch. This rung has only
one branch. We will see examples of multiple branches later. The code command which
alerts the controller to the beginning of a branch is LD. The LD command tells the
controller that the following set of contacts composes one branch of logic. The complete
contact command code for these is:
LD
IN1
AND IN2
The lines tell the controller to start a branch with IN1 and with this contact, AND
contact IN2. LD commands are terminated with either another LD command or a coil
command. In this case, a coil command would terminate because there are no more
contacts contained in the ladder. The coil command is STO. The contact and coil
commands for this rung of logic are:
LD
IN1
AND IN2
STO OUT1
The STO command tells the controller that the previous logic is to control the coil
that follows the STO command. Each line of code must be input into the controller as an
individual command. The termination command for a line of code is generally ENTER.
NOTE:

Two types of terminators have been described and should not be confused
with each other. Commands are terminated by another command (a
software item) while lines are terminated with ENTER (a hardware keyboard
key).
5-2

Vous aimerez peut-être aussi