Programing PLCs in SCL

You need an application that just doesn't implement easily in ladder or statement list - anything with multi-dimensional arrays would do for a start. (I take it you are using Siemens Step 7)
 
Hi

Asking for tips about how to start programming in SCL is like asking for tips in how to start writing in English. The first thing is you must have something you want to say.
If you said "I want to write a sentence in English about a dog biting a man, but I'm not sure of the order of words or the tense." then we could help you with examples.
But to say, "give me tips in programming in SCL" without any indication of what you want to do is very difficult for us.

For example -
Code:
A := B;
is a perfectly formed assignment statement in SCL. Does it help? I don't know.
Code:
IF X > 0 THEN
WHILE X < Y DO
	 N := P*X-R;
	 T := true;
	 S := NOT S;
END_WHILE;
ELSE
N := 0.0;
T := S;
ENDIF;
What does it do? I've no idea. I just made it up.

Give us some more information and we can point you in the right direction. What about the Example project that is installed in STEP7 when you install SCL - doesn't that help?

Regards

Ken.
 
Well, i have six inputs : START, STOP, AUTO, MANUAL, INPUT_1, INPUT_2 and six outputs START_ON, STOP_ON, MANUAL_ON, OUTPUT_1 amd OUTPUT_2. I tryed to simulate START, STOP, AUTO, MANUAL and STEP swich and i wrote the program and it was like this. But it dosent work.

ORGANIZATION_BLOCK OB1

BEGIN
IF START AND NOT STOP THEN START_ON:=true;
END_IN;
IF START AND IF AUTO AND NOT MANUAL AND NOT STOP THEN AUTO_ON:=true;
END_IF;
IF START AND MANUAL AND NOT AUTO AND NOT STOP THEN MANUAL:=true;
END_IF;
IF START AND NOT MANUAL AND NOT AUTO AND NOT STOP THEN
STEP:=true;
IF STOP AND NOT START THEN
STOP_ON:=true;
AUTO_ON:=false;
MANUAL:=false;
STEP:=false;
OUTPUT_1:=false;
OUTPUT_2:=false;
END_IF;
END_ORGANIZATION_BLOCK;
 
OK, here's a tip which works in SCL and in just about every other text-based language -

TIP : Don't use an IF...THEN... structure to control a binary variable.

If the thing you're controlling has only two states, us a simple assignment instead. The problem with IF...THEN is that there is no implicit ELSE. You have to remember to code it explicitly. Look at your first line of code -
Code:
IF START AND NOT STOP THEN START_ON:=true;
END_IF;
So imagine the four logic scenarios associated with START and STOP -

Scenario 1 is when START is false and STOP is false - result is START_ON is false.
Scenario 2 is when START is true and STOP is false - result is START_ON is now true.
Scenario 3 is when START is false and STOP is true - result is that START_ON stays true.
Scenario 4 is when START is true and STOP is true - result is that START_ON stays true.

Go back to scenario 1 and START_ON still stays true.
Once your logic has encountered scenario 2 START_ON is true and will stay that way forever. I can't see anything in your code at any point which states 'START_ON := false'.

If the logical condition solves false, the THEN section is not evaluated - the processing just skips straight to the END_IF, or, if you've remembered, the ELSE statement.

What I suspect you meant to write is -

START_ON := START and not STOP;

I'm still not entirely clear about how you wanted the relationship between START, STOP and START_ON to be expressed, but I think this will correctly resolve all 4 logic scenarios.

Regards

Ken
 
Hello, can i write a SCL statement like this?

CASE STEP OF
1: OUTPUT1:= INPUT1 and not INPUT2 and not INPUT3 and not INPUT4 and not INPUT5
2: OUTPUT1:= INPUT1 and INPUT2 and INPUT3 and not INPUT4 and not INPUT5
3: OUTPUT and OUTPUT2:= INPUT1 and not INPUT2 and not INPUT3 and not INPUT4 and not INPUT5

thanks for your help
 
I didnt:) But i have a problem, too many outputs and inputs to be written like that. I have to make every possible combination with 16 outputs and 17 inputs. It is possible to use varibles and to make some sort of logical equation, to call it later in the CASE statement?
 
BoSChoW,

But now we come to the real problem, which is not SCL. Do you really have to code all 131072 states of 17 inputs?!?!?! This project will keep you employed for many years!

Ken
 
I think i found a solution but i dont know if its possible. If i help myself by useing a display, where i can type the used inputs and outputs and send the rezult to the plc. But still i have to define the inputs and outputs in case statement in the program. I guess i have to use a remanent area of the memory to contain the logic rezults of the inputs and another memory area to contain the logical rezult of the outputs and then convert them and use them in the case statement?
 
Are you saying that you want to have the same program running but use different I/O addresses which are entered via a HMI ? Of course this is possible using indirect addressing but as I don't understand your overall system, maybe you should give an outline of your system requirements.
 
My system consists of a PLC station S7-300 to be more precise CPU313C and an operating panel OP7 and a remote console.

The user will connect the inputs and the outputs at his own will and will select the used I/O in the operating panel OP7 and will "transfer" the configuration to the PLC. Therefore he can start the program in AUTOMATIC mode, STEP by STEP mode or in MANUAL mode. The remote console will serve to check if an particular mechanical complex if working promptly. Example: lets say that an cylinder is on the back of the mechanical device, and from the operating panel we can not see if its correctly working, so we take the remote console to the back side of the device and check the cylinder closely with the buttons FORWARDS and
BACKWARDS.

This system is used to check a mass production line or a smaller device if its working smuthly. In other words this is a testing device.
 

Similar Topics

Dear Friends; We have following Siemens PLCs at machines; CPU224 6ES7 214-1AD23-0XB0 CPU226 6ES7 216-2AD22-0XB0 CPU 319-3 PN/DP MODULE CENTRAL...
Replies
4
Views
1,739
i have been working with ab plcs for the last 2 years. I have been reading about FBD and stl. does any one have any examples. that they can post...
Replies
4
Views
3,215
Hello, I have Guard PLC 1600 by Rockwell Automation (it has been obsolete by them but still in the market and works fine). I need know if this...
Replies
9
Views
1,222
I got DL06 AutomationDirect PLC to program with DirectSOFT6. It is a simple machine (40 in and 20 out, all digital), few valves, a simple conveyor...
Replies
23
Views
6,887
Please suggest me programing cable for omron plc sysmac model no. Cpm2a
Replies
1
Views
1,128
Back
Top Bottom