What is a PLC? PLC Basics Pt2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to an introduction to programmable logic controllers part 2 this is presented by the w w plc professor comm website and plc professor youtube channel this is an example of a relay control panel notice how everything is mounted in rows the top row contains allen bradley release about 25 of them the second row also contains about 25 relays but the third row is made up of motor starters remember I explained in an earlier presentation that motor starters are really three pole single throw relays or contact relays with the addition of something called motor overloads these are thermally sensitive devices that will open the path for current flow if there is too much current the key element to grasp from this photo is that there are many relays mounted in many rows this is a graphic illustration of an industrial control panel if we remove the face of the enclosure to reveal the actual backplate or panel we see an array of brown rectangles that we are representing as individual relays an actual panel would have additional devices but our panel is made up of a very very neat rows of just relays but they are not all identical looking at the relay control panel from a logical view and simplifying the illustration by showing all of the input devices with their cables landing on terminal strips on the left end of the panel and all of the output devices with their cables landing on the right side of the panel in each two separate terminal strips so you see two rows of yellow relays and then on one end you see a row of terminal strips and then on the other end of the panel so ordinarily input and output devices would not be separated out like this but for the sake of our illustration and explaining how a relay control panel functions this is necessary now all the relays on this panel are probably of this type in the previous slide all the relays were Brown but now we have a column of yellow relays on each end these are the interface between the input and output field devices the input devices are proximity switches to detect the presence of objects and close proximity they're non-contact they function by emanating a field either magnetic or electrostatic from the face of the device and then changing state when the field is disturbed by the presence of an object I just demonstrated this to some degree in a previous lecture on basic electricity and magnetism then also for input devices we have photoelectric switches or photo eyes these are another present sensing type of device that function by changing state you know going from off to on and off when a beam of light is broken if it's a through beam type photo I or the device senses reflected light you have two types of photo eyes there are those that are called through beam in other words you have a sensor on one side of a path of travel and then you have a light source on the other and when the object goes by and breaks the beam the sensor says aha something's passing by you have other devices that for instance the one right in front there you can see it has two lenses looks like two eyes one of those emits light and the other looks for light reflected back so when an object passes by and the special frequency of light is reflected off of that object back into the other lens it detects the presence besides proximity switches and photo eyes we also have limit switches and they're one of the oldest presence sensing devices sensing presence by actual contact with an actuator on top of the device that operates a switch to those you can see a plunger with a little wheel the other two would require an additional item that you purchased called an actuator arm that's adjustable both in length and angle also condition switches which have been around quite some time they operate a switch when a temperature or pressure changes since all these devices are digital that is to say they have two states they're either on or off the bulk of the relays are the internal relay logic that respond to the changes in the state of input devices or respond to a combination of states of several input devices output devices are most often motor starters we saw a few motor starters in the previous slide these are devices that control electric motors what you see in front of you are all three pole devices for three-phase which is a special format of electricity that gives you much smoother and much greater power than single-phase so these are three pole relays you know when you actuate them or energize them they switch three poles or three separate paths of conduction in and out the only access to the state of logic on this type of panel are through illuminated indicators so on a regular relay panel where you don't have a computer screen you have indicators so these indicators are wired in as outputs when certain conditions are met a light will turn on on the front of the panel to indicate that the conditions have been met and you're in a certain step or phase of the process and most processes these days have solenoid valves there's more than just solenoid valve so we say solenoids but 90% of the time there's solenoid valves in an earlier presentation we talked about these solenoid valves and their functionality with cylinders all of the products that you see on the screen here are available from Allen Bradley which manufactures industrial control products there are other companies that make the similar products this particular company Onam Bradley has probably the largest array the only item that they do not sell manufacturing sell are the solenoid valves although a real a real relay panel would not be arranged this neatly the idea is the same there are relays that are energized by means of input devices there are relays that are strictly internal to the logical NASA nations of the process we call that relay logic in other words they don't actually directly respond to an input device but they might respond to a group of input devices so their logical relays and then of course we have relays that switch the output devices on and off as programmed for the sake of illustration we have enlarged the panel and increased the number of rows to teen rows of relays next we will rotate the panel to conveniently give us rows of 16 relays and we will pretend that we have 8,000 rows of 16 relays actually in computer land 1k is not really 1008 K is not really 8,000 and you will see why later when we talk about the binary number system for now however we are pretending that we have eight thousand one hundred and ninety two rows of sixteen really small relays so we now are going to identify our relays by row and position that is to say that we have coil 0 through 15 and row 0 and we have 0 through 8191 rows which is a total of 8,000 192 because in computer land everything starts with 0 if this were relay coils it would be we would have Row 1 through Row 8,192 and we would have coil 1 through 16 if you look at one coil here and we'll take the last coil in the first row so we would identify this coil as row zero coil 15 if we look at it we'll see that it's a coil with one form C contact now we know that that relay coil and contacts could be a number of other configurations but remember we're making a transition now to bits in memory if we need more contacts for that coil we just simply add more contact blocks now that was an awful lot of information to take in in a short time so give yourself a break get up and take a stretch get something to drink and come on back there are several number systems made use of in the human interface - programmable logic controllers at the fundamental level at the actual computer electronic level everything in any computer is binary binary is a base 2 number system 2 States 0 and 1 digital on or off yes or no true or false everything is absolutely binary there's nothing but ones or zeros in any digital computer system therefore decimal hexadecimal octal and binary coded decimal are used to interpret the binary values present in the memory of the programmable logic controller and display them on the screen in the programming software whereas they are always binary in the PLC on the our graphical user interface like rslogix 500 rslogix 5000 or any programming software we may see a decimal value we may see a hexadecimal value but they are representing binary numbers the binary numbers system is second nature to us so we will use it as a springboard into binary to do that first we're going to look at the decimal system as we see it you have indexing positional notation exponential indexing would be like an odometer so if you look at the highlighted area there and you see zero through nine in various vertical positions so if you take the least significant digit would which would be the zero to the far right for every ten clicks of that position the next position to the left is going to click once so the second position from the least the second least significant digit is a ten counter the third position is going to click once for every ten clicks of the second position which clicks once for every ten clicks of the first position so that's one times ten times ten so that's 370 so the third position is a multiple of 100 and of course you know decimals all second nature to us so indexing like an odometer in exponential we have units and then we have 10 to the first power 10 to the second power 10 cubed 10 to the 4 10 to the fifth and 10 to the 6 in positional notation which really is the one that were the most familiar with is ones tens hundreds thousands ten thousands hundred thousands and millions again if you start with the unit's position which is the least significant digit all the way to the right ones you simply multiply by 10 by 10 by 10 by 10 by 10 by 10 to get to a million okay everybody understands this this is second nature to us if I were to rip off a number and say five million seven hundred eighty five thousand 934 you can picture that number in your mind you could write it down you could repeat it and if I said dollars you would instantly have a relatively good idea of what that was worth the actual value here we have again of four I'm sorry three representations of the same value 40,000 four times ten times ten times ten four times ten to the fourth so again everyone observing this understands the decimal number system and is very very intimate familiar with it binary on the other hand now we're going to showing this exactly the way we did decimal so there's binary I'm sorry there's decimal indexing exponential positional notation and here's binary decimal binary indexing where is in decimal it took ten clicks to get the next significant digit to click once with binary two clicks and the next one clicks once exponential units times 2 times 2 times 2 times 2 times 2 times 2 or 10 to the first 10 squared I'm sorry I'm so used to say in scientific notation 10 to the 0 powers units 10 to the first power is twos 2 to the second power as 4 is 2 to the 3rd power is 8 and so on now here's an interesting point notice that the exponent on the base to number system goes beyond 2 characters so in the binary number system there's only two characters 0 and 1 there is not a 2 2 is not part of the binary number system once so if you get 2 clicks on the least significant digit then the next position goes to one well there isn't really a name for any of these positions just like over in positional notation we typically say 1 2 4 8 6 1 2 4 8 16 32 64 times 2 is 128 times 2 is 256 512 1024 2048 4096 8192 16384 and so on but in order to describe anything between human beings in the binary number system other than saying 1 or 0 we have to use the decimal or base 10 number system otherwise no nobody would have a clue what we were talking about so keep this in mind there are no words in the English language to describe anything in the binary number system other than 0 and 1 we say we have a 2 we say we have a 4 we say we have an 8 but 2 4 and 8 are not words that describe the binary number system so the binary number system is in a land all by itself there is no way to talk it no one can talk binary ok hexadecimal base 16 number system we're not going to elaborate as much on this however and you haven't really looked at yet if you take a 16 bit binary word that's 16 positions and in each position you have a 0 or a 1 4 hexadecimal you can break up those 16 positions into 4 groups of 4 bits and then each group of 4 bits is represented as you see here in this diagram so 4 zeros is 0 and if you go down through the first column there you get to the bottom you have an 8 no 4 is no twos and a 1 well 8 and 1 is 9 however the next position 1 0 1 0 at the top of the column on the right-hand side that would be equivalent to decimal 10 but you can't use 10 in as a single symbol to represent one value so in other words for the first 10 positions 0 through name or 4 zeros through 1 0 1 we could use a single character 0 through 9 to represent the value but when we get to the top of the next column we can't put in 1 0 as a single symbol so we instead we use ABCDE and F to complete these 16 possibilities for four binary digits in other words if you take 0 0 0 0 which equals 0 if you take all the possible combinations of those 4 bits you see them all right here so for 3 bits there are 8 combinations for 4 bits there are 16 combinations for 5 there would be 32 and so on for each additional binary position you double the total number of combinations so if we look at the value over on the right there 1 0 1 1 in hexadecimal 1 0 1 1 is 11 so if you add up the binary values look right above it you see the blue arrows point down and then you see 2 to the 0 2 to the first 2 squared and 2 cubed right well you figure that out you've got a 1 a 2 and then 2 cubed is 8 so 8 + 2 is 10 plus 1 is 11 you look over at 1 0 1 1 in the white area they're equals B 11 so B represents a hexadecimal 11 we don't use a lot of hexadecimal in program logic controllers anymore but you will see it especially when it comes to something called a mask there are certain instructions that use masks and there they are usually represented in hexadecimal so once again our 1 0 1 one eight plus zero plus two plus one equals eleven hexadecimal now this is also hexadecimal the previous one one zero one one when you look at that you really don't know whether that's binary or decimal or hexadecimal it's one zero one one it could be one thousand eleven or it could be hexadecimal eleven so typically you're going to see a subscript to the right and lower for the value in this case it would have an H it would show that was hexadecimal now when you see a value like this one a zero f one because you see alpha characters in there you know it's hexadecimal this is really this value right here is really outside the scope of this lecture but it shows you how difficult it is to deal with any number system other than decimal I mean binary is not real bad but hexadecimal and octal become very difficult okay binary coded decimal is another variation and you see they've divided up the sixteen bits into four groups of four bits the difference is in BCD the equivalent decimal value of any group of four bits will never exceed nine because this is binary coded decimal the conversion value has to be decimal so look at the top 16-bit word one zero zero zero zero one one zero one zero zero one zero one zero one well you know I just repeated that read it off the screen and I can't remember what I said but if we go through and convert and add up a 1 of 4 or 16 128 add 512 add 1024 and add 32 thousand seven and 68 that adds up to thirty four thousand four and 53 as a decimal equivalent so you see the top 16 bits have a little too subscript equals thirty-four thousand 453 with a 10 next to it that way you know it's decimal now we take those exact same 16 bits drop them down divide them up into groups of 4 bits we say the first 4 bits to the right are the ones or the units the next four are tens the next four are hundreds and the last four are thousands so we have eight thousand then you have a 4 and a 2 that's six that 600 you have an 8 no one that's 9 and you have a 4 and a 1 that's 5 but you don't add them all up those are the positions eight six nine five eight thousand 695 BCD you see that a little more often and some of the older PLC's and newer PLC's there are instructions for BCD to BCD and from BC deconversion instructions but you're not going to see that much of either hex or BCD okay octal basic number system remember we're talking about the number of symbols binary has two symbols zero one base at eight has eight symbols zero through seven base 10 decimal what we all know and love has ten symbols zero through nine hexadecimal has 16 symbols zero through nine ABCDE and F so if we look at these bits here one zero one zero zero one zero one little subscript base eight that's equivalent to two million one hundred twenty nine thousand nine nine hundred and eighty-five and base ten the next value there that's also base eight that's the highest value you could have for base eight for eight positions because remember the characters are zero through seven so seven seven seven seven seven seven seven seven you can't go any higher than that that's it seven is the highest value in octal you won't see this in any new plc but in the older plc 5s PLC 2's especially the 1771 IO configuration for what was called a rack of memory you had a 2 slot addressing in one slot addressing 1/2 slot addressing and it all revolved around the base 8 number system I'm sure you have lots of questions but this will basically take care of an introduction to different number systems the one that we really care about the most is binary ok binary digits bi TS bits that's where that term come from a bit is one position in a binary value a nibble is for 8 bits is a byte 16 bits is a word 32 bits is either a double integer or a long word and so forth now let's jump back to our enlarged array of relay coils and magically convert our array of relays into an array of individual micro circuits each of which can individually be controlled into two states Anuradha just like a relay coil that can only be one of two states on or off so are the bits of memory they are in one of two states on or off in binary the closest that we can come to 1000 as positional notation is 1,024 in other words multiples of 10 one ten hundred thousand but with binary it's 1 2 4 8 16 32 64 128 256 512 and 2 times that is 1,024 for years now the makers of computer memory have quantified their product in kayes of memory or multiples of 1024 in recent years the industry has strayed from this convention because the extra 24 elements really began to add up when you get into mega and Giga elements so let's pick up one real a equivalent bit and examine its actual construction you see that each bit is an actual micro circuit that is connected to the entire array of bits in such a way that it can be turned on or off and in such a way that it can be red or to say that it can be examined to determine which of the two states that it is in on or off so with relays you use the normally open normally closed contacts to query the coil as to its state in computer memory you read or write you write to the bit to set at 1 or 0 and you read from it to see what its state is let's select another bit in the array in the upper left hand corner you could say that these two bits are as far apart as possible in the memory array what is the only difference between these two bits just think about that for a second the address or more correctly the memory location as we go along you will notice more use of the term memory location than memory address before there were street names and house numbers the word address was strictly a verb never a noun when we get into programming we use the instructions that address memory locations much as you address a person with a question or a statement a read or write when you make a statement addressing an individual you're setting their state if you ask a question you're reading or determining their state this fine point will make it easier to the description of logic programming okay here's one last look at a relay let's take a tighter look at the symbols and functions in a relay control system the contacts are used in other circuits to indicate whether or not the mother coil is energized so you could say that the normally-closed conduct contact has continuity if the relay coil is the normally closed contact of a relay has continuity if the coil of that relay is correct de-energize the relay de-energize is the normal state so the normally closed contact will be normally closed when the coil is in its normal state of de-energized true and false are an alternative to on and off the normally closed contact is true if the relay is de-energized or off the normally open contact is true if the relay coil is energized or you could say the normally open contact is true if the coil is energized the normally closed contact is true the coil is de-energized after all we are going to be talking about the state of bits and memory from here on and they are on or off okay we've replaced the relay now with a bit of memory the symbol for the bit looks kind of like a circle like a relay coil now the reason that it has the shape it has believe it or not was in the early days they a printer could not print a circle so when you were printing out your PLC program the closest they could come was a open and close parentheses and that's how we kind of got stuck with this symbol for the bit and then of course you have what looks like a normally closed and normally open how would you phrase now remember these these these are instructions now not contacts but we're using the symbols from really context to represent the instructions so the first instruction over there on the left that looks like a normally closed contact this instruction is true if the bit is de-energized or energized correct d energized or off this instruction is true if the bit in memory is de-energized or off from now on we should be saying off not de-energize because you don't energize a bit you set it on or off you set it in one state of the other this instruction is true if the bit that it addresses in the PLC's memory is energized or on let's do this again this instruction is true if the memory location addressed by this instruction if the memory location if the bit in memory addressed by this instruction is off this instruction is true if the memory location the bit in memory the memory location addressed by this instruction is on this instruction is false if the memory location the bitten memory if the memory location addressed by this instruction is on because this instruction is really true if off now Allen Braley calls us these two instructions xic and xio I prefer to call this one true if off therefore it's false if it's on this instruction is false if the memory location the bitten memory addressed by this instruction is off okay this is a normally open push button and this is not part of PLC programming but there is a certain situation when programming a PLC that you might run into which is confusing and that is the difference between when you have a normally open contact or a normally closed contact wired up as a National input device remember a push button is an input device so normally open push button is spring-loaded in this position the open when you press the button a normally open push button this is now held closed so when you're pushing the button you have continuity and if this is wired to an input of a PLC that input is on this is a normally closed push-button and it has continuity when you're not touching it so if this is wired up to appeals the input and no one's touching it the input is and even though this button is not pushed because it is normally closed now don't forget this so if we push the button the contact is broken the input that it's wired up to goes off so a normally closed push-button when you push it the input that's wired up to will go off so remember the difference between normally open and normally closed contacts out in the field in the actual input field circuitry there are just the opposite of each other okay normally open push button normally closed push-button look at those closely there are cases where you want to initiate a sequence when a button is released we especially see limit switches that are held opened or closed against their normal state in these cases we refer to these switches in their normal state held closed with push buttons you don't normally hold them closed however with limit switches it is possible the machine could rest against a normally open limit switch and hold it closed or with actual push buttons you may have a situation where you have to hold the button down for a specific length of time you have to exceed that interval otherwise the logic in the PLC ignores it until after a timer has timed out and the same would go for a normally closed push-button held open what this does is this prevents triggering logic by accidentally bumping these push buttons continuing on with our relay panel remember that we still are representing the logical landscape with eight hundred eight thousand one hundred and ninety two rows of sixteen relays we're only showing the coils because the coils really represent the individual or collective state of all the conditions that we're working with in our logical program so let's zoom in on just one row row one coil 0 through 15 now let me explain something the layout or the actual location of a coil is defined by row and coil row 1 coils 0 through 15 but that's not necessarily the name of the coil for instance so far in our presentations we've used the designation for a contact relay as one CR it means it's the first one that we assigned as we were creating our logic and then the next one would be 2 CR 3 CR that doesn't mean that once CR is the second relay coil from the right in any one of these rows in other words 0 through 15 so it's not 0 CR 1 CR through 15 CR this is the physical location not the logical location keep that might now we're going to take these 16 relay coils because remember the coils represent the state the the state of the coil represents the state of the collective devices that control that coil ok now we're looking at those same 16 coils Row 1 and quell 15 is the one that we have assigned the name to 1 CR these are all contact relay coils we haven't changed two bits in the memory yet so if you look at our diagram here this portrays a connection between an actual input device the relay coil and the relay contacts always remember that there is no electrical connection between the input device and the relay contacts that represent there eight so once CR represents the state of that pressure switch in the filled wiring that runs off of 24 volts DC 1 CR - 1 + 1 CR - 2 also represent the state of that coil 1 CR which represents the state of the pressure switch you could say that once the R - 1 and - 2 also represent the state of that pressure switch but only because that pressure switch is wired up fill wiring wise to that coil the actual input devices turn relay coils on and off and the contacts read the state of those coils you could say that the relay coil controlled by the input device represents the state of the input device looking at the input device it is a pressure switch when the pressure reaches a pressure that was set it is said to have reached its set point so that pressure switch has a dial on it that you can't see in the diagram and you set that dial for a particular pressure psi when that pressure is reached that particular sensor is going to close as you can see it's normally open it's held open by a spring the spring tension is adjusted by that knob that controls a set point at this point the contacts in the device change state the device can have both normally open and normally closed contacts however the pressure switch is not wired directly into the control panels logic the state of this input passed through a device that isolates the filled voltage from the electrical circuits of the control panel looking at this diagram with the state of the input as shown and with what you know about the contexts that are identified as being controlled by this input device are either of the contacts true at this moment when I say either of the context I mean one CR - one and one CR - two the pressure switch is open in the field wiring which means that once the R is de-energized so are either of these two relay contacts one CR - one one CR - two are either one of them true correct the true off off because the relays off because the pressure switch is unconnected it's not completing the circuit the true of off contact that is identified with a relay coil is true because the coil is off so the contact is true because the coil is off and the coil is off because the fueled device the pressure switch is open remember the contact reads the coil not the pressure switch now your se saying in this case isn't it one on the scene in some cases it will appear one on the same in other cases it will not be as you'll see later what do you think will happen when the pressure device reaches the setpoint correct the state of the contacts change allowing free electrons to pass through the coil of the relay energizing it consequently the contact that was true is now false in the contact that was false is now true so once the R - - is now true because it represents one C R which represents the pressure switch remember the relay coils are data that represent the state of the field devices such as proximity switches photoelectric switches limit switches conditional switches etc however the contacts mechanically connected to these relay coils do not exist in the scheme of things unless you use them that is the contacts are wired into other circuits that control other relays or the control output devices such as motor starters panel indicators solenoid valves etc etc this is why we separate the coils from the contacts logically in our diagram okay let's run let's run this diagram through a time machine watch closely the transformation from relay coil and contacts to a bit in the memory of a PLC and the basic instructions that address these bits watch the location of the coil changes well to a memory location so what was coil 15 is now bit 15 what was Row 1 is now word 1 now there's an I in there word I : 1 the eye is in there to signify that this 16-bit word of memory is part of the input I for input part of the input image table so look this over closely you still have your pressure switch it's still 24 volts DC another inclusion here if you will the row of yellow relays in our original relay panel was the electrical interface between the field device voltages and the voltage on the panel we have now replaced those special relays that interface the field voltage to the panel voltage with something called an optical isolator so that little square you see there with a diode a couple looks like bolts lightning that just indicates light and then a photo transistor and as part of the input module so the input module specifically is the electrical interface between the filled wiring and bits in memory the memory is most likely powered by five volts DC where the fill wiring could be anything from 24 volts 115 volts etc so this optical isolator and if you look closely at it you can see that there's an airspace so to speak between the fill wearing and the output side of the optical isolator that is connected to bit 15 of word one this optical isolator is made up of two components now there's actually more components than this but for the sake of illustration representation we have a diode that's the black arrow with the point of it against a flat line there's a cathode and an anode here now the direction of the arrow is in the direction of conventional current flow remember we explained in an earlier lecture that early on in the days of scientific discovery that they named the two polarities positive and negative positive meaning excess negative mean deficiency and that's the direction they thought that current flowed what law it turns out that actually the component that moves the electrons flow from negative to positive which means they would flow against the arrow so regardless of whether you want to use electron flow or conventional current flow this diode this air roll it's a rectifier it only allows current to flow in one direction this particular diode is an LED light emitting diode so when you apply voltage across this diode and you have current flow which electron flow would be from the bottom against the arrow up to the top it emits light to the right of this optical isolator is a transistor it's a three layer device meaning that it has a emitter a base and a collector the base though instead of having a wire or a conductor connected to it is sensitive to light so look at it this way the two little bolts of lightning there the light coming from the LED hits that flat line that's part of the photo transistor that basically is sensitive to light and you have a voltage applied from the bottom of that photo transistor to the top that we're talking about the right side of this opto isolator now the flat line with the two lines that come in at an angle one of them has an arrow on it so you have a voltage applied across this from top to bottom when light strikes the flat line which is the base it allows it to conduct so basically you could say when you turn the LED the light emitting diode on the Left when it goes on the transistor conducts electricity when the light emitting diode on the Left goes off the photo transistor on the right shuts off so we illustrate this we have current flowing through the LED it produces light it's the base of the photo transistor and you have current flow so if the input is on in other words if that pressure switch closes you have conduction and then you have conduction through the photo transistor to the bit memory when it goes off you no longer have transmission to that bit in memory okay a little more detail this is a diagram that portrays the connection between an actual input device and the PLC's memory always remember that there is no connection between the input device and the ladder logic instructions that use their state the actual input devices turn bits in memory on and off and instructions read the states of those bits just like a contact on a relay basically reads the state of the coil you could say that the bit in memory controlled by the input device represents the state of the input device looking at the input device it's a pressure switch when the pressure switch reaches a pressure that was set it has reached the setpoint at this point the contacts in the device change state the device can have both normally open and normally closed contacts however the pressure switch is not wired directly into the PLC's memory the state of this input passed through a device that isolates the field voltage from the electronics of the PLC this is : opto isolator and the opto isolator z' are normally packaged in groups of sixteen placed into a separate module that is sled in and out of iraq so if you have a particular type of device you want to integrate into your PLC you buy an input module that has the correct opto isolator x' to integrate that input device into the plc when the input device completes the field circuit the free electrons flow through an LED that illuminates a photo receiver allowing current to flow to the bit memory the sole purpose of this device is to isolate the field voltage from the PLC circuit this arrangement allows all manner of input devices to connect to the PLC without needing a relay to isolated remember in our earlier presentation we use the isolation between the coil of a relay in its contacts to isolate the field voltage from the logical voltage on the panel the reason that it is important for you to understand this is because a big part of the market and a major component of all PL systems are the i/o modules these are the individual modules that allow different types of field devices to interface into the PLC's memory looking at this diagram with the state of the input as shown and with what you know about the instructions that are addressing the bit and memory controlled by this device are either are the instructions true correct the true 5 instruction that is addressing a memory location I for input Row one coil 15 or bit 15 is true because the bit in memory that it is addressing is off so the instruction is true because the bit is often memory and the bit and memory is off because the fuel device the pressure switch is off remember the instruction reads the bit and memory not the pressure switch what do you think will happen when the pressure device reaches the setpoint correct when it reaches the setpoint the pressure switch closes now I don't show it I'm not animating it show up close instead I just highlighted it in green to show that the circuit is completing the field wearing the state of the contacts changed in the pressure switch allowing free electrons to pass through the LED in the opto isolator the thereby turning on the Associated bit memory so you see bit 15 now of word 1 now shows that it's on whether green circle consequently the instruction that was true which looks like a normally closed contact there it was true before we turn this on it's now false in the instruction that was false is now true while the PLC is in the run mode the logic is continuously reading the bits in memory that they are addressed to and updating the logic we always made a few changes here let's fatten up our diagram with more than one input and change the device to momentary contact push buttons we did have a normally open pressure switch in there now we have a normally closed and a normally open push button there are two push buttons in this diagram what is the difference between the two correct the first one has a normally open contact the one on the top has a normally open contact and the second push button has a normally closed which means when neither button is touched being pressed depressed the top one a spring holds it open in the second one a spring holds it closed normally open normally closed they consider their normal state as you see them right now are either of the two input devices completing their input circuits to the PLC so the question is are either one of these two supplying voltage to the input module to turn the bits on in memory give you a second to think about that correct the normally closed push-button connected to bit 414 of word one is a completed circuit and the free electrons are flowing through the optical isolator and turning I bet 14 of word one in the PLC's memory look closely at the plc instructions that look like relay contacts remember we're making the transition from relays to bits and memory so we substituted actual electronic bits in memory for the relay coils and for the contacts we're substituting logical instructions and they look like normally open normally closed contacts but they're not they are instructions that are true font roof off based on addressing a bit and memory and you can see each instruction has right above it input : 0 1 slash and a bit number that's analogous to a coil number of row 1 ok look closely at the PLC instructions that look like relay contacts compare their state to the bits of memory that they are addressing which instructions would be true with neither push button actuated in other words right now no one's pushing a buttons which of these instructions would be true correct true upon instruction addressing bit 14 is true because that circuit is complete turning on that bit in memory but the true 5 instruction addressing bit 15 is true because the circuit for input 15 is not on and the bit and memory is off so here's a major point of confusion for many people making the transition between relays and PLC's even though it makes perfect perfect logical sense the problem is this is a normally closed push-button so when it's not pressed the bit is on a memory and the Trufant instruction is true so a lot of people look at this and say well if you're not pushing the push button then how come that instruction that looks like a normally open addressing bit v 14 how come it's true if you're not pushing the button it's true because the circuit on the field wearing not has nothing to do with whether the push button is pressed or not when you write code when you read code you have to know what kind of contacts you have in your input devices because not just push buttons have normally open normally closed all the other sensors have the ability to connect up a normally closed or a normally open contact to the input you can set photo eyes to what they call light operate and dock dark operate two different modes of operation one of them turns on the bit memory if it doesn't see anything and the other mode of operation turns it on if it does see something you have to know what you have in your input field wearing to relate that to the logic in your memory those instructions that look like normally open normally closed so the only real way to look at these instructions when you see that instruction that's true right now.i : zero 1/14 that looks like a normally open contact it's true because bit 14 is on you want to isolate that in your mind from what it's actually hooked to out there in the field unless you're writing the code if you're writing the code and you want to know if that button is closed which it is right now the one hooked a bit 14 it's closed if you want to know if no one's pushing it then you need to use the true fun instruction because the bit is on but 14 is on let's elevate word input : one to the top of the diagram to emphasize it this makes it a little bit easier to look at so rather than work in the small definition down there in process memory will elevate this word and continue before we depress the push button run through this action in your imagination and visualize what you think will happen okay we have a finger poised above the normally closed push-button what is going to happen in the opto-isolator x' and in memory and how will the instructions change they're true/false status when you push that button when the normally open I'm sorry when the normally closed push-button is pressed down it forces the contacts open the input circuit is now incomplete and bit 14 of word input : one input word one in the PLC's memory is now off and the instructions that address it must change from true to false and false to true so you see when we push that button the only thing that's changed in the logic is the two instructions both address scene input : zero 1/14 the one that was true went false and the one that was false went true so look at the state right now the of the two instructions addressing bit 14 which one's true which one's false that's right the top ones true because it is true if the bit that it is addressing in memory is off why is that bit 14 off it's off because you opened up the field wiring whether you did that by letting go of a normally open button or pressing arm a close button that only manners when you're actually writing your code to decide which of the two instructions you want to use but get this straight in your head when you press a normally closed push-button the bit memory goes off and the true if off instruction becomes true because when you push the button a normally closed button you're basically when you push it you're breaking the circuit and it's now off so the true if off instruction is true you want to look at it that way let's try another push button what would you expect this to do when you press this button now remember we let go of the normally closed push-button it's now conducting again a bit 14s back on correct so the input device connected a bit 14 is closed completing the circuit that turns bit 14 that turns on bit 14 and the instructions Trufant at roof off reflect the state of bit 14 and memory which reflects the state of the input device correct the input device connected to bit 15 is open in the circuit that turns bit 15 on and off is keeping bit 15 off and the instruction addressing bit 15 reflects this state correct if you look at the two instructions that address bit 15 true if on is false right now that's on top and then right below it true if off is true because that 15 is off so if we push the button the push buttons contacts close completing the circuit allowing free electrons to pass through the LED in the opto isolator casting light on the photo transistor which conducts turning on bit 15 in the PLC's memory and the instructions that address bit 15 of word input 1 reflect the state of bit 15 which reflects the state of the normally open push-button now being depressed not depressed to press you see the only thing that's changing state is bit 15 so the instructions that query bit 15 are changing state normally open not pressed true if off instruction is true the true 5 it looks like a normally closed real a contact addressed by input : 0 1 / 15 you're not pushing the button and it's you push the button it goes false and the other one goes true okay if you look up above you see both bets and memory are on bit 14 a bit 15 or both on one button is being pushing the other is not make sure that you continually reflect on this when you're writing your code and you're analyzing logic just because the bit in memory is on doesn't mean that someone pushed the button because it might be normally closed that's why typically we use nothing but normally open contacts in our input devices because that's what people expect they expect if there's nothing there nothing being since the buttons not pushed they expect it to be off and the bit memory to be off so we can use normally closed push-button because number closed push buttons failsafe for instance I say that normally closed push-button was a circuit stop or a motor stop and if the wire became broken or the switch became defect defective in the circuit opened then that declares that the button has been pushed even though it really hasn't so if it's a button that when you push it request a safe State then you want to use a normally closed push-button because if it opens wire breaks forklift backs into the machine breaks the conductor operator gets man bangs on the switch and breaks it it fails but it fails to the safe condition so that is typically the conventional use of normally closed contacts is if you want to failsafe condition well we've really enhanced our graphic now we've expanded it not only to include a rung of relay ladder logic not a release circuit this is not a normally closed contact normally open contact but this is a true if off instruction true fond and an energized output and we still have our two inputs there push buttons however this one is now a normally open so both of these push buttons are normally open we also have an output as solenoid so this could be a solenoid that operates a cylinder notice also we've expanded our memory from one 16-bit word to more than a half a dozen and because I looks like one an output Oh looks like zero we're putting our output image on the bottom and then our input image next up to that so here's our output image we have four words of output image and three words of input image so now we have more bits and memory to work with let me ask you a question if word I one that means word one of the input image and bit 14 if it represented a de-energize relay coil instead of a bit memory with this contact be open or closed I call it a contact because we're relating it to a coil of a relay not a bit memory so if this normally closed contact were associated with a D energize relay coil with this contact be open or closed if the relay is de-energized and that's normally closed then it would be closed why would it be closed this contact is normally closed in the normal state of a relay coil is de-energized so once again now we're kind of jumping back and forth between the relay symbols and the ladder logic symbols relating coils of relays to bits in memory if word input word one bit 15 represented aid energized relay coil with this contract be open or closed to energized that's right it would be open why would it be open this contact is normally open and the normal state of a relay coil is de-energized with neither push button pressed are any of the inputs on no with none of the inputs and memory on you look at your field wiring for your inputs neither switch is pressed so you have no complete circuits no current current flowing through those LEDs to light up the basis of the photo transistors so neither one of those bits in memory for bit 14 or bit 15 or on with none of the inputs on in memory are any of instructions in this rung of logic true think very carefully remember both bits are off look at the instructions up there are any of them true yes input word one bit 14 is true because that's a true if off bit 14 is off therefore it's true so you have something that looks like a normally closed relay contact that's true when the push button is open this is where you can get confused when you try to match up the symbols with the field wearing that instruction that is highlighted right now is true because it is reading bit 14 of word one and the input image and it is true if off and bit 14 is off because the button is not pushed if we pressed this push button what is the effect in memory so we're going to push the button connect it to bit 14 in input word 1 what will be the effect in memory that's right it will turn on bit 14 with this input in memory on are any of the instructions in this rung of logic true remember we have true of off true fine so we're talking about bit 15 is off bit 14 is on are there any of the three instructions and I'm talking about these right here true of off profile Trufant only one of them addresses bit fourteen is this true if this bit is on no that's a true of off instruction why because it's the truth off instruction would you say or state this rung of logic how would you say or state this rung of logic in other words if you want to put this into a sentence how would you say it well let's try it the long way and then maybe we'll try it a couple shorter ways if off and if on or if on then let that is the terminology that's normally used in programming language if it's off or if it's on then let such-and-such is there any connection between any of the instructions in this run of logic and any of the input circuits or output circuits absolutely none that's because the logic is totally independent of the functionality of controlling the input bits and transferring the output bits to the output devices what's going on in ladder logic is solely within the memory it has nothing to do the field devices now the field devices especially inputs affect the state of memory bits but the latter logic itself only operates the state of memory the logic independently reads and writes to memory you create the hardware image and then you write the logic based upon your knowledge of these assignments the connection exists solely in the mind of the observer the input and output devices cannot see the logic nor the logic see the input or output devices so if I was going to state this run logic I would say if bit 14 is off and bit 15 is on then turn on bit 0 over 2 or if bit 14 is off and bit 0 over 2 is on then turn on but 0 word - now you're probably wondering how could it be on if no one turned it on that's a good question we'll get to that so if bit 14 is off and bit 15 is on or if but 0 is on then let bit 0 beyond now this only works if bit 0 in the output where 2 is already on so basically if bit 14 is off look a bit 14 and 15 there in blue the bit 14 is off and bit 15 is on then that rung of logic is true it then with the output instruction the OTE output energize sets bit 0 of word to the output image 2 on the next time you come through and read this rung of logic now the true final instruction right below bit 15 instruction it's now true so if you were to lose bit 15 others if it were to go off bit 0 of were to still on so you still have a true path over to the output instruction that turns on bit 0 of word - is there any connection between instructions and this runner logic and the input and output devices absolutely none why because the instructions read the bits in memory they don't read the input devices by the way notice that this true this instruction right here is actually reading this bit over here so your instructions your conditions or permissive z' are not limited just to input words they can read output words as well or any of the input or output devices on right now none are any bits in memory on nope are any of the instructions in this run of logic true remember both the input devices are off now think carefully before you answer are any of the instructions in this rung of logic true of course bit 14 is off therefore that true of off instruction is true that 14 is off therefore true of off is true what happens if we push the push button connected to bit 14 that would be the bottom one over here the normally open push button what happens if we push the push button connected to bit 14 it turns on bit 14 and now the instruction that was true is now false so someone's pushing the button and the bit is on but the instruction is false are any of the input or output devices on yes the input device connected a bit 14 is on are any of the bits in memory on this is not a trick question you can see the answer right there on the screen of course but for Tina's on are any of the instructions in this rung of logic true that's with bit 15 off bit 14 on and output word too but zero is off no one ever turned it on or any of the bits of memory on of course bit 14 why because the push button that's connected to the opto isolator that controls bit 14 is pushed right now it's on that's why it's highlighted okay both push buttons are released the true if off instruction is true what happens if we push the push button connected to bit 15 that bit is in memory is switched to the on state so if we press that button then that bit and memory goes on does this instruction become true immediately when the bit goes on no it doesn't why doesn't it not until the program scan reaches this rung of logic for the first time after the bit memory is switched on now everything happens so fast it seems instantaneous but there's really a sequence of events over a period of milliseconds thousands of a second and in programmable logic controllers a thousands a thousands of a second is a long time so when the push button was pushed the bit went on but the bit memory is not on for a few maybe milliseconds the bit goes on in memory but the program scan until it reaches that rung illogic reads that instruction which reads that bit memory that instruction is not true once it becomes true what happens after this instruction is true the processor reads memory location output word two-bit zero to determine if this instruction is true or false the entire rung of logic is analyzed then the OTE is executed with this true execution so the rung is true already but it always reads from left to right top to bottom and then executes the output instruction so the OTE is not going to be executed until the whole rung of logic is executed when that happens that this true state of this rung because those two instructions for bit 14 and 15 are true then output word 2 bit 0 it's not true it is turned on by that output instruction that ot instruction now does the output solenoid energize immediately no output word 2 bit 0 is turned on immediately but it's not transferred out to the solenoid valve until the program is done scanning and the output image is executed does this instruction become true immediately now remember this instruction was false on the last scan because output were - but 0 was not on yet now let's on so the next scan around it comes down and by the way you're still holding that button down because this one happens in a couple of milliseconds I don't care how quick you are if your flash or lightning Johnny you can't push that button release it in less than a couple thousandths of a second which means if you push that button with your finger it's going to stay pushed for at least five to ten program scans on the first scan bit 15 was on so that instruction was true so it turned on that bit in the output image output image or 2 bit 0 the next scan through it reads bit 14 it's off so that's true it reads bit 15 that's on so that's true it reads bit 0 of word - that's now on so it's going to declare it as true then it turns on bit zero of word to the end of the output image but you say wait a minute it's already on that doesn't matter the PLC's not that smart it doesn't know the bits Rd on it just turns it on every single program skin so every single program scan that this run is true it turns on that bit in memory that was already on so it's redundant but remember this instruction the OTE output energized that's setting a resetting bit zero of word to the output image it has a true execution and an offic secure every program scan that the rung is true is telling that bit in memory but zero were to you're on you're on you're on stand up stand up you're on you're on stand up stand up now the rut when the run goes false then every single program scan it's going to say a but zero word to the output image you're off you're off sit down sit down sit down you're off you're officer down sit down you see what I'm saying has a true to false execution so when the rung is true it executes the same function every single scan that the program is true when it's false the run is false it has the same false execution and it executes sit every single program scan why is the instruction the dressing input word one bit 15 still true while you're still holding your finger on the button that bit in memory 15 is still in the on state that's why it's still true you haven't let go the button yet what happens if we release the push button connected to input word one bit 15 that 15 goes off that instruction goes false but look the next program scan it sees the bit 14 is off so it's true but it reads word two of the output image but zero before it executes the OTE it reads it it sees that it's on so it turns it on this is called a ceiling or self-sustaining logic sealed in logic very important thing to understand about relay ladder logic is this functionality now this works the same with relay contacts so that instruction that looks like a normally open contact which addresses that zero of work to the output image that would be a contact that was part of that relay coil over there which is an OT instruction you see they're addressing the same bit right there for that contact would be part of that coil so if that coil is energized it's holding that contact close by passing the push button hook two bit 15 why is a bit zero of word to the output M is still in the on state we just answered that none of the inputs are on right look over there bit 14 and 15 is off but the true of off instruction that addresses a bit 14 it's still true because 14 is off 15 is off so the instruction that addresses but 15 is false but we have the instruction addressing bit 0 for 2 it's still on so it's still true so it holds itself on if bit 14 is off so that the first instruction is true the logic reads that 15 and it is off so the second instruction is false the logic reads bit 0 over 2 in a design so that instruction is true the rung is true and it executes the true execution of the OTE turning on output word 2 bit 0 the fact that it is already on is irrelevant the logic energizes at every scan that the rung is true the same is true when the rung is false no buttons are being pushed right now and that zero of output image were too is on and every single program scan as long as this rung is true the true execution of that instruction that ot instruction will set that bit to one it will turn it on now the fact that it's already on is irrelevant the rung only knows whether it's true or false if it's true it turns the bit on if it's false it turns the bit off if it's already off then it and it tells it to turn off the result is still the same so how do we turn this how do we make this run go false well what happens if we push the push button attached to bit 14 which is a normally open now if you look at your logic right now the first instruction true if off bit 14 well 14 is off so it's true so if we press the button 14 goes on that run goes false and it turns off but 0 of the output image were to the next scan that's instruction is also false and when we let go that button then the instruction the true of off instruction will go back true again but neither bit 15 is on nor bit 0 so the rung still stays false until you push the top push button that turns on bit 15 again ok how would you do this with a normally closed push-button remember we like normally closed push-button z' we like normally closed contacts in any situation where we want to failsafe or fail off state meaning the field device fails either the wire opens or the device breaks so with a normally closed push-button for a stop button you have continuity all the time but 14 is on as you can see no buttons pushed if the button were to break then that input would go off and so we 14 so it befell see so we also have to change the instruction that reads the bit from a true five to true fine now remember whenever you want a rung of logic that has one event that makes the rung go true and stay true and another event that makes the wrong go false and stay falls you need the right combination of filled devices and logic so are in our previous example I'll just back up to that you see we have a true 5 instruction reading bit 14 and we have a normally open button and that work for us moving forward now we have a normally closed push-button so we need a true of on instruction in other words no buttons being pressed right now so the first instruction is true when we press the start button then that input turns on bit 15 so the second instruction is true it turns on output word 2 bit 0 which turns on the solenoid next scan through it reads that remember this is a read instruction now the previous scan we wrote 2 bit 0 this one we're reading from bit 0 so we see that that is on and when we let go of the push button that started this whole thing we have a rung is being held on now how would we shut this rung down how do we make this rung go false well we would press the normally closed button that 14 goes off that struction goes false turns off bit 0 turns off the solenoid this concludes this presentation thank you for watching I hope you both had a good learning experience and that you enjoyed yourself again thank you once again thank you for watching the PLC professors training videos this particular lecture can be used as a standalone lecture I try to make it as generic as possible the examples that I use were on occasion specific to the allen-bradley micro logics family also on the plc professor YouTube channel you can find a lengthy video on how to use free software to create a simulator you can go to wwl see professor calm and purchase the electronic PDFs for the training manuals the lab project manuals that go along with the majority of the videos or I should say the majority of the videos on this channel are discussions and lectures relating to the lab projects in those three manuals available on the PLC professor comm website you can also order the printed forms of the manuals they're considerably more expensive than electronic because color frame is very expensive I am going to edit the three manuals back into one manual and see what it costs to print it as one manual again thank you for watching if you do purchase the electronic PDFs we appreciate that you do not share these with other people we priced the electronic versions inexpensive enough that everyone can afford to buy their own and the revenue from these manuals is the only revenue that supports creating more of these videos for the PLC professor YouTube channel once again thank you
Info
Channel: plcprofessor
Views: 638,191
Rating: 4.8760386 out of 5
Keywords: PLC Programming, PLC Training, PLC Tutorial, Programmable Logic Controller, Allen Bradley, PLC Instructions, RSLogix 500
Id: -8DVa3SBu38
Channel Id: undefined
Length: 94min 34sec (5674 seconds)
Published: Mon Nov 05 2012
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.