Programming Methods??

Longhorn

Member
Join Date
Jul 2008
Location
Scotland
Posts
250
Hi all, i am currently writing a PLC program from scratch for an existing packaging machine. There is an S5 PLC installed but soon we are going to upgrade to an S7-300 PLC. Meanwhile i thought i would have a go at the code myself.
I have split the machine down into groups of functions and jotted down flowcharts for each step so i know exactly what the machine needs to have in place at each step etc.
To do the code using nothing but N/O & N/C contacts and coils would get very messy so ive created an FC for each function of the machine and used local variables to do all the internal checking, then each FC is called from a main program cycle FC using an "Empty Box" so that it keeps everything neat and tidy for interfacing all the real I/O.
My main query is with all the steps etc, what would the normal approach be to programming this?? i have started using a SHL_W shift register which will work fine. The other option i thought of was just moving a value to an Integer after each step is complete and then using this to start the next step.

Any other ideas?? o_O
 
(*step 0 called from any state*)
IF (NOT estop_ok) THEN
step:=0;
END_IF;

(*transition from step 0 to step 1*)
IF ((step = 0) AND (RE_Start_Seq) AND (Ok_to_run)) THEN
step:=1;
END_IF;

(*transition from step 1 to step 2*)
IF ((step = 1) AND (step1_complete) THEN
step:=2;
END_IF;
 
Thanks for the quick reply ganutenator, this seems very similar to what i am achieving with the shift register. I basically initialise bit 0 of the word on the first scan of the PLC. Step 1 is then activated until e.g. a cylinder sensor is made, then i use a POS Edge to pulse the shift register on 1, then begin step 2 and so on....

I aint too familiar with STL...

Thanks again
LH
 

Similar Topics

Hey guys, I was curious as to what is your preferred method for sequential/step programming? I have seen a lot of ways used such as Hex MOVs...
Replies
24
Views
12,542
Hi all, i know everyone has their own methods of programming, but i wanted to get some ideas. we are about to get our first control logix plc...
Replies
8
Views
4,812
Hi All, A friend of mine called with a general question on ladder programming, this one happens to be AB, but could apply anywhere. I have seen...
Replies
68
Views
17,583
I would like to know what constitutes the style of programming that is used on a particular project. There are conditional and step programming...
Replies
2
Views
8,187
Hi, I am trying to set up a plc. I've never done any programming with ladder logic previously. I'm trying to set up a a program to turn a device...
Replies
6
Views
117
Back
Top Bottom