×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

PLC State Machine Coding
2

PLC State Machine Coding

PLC State Machine Coding

(OP)
Mucking about in this forum, I've been reading the threads pertaining to state machines trapped and forced to live out their existence on Ladder Logic platforms.

Why? Because I'm working on a big(for me) PLC job that I've come to realize should be done as a SM.

Here is a statement I think makes a lot of sense.

Quote:

I believe that every step in a process should have a state. That way you can have a simple single point for outputs: A solenoid is on in states 3 to 5 and state 7. The solenoid operation is clearly defined in a single rung and there are no surprises when you go back to modify the solenoid operation.

How is this implemented? Is it just a single output rung with a slew of parallel 'state number' contacts?

Where do You put this output statement? In an "outputs area" or perhaps after the last state that would apply?

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

Keith,

I do a lot of state coding for a client. The proper way is to group your outputs in a area as you suggest. The rung (if ladder) is as you suggest with multiple or'd Normally Open contacts of the state machine continuous states. Keeping mind the type of equipment the output operates. If its a single sided spring return solenoid then the state will have to hold the output on by a self latch that is broken by a Normally Closed of another state further along in the sequence. A proper state machine will use a comparator for every state driving a OTE for each state as well as a pulse bit. If possible jump state numbers to allow for spare insertion for later modifications. Hope this helps.

RE: PLC State Machine Coding

(OP)
AStrongEngineer;

Hey! Welcome to Eng-Tips. And thanks for signing up to provide an answer to me. Most appreciated.

OK, group the outputs.

Yes this small PLC is strictly a LL machine. This job looks like about 200 machine states. I'm hoping it will all fit.

This project is virtually all pneumatic. There are twenty air lines leaving the enclosure, two VFDs, and a clutch drive. The inputs are a couple of prox detector signals and a slew of rod/piston location switches.

The valves are two types. ON-OFF-ON and ON-ON. (Parker digital manifolded types) I'm told all the ON-ON ones are latching. I'm not sure that actually means they will latch on only a rung or two of ON time.

Quote:

A proper state machine will use a comparator for every state driving a OTE for each state as well as a pulse bit.

"OTE" ?

Quote:

If possible jump state numbers to allow for spare insertion for later modifications. Hope this helps.

Ha! I was just thinking about that. Realizing I will likely need to add states I can see myself having to run down thru a 100 states manually incrementing all the state numbers by one. - About a dozen times. (make that 2 dozen!)

Thanks.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

I know that Rockwell has state machine add on logic that you can program in this format.

Also, there are forums and website that cover state machine logic in more detail.

I did do state machine coding but the oem standard was maybe 15 states not over 100.

RE: PLC State Machine Coding

If you google PackML state machine forums, this is probably what your looking for on state machine logic specification or format.

RE: PLC State Machine Coding

Automation Direct PLCs can be coded in state logic, they have a special rung function for grouping. You could probably download their PLC/programming manual at no cost and take a peek at the method behind their madness. Worked well on the couple of times I attempted such a task.

TygerDawg
Blue Technik LLC
Virtuoso Robotics Engineering
www.bluetechnik.com

RE: PLC State Machine Coding

(OP)
controlsdude; I'm checking out the PackML standard. Thanks for the heads-up. I already have the entire control panel built so I can't change to a PLC type that has a native state machine system. In this case I'm using a CLICK PLC. It has a "drum" function I haven't figured out yet. Since it's supposed to provide a timer steps like functionality, at first look, I'd say it's likely to be "time" based rather than "state completed move on" based. Understanding this is today's mission.

tygerdawg; Unless you're referring to the "drum" function are you thinking their DL05/06 series? It's about twice the price and BIGGER.

I'm annoyed by ADirect's lack of documentation. I expected to see a coding manual with at least some simple examples. Instead they appear to funnel you into, 'take this over priced course'. Of the ones I've sampled they seem to completely miss providing the desired knowledge being a bunch of noise instead.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

I'm not talking about 'drum' function.

I don't have an argument against your 'size of PLC' complaint.

My experience in buying AD's re-branded Koyo products ("DirectLogic" series), both hardware & software: they are fabulously well documented. After a quick glance at the website, it appears that all of the hardware manuals are freely downloadable.

I believe the explanation of the AD method of state programming is in the documentation for the DirectSoft programming software. You must purchase that, it seems they don't allow free downloads of that manual. I thought they did at one time, but could be mistaken. I vaguely recall that the last time I purchased it, it was cheap ($350 or so??). It is simply a few special function rungs that allows one to group a series of rungs, make series of groups, and advance through the groups in desired sequence. When a particular group is enabled, all other groups are disabled. This could be done manually.

TygerDawg
Blue Technik LLC
Virtuoso Robotics Engineering
www.bluetechnik.com

RE: PLC State Machine Coding

(OP)
I have the DirectSoft sw. Yes it's about $350. It doesn't cross to the CLICK series. Darn.

As for the manuals, Yes, they're generally pretty good as is the CLICK one. Nothing missing except a chapter explaining the actual commands. Most commands like NO or NC inputs are of course simple but since this PLC is considered their get-your-feet-wet unit you'd think they would bother here. Oh well.

BTW the Drum instruction actually will do Time Steps or State Steps. Still looks a wee bit too constrained to be useful to me. Only one input allowed per state. You can have up to 16 outputs per state.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

"Only one input allowed per state"

Why dont you combine all the inputs necesssary into one input for it to go on to next step? Its probably not constrained to a physical input but just one bool, which can be any combined state of logic.

RE: PLC State Machine Coding

itsmoked - the Click Koyo has a great set of help files that were very useful to me when I just learned ladder logic on a project. the drum function is explained in there as well and they do offer some coded projects as samples. It turned out to work really well for me but I think an AB PLC might have been a bit simpler to use because I had seen it before and had some sort of an idea.

I did not end up using the drum function but I did play with it for a while and got an idea of how it worked.

RE: PLC State Machine Coding

(OP)
Yeah there are some examples in the help file. I found them.

I've decided not to use the drum function either. I've gone with the latch/unlatch state machine and it's working fine. Now I wish you could cut-and-paste multiple lines of code since there is a huge amount of repetition but, that's probably just being greedy. :)

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

If I remember correctly you can? It will only let you take a full rung I guess you call it or lots of them in a group without skipping but then you can delete middle parts after you paste? It has been a few weeks but I remember doing a lot of holding the shift and arrows to get big chunks I wanted then ctrl c, ctrl v and changing all of the tags

RE: PLC State Machine Coding

and also on the automation direct web site they have already coded examples to give you an idea of how some events are handled.

Automation Direct Code Examples List

RE: PLC State Machine Coding

(OP)
Hi AgeXVII. I sure can't see a way to grab more than one line. Tiz a shame. They screwed up a lot of things by using the CTRL and ALT keys to instantly cause the LINE editor to pop into action uselessly. Nor the shift key that would normally select everything between. This leaves no way to select more than one line in the conventional Windoz manner.

To top that off, nothing in the normal LINE editor works when I've woken it from its crypt with the CNTRL key. I can't subsequently 'pick' any lines and have them 'substantiate' like they should. ODD.

And another thing. :)

I can't believe that when you select "..." before entering a contact address or coil address and it pedantically launches the Address Picker, you can't Nickname the chosen contact/coil even though the space is staring at you. You have to select the contact double-clicking it. Once the Address Picker closes you have to go over and open it again, wait for to eventually re-open with the exact same view and then you have to muck about to find the same contact again T H E N you can nickname it. Is there a better way I'm missing?

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

(OP)
Oh oh oH!! Thanks for the "code examples" link.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

(OP)
In writing this project I find it easiest to follow each state immediately with the outputs driven by that state. Obviously that results in the same outputs occurring in multiple places. That, of course, would be a disaster so after I'm done with an entire state machine I cut and past all the output lines immediately after the state machine. Then it's easy to condense them all down with lots of OR'd states into a single output statement for each output encountered.

My question is this: If I do as described above but then have several different state machines, is it reasonable to leave the output statements after each state machine or should I move all outputs to the end of the entire program?

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

itsmoked, you can have a section at the bottom of the ladder where you specify which output bits get set and cleared for each state. Then all the I/O is in one place and easy to configure. I have seen two ways of doing this. One is to have a rung for each I/O with the logic that specifies which state turns on each bit.
Another way is to have one rung for each state and turn on or off the I/O for that state. Some people don't like this because the outputs can be turned on or off in multiple states but at least it is easy to see in both cases.
If there is a lot of I/O this second method can save a lot of ladder rungs because there are usually fewer states than I/O.

Some people like state bits and others like state numbers. With state bits one doesn't get hung up on the oreder they are allocated.

One thing that is important is to avoid race conditions where two or more states can be executed in one scan. To avoid this I keep two sets of state bits. One is the next_state bits and the other is the current state bits. At the top of the rung I copy the next state bits into the current state bits by words or dwords. In the state machine I only change the next state bits. This way no changes in the next state will activate a new state in the current scan. One needs to do the same thing if working with state numbers.

Each state may have more than one rung. The first rung is a one shot where code that needs to be executed once on entry to the state are execute. The second rung is ladder that gets executed all the time. The second rung should probably be divided in to more rungs. For instance there can be a transition rung that determines when to change the next state and perhaps start a time out timer in case an I/O doesn't come one. There can also be a clean up rung for on exit.

Don't try to put too much into a state. I once helped a PLC programmer that was programming a lifting device. He had one rung for up and one for down. He struggled with this for a week or so. I asked him to explain what he was doing and we broke the problem down into many states with 11 rungs or so. The PLC programmer did not like having 11 rungs but he got it to go in 4 hours after that. It was a simple program that should have been done in four hours. The two rung solution suffered from race conditions.

Look at Moore and Mealy state diagrams.

The main thing is to avoid the race conditions and be consistent on how you do your state machine.

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

You may find that this is very relevant
Programming Equipment States Efficiently
State based control is a method of defining the required states of some equipment and then driving the equipment to one of these states, typically where a Phase step sets the Equipment States. ControlDraw has long supported this method as it provides a very efficient method of representing functional ....
See the link for details

Francis
www.controldraw.co.uk
www.s88control.blogspot.com

RE: PLC State Machine Coding

(OP)
Thanks for the nice tips PNachtwey.

I'm using the following form:

CODE

.....ON_STATE_1 SOME_CONDITION TRANFER_TO_STATE_2 ---------| |-----------------| |------------------------( )-------------- ON_STATE_1 TRANFER_TO_STATE_2 ON_STATE_2 ---------| |-----------------| |-----------------------(SET)------------- | | ON_STATE_1 ---------(RST)------------- ON_STATE_1 POSSIBLY_DO_SOMETHING ---------| |-------------------------------------------(SET)------------- ON_STATE_2 SOME_OTHER_CONDITION TRANFER_TO_STATE_3 ---------| |-----------------| |------------------------( )-------------- ON_STATE_2 TRANFER_TO_STATE_3 ON_STATE_3 ---------| |-----------------| |-----------------------(SET)------------- | | ON_STATE_2 ---------(RST)------------- ON_STATE_2 POSSIBLY_DO_SOMETHING_ELSE ---------| |-------------------------------------------(SET)-------------

This is working really well. My biggest fear is having to make a change to state_2 when
I have twenty states.. :)

It's really nice to have the ouput directly after the state. But of course this causes the
"multiple same outputs" hassle because inevitably multiple states control the same outputs.
So, I moved them all to the end of their respective state machines. That was fine until,
being done with all four state machines, I discovered that I had to do an initialization
state machine to setup the physical machine. That state machine uses outputs from all
the other statemachines combined! So now I probably have to move all the outputs down
to the very end of all the state machines.

The only problem with that is that it's hard to easily see what a particular state you're looking at effects without scrolling down two hundred lines.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

(OP)
That's interesting! Thanks FrancisL.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

Sorry itsmoked, I was away from here for a few days. But now that I went back and read over your post:

for the copy and pasting of multiple lines I was just clicking on the very first line I wanted to copy then hold shift and arrow down the old fashioned way unfortunately. The quick keys have different actions in the Click Software so you can't ctrl click or shift click and skip lines that I have found yet so I was taking big chunks then deleting what I didn't want in the middle.

as for the nicknaming of the coils etc when you double click and then click ... at the bottom go to "Edit Mode" instead of "Pickup Mode" and you can name any/all of the ones that you want. unfortunately I think when you see the blank spot you still must name it by the "x001" etc given corresponding port on the PLC unit instead of using nicknames but the nicknames show up in the ladder and you can see if you have the right one. (Unless I am misunderstanding what you are trying to name or pick there?)

The "Same multiple outputs" is only a warning and will still compile and run as long as you are not depending on one rung to turn on/off an output and another to use that same output under completely different methods. if that makes sense? I was using the Click to program a 7 thermostat/7 furnace system.

For my program I had multiple rungs with the same output or multiple outputs that were the same. for example I created a coil of "System Delay" and this was set for 1 minute after any furnace turned on, set for 3 minutes after any furnace shut off and also set if there were 3 heaters running. Each rung to turn on one of the 7 furnaces had to meet the condition of C14 being "closed" (---|\|---) before it would be able to turn on. Each furnace therefor set that delay bit for me until a timer was met and turned it off.

It was probably made way more complicated than it needed to be but it was the way that I saw to make it work for my application and it works. Commenting the code will get rid of the confusion.

Also you might look into using the C bits (Control Relays) as place holders. It made my application easier to accomplish. If you need certain conditions met to set an output put the smaller conditions to set like C1, C2 etc then for that output you need to set make the rung conditions
C1 C2 Set Y001
--| |----------| |---------------
maybe? That might make it easier than having to change the states for later on but it will probably add more rungs to your ladder for the smaller conditions.

RE: PLC State Machine Coding

It smoked, I don't see a rung for the on-entry condition. You really should have that. Also, when SOME_CONDITION gets set in the first rung states one and two will be active, not good unless you are trying to run parallel states and if so you should document it. I can see you have the TRANSFER bits similar to my NEXT_STATE bits but you haven't avoided the race condition. You can still go directly from state 1 to state 2 in the same scan and if SOME_OTHER_CONDITION is set state 3 will be executed too!!!

I wouldn't be too concerned about have multiple instances of the same output when you are using a state machine AND YOU DON'T HAVE RACE CONDITIONS!!! Using the same output more than once is poor if you aren't disciplined and not using a state machine. The problem with using an output more than once is that state one could turn an output on, and in your example, state two could turn the same output off in the same scan. You are depending on SOME_CONDITION and SOME_OTHER _CONDITION to be mutually exclusive. If using a state machine where only one state gets executed per scan you really shouldn't have to worry about using the same output in multiple states. You don't need to worry about another state executing that will change the outputs in that scan.

Even if you put all the outputs at the end of the ladder all coils that should be set in state one would never be set because your state machine went from state 1 to state 2 in one scan. Obviously putting all the outputs at the end makes no difference real difference. It is avoiding the race conditions that make a difference.

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

(OP)

Quote (AgeXVII)

For the copy and pasting of multiple lines I was just clicking on the very first line I wanted to copy then hold shift and arrow down the old fashioned way unfortunately. The quick keys have different actions in the Click Software so you can't ctrl click or shift click and skip lines that I have found yet so I was taking big chunks then deleting what I didn't want in the middle.

As for the nicknaming of the coils etc when you double click and then click ... at the bottom go to "Edit Mode" instead of "Pickup Mode"

YES!!! Thank you, thank you!
Huge speed improvement. Wish I'd know about these 300 rungs ago. I had to copy every third rung then go back and do every other rung, etc., etc., ad nauseum. LOL

And now I won't have to go around in circles with naming new elements by using the "Edit Mode".

Both actions are so lame.. At least these work around it somewhat.

Ha! My next job is a four stage thermostat with an HMI screen. I liked your multi-furnace example.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

(OP)






Peter thanks for the details, I've read them about 10 times.

Quote (Peter)

when SOME_CONDITION gets set in the first rung states one and two will be active


CODE

..ON_STATE_1 TRANFER_TO_STATE_2 ON_STATE_2 ----| |-------------| |-------------(SET)----- | | ON_STATE_1 ----(RST)-----

I thought this was the case only during this one single rung and not true by the end of this same exact rung? Am I misinformed?

============================================

This is a machine swimming with pneumatic cylinders, SOME_OTHER_CONDITION cannot happen until a cylinder has actually moved a distance taking >50 x scan_times,(scan_time=~5ms). In these cases "_CONDITIONs" are rod position sensors. So, for the machine to have been in SOME_CONDITION, SOME_OTHER_CONDITION had to have been un-activated. (I now realize this isn't obvious from my code example above.)

Do you think I still need to include anti-race code for this type of machine? I can definitely see the need in a more complex machine where, say, there are parallel functions going on and SOME_OTHER_CONDITION could be pre-setup while STATE_1 is still active.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

Quote:


Do you think I still need to include anti-race code for this type of machine?
With out actually being there it is hard to know for sure if you can get away with how you are doing it but I do know that just because you can get away with it now doesn't mean it is right or will be right in the future.

I really don't do PLC programming, I make motion controllers. I have had to learn PLC programming because I/we would get too many tech support calls from people the claimed out motion controllers didn't work or go to where they think the actuators should move to. The main reason is race conditions. A prime example is that a move command is issued on a rung and then the in position bit is checked to see if the move is done on the next rung in the same state. If the in position bit state machine goes to the next state and the next move command is executed. The problem is that the motion controller doesn't get the command until the end of the scan so the in position bit is not cleared till the next scan but the programmer checked for the in position in the next rung and the bit is still set. The state machine thinks the actuator is in the new position when in fact it hasn't moved yet and the motion controller hasn't even got the move command. The cure is to break the move and wait till in position into two different states so only one thing can be done at a time. Just write your code to avoid race conditions so you NEVER have to worry about them now or in the future.

If you want extra credit add some code that can determine what state to restart your machine in. My back ground is in saw mill automation. Early on a senior programmer told me that anybody can write code to make a machine run when every thing is working properly. The boards or pieces per minute were pretty much determined by the machinery. However, when things didn't work right the PLC can make a BIG difference in the recovery time and how much production is lost. I am sure there are people on this forum that can tell you about how when their system has a fault they must run off all the widgets in various stages of production. A good PLC program may be able to restart so the production can start where it left off and no production is wasted.


Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

(OP)
Thanks again Peter. I understand now.

Initialization: I waited until I had the various state machines fleshed out then turned to initialization. YiKes! That's way harder to figure out and get right. A lot of cases you don't want to think about - but have to.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

The typical way to make a state machine is not a latch or unlatch but with a mov statement .

example

state 1 intial
move 1 step
state 2 start
mov 2 step

Use a equal statement with other logic to qualify the next step, this way you can see that the machine cycles thru each step or skips certain steps, based on different inputs.

etc for each step

Best way to check out a cycling machine when you have it together is force all the outputs to a safe state.
example
Then when you go to run mode make sure all the logic for state 1 intialize goes true, then qualifies the next step, and then qualifys that next step, etc .. till your machine goes back to step whatever where u want to cycle repeatly. All the time when you are at each step let the outputs go to their on state during the step, then after its done force it back to the safe state. This way you can see if their is a race condition on other steps or just bad logic somewhere that would let an output you do not want fired to stay off.


Used this type of sequencer on many machines and seemed to work with good success.

RE: PLC State Machine Coding

(OP)
Thanks CD.

I understand what you're describing. I actually started that way. This PLC doesn't appear to have MOV commands. This meant everything had to be done thru the MATH statement which is rather laborious to manipulate. I was also unclear about the speed of doing math functions. Hence, I went to the SET/RESET method.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

So can you use a word and use a bit in each part of the work for each set and reset?

state_word = 1 ==> step 1
state_word = 2 ==> step 2
state_word = 4 ==> step 3
etc...

use a bit shift left or right,( maybe they have this function? ) to change the step

I know ab and siemens had an execution time spreadsheet for each function. Does this processor have such a table with all its function versus execution time? I would think they would if its sold commercially.

RE: PLC State Machine Coding

What, no MOV?! What kind of PLC are you using?
Interpreted math functions will be slow.

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

(OP)
I see where you're going CD.
That would probably be workable but painful on this PLC.


PNachtwey; This one: :)
http://www.automationdirect.com/static/specs/c0pgmsw.pdf

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

The Click PLC is pretty limited... Good beginners one but difficult for lengthy or complex programs. Took me a while just to think how to execute mine with the limited functions

RE: PLC State Machine Coding

(OP)
Indeed.

But if you CAN pull it off, oh so cost effective and physically convenient.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

Oh I know, I have had 2 put on my desk and they said hey we need this to be updated with working code to do... or hey start from nothing and here's what we want sort of... the rest of the details will come later. It was fun and worked out (so far, crosses fingers). I would not like a call at 2am to go fix either but the coding was sound on my end. One was to run a gas station/pump station for different fuel types/which can be on and running at the same time and the other was those furnace units I kept trying to example for your application.

Very cost effective compared to the AB's and still ways to figure out what you need it to do with the limited commands.

Sorry I was AWOL there for a bit on helping you out, I had a bunch of stuff land on my desk that is due today/tomorrow and not a lot of time to get it all sorted out but hope you figured out what you needed!

RE: PLC State Machine Coding

itsmoked, you have got to be kidding. Automation direct has an excellent way of making state machines using their stage programming if you spend a few extra dollars.

If you like Automation Direct get AD PLC of suitable size and use their stage programming. If you don't you will waste far more money in time than you save in the difference in cost between what you have and what you should have.

I have a DL250 that I use for compatibility testing. It is a very good PLC with a high 'bang for the buck'.

Your time has value, so does ours.

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

(OP)
Good point.

In my defense I'm fairly noob on PLCs so working my way up has some benefit. Next time around I know what to look for.

Keith Cress
kcress - http://www.flaminsystems.com

RE: PLC State Machine Coding

Automation Direct has a pretty good forum.
http://forum.automationdirect.com/
You should read through posts and ask questions BEFORE choosing PLCs.
There is a much better and more general PLC from at
http://www.plctalk.net/qanda/forumdisplay.php?f=2

Did you look up stage programming just so that you know in the future?
http://www.automationdirect.com/static/manuals/d4user/ch7.pdf
http://www.plcdev.com/stage_programming_tutorial_by_example

If you don't have much time invested in the project you still may be better off to get a small but better AD PLC.
What is your time worth?

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com

RE: PLC State Machine Coding

The click PLC will support state machine programming using the compare and copy instructions. Use a memory location to store the current state and compare this to a constant to determine the current state. Jump to another state by using copy to copy a new state value into the memory location holding the current state. See attached sample code

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources