Program structure help

Matchu04

Lifetime Supporting Member
Join Date
Mar 2013
Location
Northampton
Posts
287
hi guys

I have recently completed a basic S7 course and have started creating my own little programs/solutions to small problems using stl. So far I am not having issues with code but more with the best way to lay the code out.

I have read several posts about you guys use FC's and FB's to break the code into sections for different operations. Thats sweet I get that but here's my issue.

I have a process (roller shutter door) and Im writing the code for the alarm condition, which I already have a seperate FC for. Basically im setting bit Q0.2 high, when either the motor over has operatored, or the low limit and high limit switch operate at the same time, or if I dont get an input from the prox within a certain amount of time. etc etc

So with all these conditions and only calling Q0.2 once how should I lay it out. All in one network, different network for each condition or completely different way.

My tutor told me when writing stl code that you could write it anyway you wanted within certain criteria. what I'm after is how should it be done ?

Also final question, is there a time and a place to write in ladder or is it best to write stl if you can?

Cheers guys
 
Use ladder where you can. STL comes into it's own if/when you need to perform indirect addressing, case statements and the like.

Use FB's and the IEC timers/counters embedded as multi instance.
 
Last edited:

Similar Topics

Hello all, Just to give you an idea of my background, I'm new to the PLC world with a background in IT and currently pursuing my MSEE. I have...
Replies
3
Views
744
OK, (some of) you guys know by now that I'm not a PLC programmer, so I'm not really familiar with how a well-structured PLC program is typically...
Replies
2
Views
1,475
Program structure - s7-1200 MODBUS RTU Master with multiple slaves & multiple registe I'm having problem to make a appropriate structure of my...
Replies
7
Views
11,254
Hello, I am creating a PLC program for a fresh water pump station which will be based on downstream and upstream pressures. There will be several...
Replies
5
Views
2,105
I am a mechanical engineer with a mechatronics background working closely with a co-worker learning to program Siemens S7-300/400 series PLCs. My...
Replies
3
Views
4,540
Back
Top Bottom