Omron NX Safety Controller: Exchanging Information Between the Safety PLC and Control PLC

Look what customers are saying about our "How To" video series:

Valin's "How-To" video series on safety PLC's was very informative and saved me between 8 to 12 hours of reading tedious manuals. I was able to reference the videos as needed for clarification on questions. Going back though the videos I realized you had explained everything well, I just needed to see it once more. Very helpful!

John Peters, President
JJT Design
Hello this is Ray Marquiss, Senior Application Engineer with Valin Corporation, and this video is going to demonstrate how to exchange information between the safety PLC and the control PLC using exposed variables. So let's get started on that.

Before we get started, I made this graphic to help explain what it is that we do when we expose variables or when we use the variables inside the safety PLC. On the safety PLC, not necessarily connected to it, but on your safety PLC system, which means the safety PLC controller plus any safety inputs and safety output slices that you've got added to the system, you will have safety inputs of course, and safety outputs. Those are real physical safety inputs and Outputs. In order to use those in your safety PLC, you'll have to create variables for them, and then you'll use those variables in your program.

At the same time, these safety inputs and safety outputs are exposed to the IO map of the control PLC, and you'll see them in the IO table. I'll show you that in a little bit, but you also create variables for them in the control PLC so that you can use those objects in your control PLC as a way to monitor what's going on with your safety PLC.  So in other words, we could have an E-stop physically connected to the safety input. We give it a variable name called “E-stop” in the safety PLC, and then when we look at the IO map in the control PLC, there will also be an IO data object that says it's the safety input 0 for instance, or safety input one or whatever it is that you've got at whatever your E-Stop attached to. Then you would create a variable. For that object called “E stop”. So now..or you could call it “safetyPLC_e-stop”, or you could call it “dog”-whatever you want to call it doesn't matter. And then whenever the safety PLC E-stop input is activated, you'd be able to see it over the control PLC on that variable that you created for this object. Note that all of these safety input and safety outputs, even when you create variables for them in the control PLC, they're not available for writing to the safety PLC. So you can monitor them, but you can't write them, they're read only.

Now there are variables called exposed variables. You can expose inputs and you can expose outputs when you expose those, you do the same thing. You basically create a variable, but there's no physical object associated with those variables. Once you expose them, they become available in the IO table for the control PLC as an object. When you create a variable in the control PLC for that object, you can monitor and in the case of the exposed inputs, you can actually write to them. So the exposed inputs, in this case, from this I could write from the control PLC to the safety PLC and actually have the control PLC turn on this variable inside the safety PLC. So that could be used for non safety functions like selecting a mode or a reset for a safety function, anything that's not a safety..doesn't require a safety data type. And then down at the bottom there's a graphic that just shows that you use these objects and variables in your control PLC ladder program, and you'd use these objects and variables in the safety PLC program. Next, we're going to get started with the Sysmac Studio software to see how you actually do this.

OK, if you've been following along with the previous videos, then you'll have a project similar to this setup already. Might not look exactly like this, but you'll have a project in Sysmac Studio that has a control PLC and a safety PLC added with some safety inputs and safety outputs. You don't have to have this view open right now. In fact, I'll just close it for now. And what we're going to start with is we're going to go under the configuration and setup information for the safety PLC. And go underneath that and look..scroll down until we get to the exposed variables. So you might have to open a few of these, or unpack a few of these options, but we'll get to “exposed variables” and double click on that. And this is where I create these variables and expose them to the control PLC. So I'll right click in this output area, and I'll just click on “Create new”. Then I can give it a name, and this is an output, so this goes from the safety CPU to the control CPU. So let's start the name with the lower case “splc”, so we know that's where it came from or what it's for, and then we'll call this..let's see, this is an output from the safety, so we want this to tell us if the E-stop circuit is OK, so we'll say “EstopOK”. And then it's going takes a little bit of time because it does a lot more than just create this variable in one place. You'll see that in a minute, but then you can select the data type that you want it to be, and I've selected to be a BOOL. There are several data types available. Here are the ones that you can use for these exposed variables. A BOOL, a BYTE, a DINT, an INT, or a WORD. And I’m going to go down here to the input side. This is from the control PLC to the safety PLC, and I'll create a new variable. And we'll call it “cplc”, control PLC, “Reset”: simple. And it will automatically be made a BOOL.  If I wanted to change that data type, I just click in there and start typing. I could type INT or whatever, but we'll just leave the BOOL.

OK, now I'll go ahead and just keep going with the safety PLC. I've got these and I know that they're going to be controlled and monitored by the control PLC. So now I'm going to open up my program. Underneath the programming section, double click on the program here and right now I just have the…that I would normally have started here with the reset switch, which is a real physical reset switch on the safety controller. But what I'm going to do instead, I'm going to go up here. I'm going to create a new rung above this, by right-clicking this pink space and saying insert network above. I'm going to use a Boolean operator function block which is an “OR”..and or you can see some others here that you might want to play with later..but I'll grab that “OR”, drag it over to where it says “Start here..” because I'm a rule follower. And then right here I'm going to put that reset switch. So I'll say “ResetSwitch01”. That's the real physical reset. And then here I'm going to do that “cplcReset”, so that's coming from the control PLC. So now I've got an OR for either the physical switch or the control PLC switch. And then in order to turn on something I'm going to go to…it's a little tricky, but you have to click right on that little nub that comes out of the side of the function block.  You right click on it, say insert assignment, and we’ll call it reset system. Reset sys. And that's a work variable that I've already created before this, but it's just an internal variable. If you put a name in there..let's do a different name, just to show what happens. We'll just call it “resetsys01”, and then I'm going to hit enter. It's not a variable that exists already.  I'll hit enter and it just comes up and asks me do I want to make it an internal or a global.  I'll just make it an internal for now.  That global is global only to the safety PLC, not to's not global between the safety and the control PLC. And then I'll use that variable down here for the..for this “Time On” function block, so I'll call it “resetSys01”, and there it is in the list. And so now whenever either the hardwired reset switch on the safety input turns on, or the control PLC turns on its reset, it's going to turn on this “resetsys01” variable which is going to start our timer for one second. And then the output of that timer is going to go into the E-stop function block. And that's down here. “ResetDelayDone” from the output of the timer to the input of the function block.

Next I'm going to insert another function, sorry, another rung, or network below this one. And I want to use this safety output, which I could theoretically-or actually-monitor in the safety or [rather] the control PLC, but just to show an example I'm going to take this output and I'm going to use it to turn on the exposed variable that we can see in the control PLC. So I'm going to right click in that rung and say “insert assignment”. This gives me a little structure that lets me have an input that turns on an output. So my input is going to be that safety relay out. And it appears in the list, but the list is cut off because of the screen here and I would normally be able to click on it down there, but I'll just hit enter. And then what I want that to do is turn on the SPLC bit. Which is…I can't remember what it is, so we'll go back to the exposed variables. That was a mistake there.  And we'll go back to the exposed variables, and it was “splcEStopOk”, so we'll go back here and say “splcEStopOk”. And there it shows up. So now we've done the programming side of the safety CPU completely and we're going to go back to the control PLC.
Select that. And we have to go to the IO map for the control PLC and what you'll see is if I go to the IO map and expand on the NX-ECC202, that's the coupler that the safety controller’s on. You'll see there's the safety controller, the NX-SL3300. I’ll expose more of that, and you can see here's my “splcstopOK” and my “cplcReset”. But there's no variables for those. So in order to use these in my program, I have to create variables for them. They could be the same name if you want to just say name it this “splcstopOK”, that's fine, but we’ll just make it easy and call it “EstopOK”. And then we've got the “cplcReset”. We could call this “ResetSafetyCircuit”. And magically, these comments for the variable appeared, but that's only because when I started typing I had created this variable earlier and it was in the global table, and as I started typing, it selected it from the global table. So when you're creating variables in this table, you can actually create new ones here, or you can select variables that you've already created in the global variable table.

OK, so now we're going to go to the PLC programming section. Let me collapse this bit at the top that configuration info so you can see the PLC programming part better and I'll double click on that program. And then we'll see the ladder editor here. The first thing I want to do is add a rung below the current run. So I'll say insert below by right clicking in this left column and then highlighting this. Or you could do an R that'll put it below. Insert run below. And then, let's say that I have I'm going to hit C to normally to add a normally open contact. Let's say there's a bit on my HMI screen that allows me to reset the circuit. So if the operator is looking at the screen and the safety circuit needs to be resetting, could push that button? Or if they're standing near the button that's near the East off, that could push that physical button. So we got two, either one. Either way here, this one is controlled by the PLC, so the control PLC. So Hmm, I. Istop HM I reset the stop so I've already created this variable. It's in my global table. That's why it shows up here. If I hadn't created it that would be created at this time when I type it in for this instruction, so once I've got that in I'll hit enter. And then just click here on the right of that contact and I'm going to type the letter. Oh my keyboard. And that puts an output in. And I want to have this HM I bit reset the exposed variable, so in order to know what that exposed variable is, I want to go back to my IO map. And I'll pull down that. ECC 202, annex ECC. 202 to see the exl 3300. Expose more of those, and that bit is here. The Cpl see reset is called reset safety circuit. So now I'll go back to my program. And I'll make that the variable here reset safety circuit. There's that, and then I'm going to create another run. Inserted run below. I'll do see again to make contact. And let's say that. I want to use that bit that tells us that the eastop system is OK, so it's called E stop OK. And all groups. That's the wrong. Go here and say. E stop. Is OK, so that's a status bit coming back from the safety PLC. And then I'll click oh again to put an output, and this could be HM I. E stop OK so.

Now when the Eastop is OK in the safety PLC, the stop circuits OK, it's going to turn on this bit, which would then make a lamp or an object change on an HMII could use this bit here. Directly on the HMI, but I wanted to prove a point of how we just use these variables in our ladder programming. So once we get this done, we can download to the PLC and to the safety PLC and then we can test it. There's a few steps we need to go through to test this. Outline I'm here, but you're going to download the program to this control PLC then you're going to. Go over and transfer the program to the control PLC by going into debug mode and then after you're in debug mode you have to validate the project and set up. I'm going to go through those steps fairly fast so that we can see the test because in another video I'm going to spend more time on the validation process of the safety PLC. So first thing we need to do is go online. By clicking that yellow triangle up there and we've done that a bunch of times already in the past, and now I'm online with both the safety PLC and the control PLC, but since I'm looking at the program for the control PLC, when I go to download, that's the controller I'm going to download too, so I'll go controller. I'm sorry I won't do that. I'll go synchronized by clicking on the synchronize button. It's building the project. And you can see the status there and then it's going to do a comparison. So. In this case, the result of the comparison is that nothing has changed because when I was preparing for this.

Demo I actually already downloaded this project to the safety or the control PLC, but normally you'd say transfer to controller and then it would go through that process and come back and tell you that it's done. So close that. Next I'm going to go to the safety PLC. And just to make sure we know we're looking at the safety PLC, I will open up the program for it. 'cause we're going to need to see that anyway. And then I'm going to go to project menu or sorry the control menu and I want to change the mode to debug mode. You may not have seen as many options or many questions as I just did. It's because my PLC was actually running this validated running mode for the safety controller and I took it out of that. If you have never had it in that mode before, then you won't have as many questions to answer, but I'm going to put take the debug and I'm going to start it. And now were started. The program's actually running, but it's in debug mode. If I click on my reset switch you can see that we're monitoring that stuff. I just have a. Box with what you can't see. Phil, look over here. Now that that's done, but if I go back to my PC program. See, I've got this guy turned on. Sorry, I can turn this on. And I don't think we'll see it over here. We will, you won't see it in your program until you've actually gone through the whole validation process that I'm going to go through. If this is the first time you're using your safety PLC, Ann, you have never validated your project. When you go to turn on the bits over in the control PLC, you won't see them come on in the safety PLC. And tell you validated and downloaded your project, so we'll go through that process. Now will go to the project. Sorry controller and will do safety validation. And it just is saying, hey, you're about to validate this, which could stop the program and the safety PLC. Like I said, I'm going to come back to this in another video and will see the whole process in a little more detail. And then I'm going to take the controller and put it into run mode. And so now this is actually running the program as if we were deploying the machine.

So this if I powered down and powered back up in this controller, would stay and run motor would start up and run mode. So now if I go over here, see, here's our here's our Cpl see reset if I go back over here. And turn that on. Turn on this HM I bit. Turns on that bit and then if I go back over to the safety PLC program you can see that that bits on in the safety PLC program and in fact you may have been able to hear it, but it reset the safety circuit and the the safety relay turned on so you can see that there I can hit the Eastop. And we'll see that the E stop. This false now, so that safety relay output turned off might have heard it now. I've reset the East East stop, so it's true. But we're not resetting, even though this is true because it has to transition from false to true. So I've got to go back over to my control PLC. Turn this off. And then I can turn it back on them for real quiet. You might hear that relay kick in. And so now if we go back. You can see that the the E stop circuit is reset and the safety output is true. So that's how we expose variables and use them in the control PLC to exchange information with the safety TLC.

If you have any questions or are just looking for some help, we're happy to discuss your application with you.  Reach out to us at (855) 737-4716 or fill out our online form.