Yaskawa
eLearning
You're watching the IEC 61131 Basics
Video Tutorial Series.
In this edition we'll use the Logic Analyzer
an important graphical monitoring tool in
MotionWorks IEC.
Hi, I'm Matt Pelletier
and I'd like to show you how to use the
Logic Analyzer
along with our Parking Gate Control example project
and the PLC Simulator.
So follow along with me
as I show you how to do the Trigger Setup,
capture some data from the project,
and use Zoom and Cursors for simple measurement.
The Logic Analyzer is a graphical monitoring tool
you can have up to 16 variables
and you'll be able to see them here
all with data sampled at the same rate
you do have to have MotionWorks IEC
open at the time and you do have
to have Debug mode ON.
You just go to View > Logic Analyzer
and I'll show you also how to undock the window
so that it's large enough
to get a good view of the data.
So I do have the PLC running
let's just do another Make and Download
and Warm Start here to be sure that it all works.
Okay, now I'll go do a Stop and Download
give this system tick warning, Yes
and Warm Start now
close this resource
and let's go to Debug mode and
look at the Logic Analyzer.
So my Logic Analyzer comes up down here
and I had mentioned that it's very small
can you imagine having 16 channels of
data displayed in this little box?
So, the way to get at it
is you right click where it says Logic Analyzer
and uncheck Allow Docking
this may make it any shape
so you can use standard techniques
to make this Logic Analyzer larger
and then some people like to move it
out of the way or even close it
because we need to do the next step.
The next step is to Add Variables
by right-clicking anywhere in the code
or within a Global Variable or Local Variable List
you just right-click and choose
Add the Logic Analyzer
so why don't we add these four:
G_NumberOfCars, DI_00, G_GateOpen and DO_00
I'll add G_NumberOfCars and G_GateOpen
from the code and I'll add the Inputs and Outputs
from the Global List.
So in the Project Tree
we had that code in the Main POU
and here's G_NumberOfCars
add to Logic Analyzer
G_GateOpen
Add to Logic Analyzer
I can pull this up here
and you'll see that those two have been added
it's also possible to add even if it's closed
the others I'll add from the Global List
you could also add them from the code
here's DI_00
Add to Logic Analyzer
and DO_00
Add to Logic Analyzer
I can view the Logic Analyzer once again
and there are my four channels
but having the variables is not enough
we need to set up what's
called the Trigger Configuration
and you right click on this tab
choose Trigger Configuration
and that will let you set up
the number of cycles, the variable
at which to trigger and the task
at which you will take the data
so do that along here with me
right-click on the Configuration Resource
Trigger Configuration
and what I like to do in fact
is look at the task that I'm in first
because that affects the number of cycles
that I would want to use.
So I chose the Fast Task
Why the Fast Task?
Well because my data
is even indicated here is in the Fast Task
where it took my two variables from the Fast Task
makes sense to synchronize with the place
that the variables are being used.
Now what about Number of Cycles?
By Number of Cycles, I have here is 100
but do you remember what is the interval
for the Fast Task?
If remember that message we saw at the
beginning it said my Fast Task
was at 20 milliseconds
so if it's 20 milliseconds and I have 100 cycles
that would be 2000 milliseconds or 2 seconds.
How about I do 200 cycles
and if my interval is 20 milliseconds
I'll have 4 seconds then
to do something here and take
data for four seconds.
Then when you start taking data
it won't actually start to count these
samples until it sees this Trigger condition
you can use any of the
variables to create a Trigger condition
and one way to do it here
I would like to choose DI_00
so now I go turn ON DI_00
that's how I know it will
start to take the graph
and you could create any type
of Boolean expression
a real easy one is to use RE rising edge
and I didn't say anything about
pre-recording cycles
but you could get also a little preview
of what happens before this event
this Trigger event
I'm just going to leave it at zero for this one
let's click OK
now to record the data
be sure in Debug mode with the
Trigger configured
and you can right click on
Configuration Resource tab
of the Logic Analyzer and you start recording
you'll also notice a recording button
up at the top you can also use that.
So it we'll hit Start Recording and
then start the graph by toggling DI_00
several times and that first rising edge
will be what starts the logic analyzer graphing.
So let's record some data
I'll do a couple checks here first
what I want to do is click on this input
several times and watch the number
of cars go up to the maximum
I think I'll do a lower number than 20,
let's do 10
Overwrite 10 here
We also need to be OpenForBusiness
that's Input number 1
and this shows the GateOpen
and now we can hit Record
by right clicking here, Start Recording
just move this out of the way
to be sure everything works
and it's really not recording anything yet until
I do Rising Edge on Input 0
10 clicks in four seconds.
All right did it get them all?
That looks like I didn't
I'll have to do it again a little bit quicker
I'll reset that
and let's record again I'll use this button
this time, start recording
one, two, three, four, five, six, seven, eight, nine, ten, ok
there I got them all
so I can see what happens as the sensor is hit
and the gate goes from open to closed
and I guess I had something illogical here
which is that if the gate is closed,
there wouldn't be more cars running over the
sensor, but you get the idea...
here it is, here's the output closing the gate
so now we need to do some analysis
and the first thing here is to Zoom
and zooming happens by doing
right-click and drag
and left-click and drag over the axes.
Let's go give it a shot.
Let's say I want to drag in
and look at this event here
so I'm doing left-click and drag
and now right-click and drag
and you can see down here the cursor kind of
changes the icon, you can indicate that here.
This is also possible left and right click
and drag happens works the same way
on their vertical axes
and so that allows you to adjust
for easier measurement
and since I mentioned measurement
There is the possibility of cursors.
The cursor you click on the very edge here
and then as you move your mouse
you'll be able to put a cursor
and a little sample measurement box pops up.
So we could look at the cursor here
you'll notice the cursor
it makes the icon change
and I can move that here
and see you when did that happen
it happened at 170 samples
and I have 10 cars at that time
the cursor does stay with the window
as opposed to the data
and that's the cursor.
You can also have an amplitude cursor
up here at the top
doesn't tell you the time but tells you
each level according to the data that you have.
You can do Capture Curves
to restore the zoom
if you want to do any measurement
at this point, at this version
you just need to put down a cursor
make a mental note here,
it is sample 17.8
so zooming in can be helpful
you want to see how many scans
how many cycles this particular input was on
here it says we're at 17.9
and this one's at 27.1
Version 3 of MotionWorks IEC
will have an improved Logic Analyzer
so if your Logic Analyzer looks different than this
rest assured that we'll be making a new video
soon that shows how to use the newer
Logic Analyzer with better and more intuitive features.
And so this is it for now,
use the Logic Analyzer anytime you need to
have a closer look in time what's
happening with different variables
sometimes this is the only way to tell
if your code is working properly or not.
you