Siemens SCL help

DLMUK

Member
Join Date
Jun 2013
Location
Southampton
Posts
311
Hi,

I am new to SCL and would like to do the following:

Read an input, divide the input by a constant and produce an output.

I want this to happen from the moment the PLC starts to cycle until the day it is switched off.

what is the best way to run a continuous loop?

Thanks
 
SCL can be a headache and finding information on it can also be problematic. A search of youtube with Siemens SCL tutorial throws up quite a few hits. It is very similar to a language called Pascal, so it can be worth looking at tutorials for that.

Here is a version of the simple program you asked about. The bits to notice are the ':=' to assign a value, and most lines must finish with a ';'.

As for running it continually, just call the FC/FB from OB1 Main.

Simple SCL Prog.jpg
 
An FC, asssuming inputs and outputs are REALs:
Code:
FUNCTION FC_divbyconstant : VOID

VAR_INPUT
    analog_in : REAL ;    
END_VAR

VAR_OUTPUT
    analog_out : REAL ;    
END_VAR

    analog_out := analog_in / 123.456 ; // change constant value as needed.

END_FUNCTION
Just call FC_divbyconstant in OB1 or any other continously scanned block.

However, you can just as well use a DIV_R block in LAD or FBD.
This example is too simple to have to make a dedicated FC block.
 

Similar Topics

Hello, When you want compare values of an array to a range of numbers is it a right way to do that? FUNCTION ADD VAR_IN_OUT A:ARRAY[1..50]...
Replies
5
Views
2,067
Hi All, I need to try and convert some code from Siemens SCL (TIA16) over to Allen Bradley RS5000. I have attached an image of the SCL and what...
Replies
10
Views
4,051
in the scl code written in screenshot Line 1 condition is false but still the program checking the line 2 condition and says it is true i had...
Replies
3
Views
1,752
I am new to PLC programming. Is there a standard way to incorporate alarms / warnings / events such as the exceptions in C++ or Java where you can...
Replies
5
Views
1,962
Hello All, I am new to programming with Tia Portal and I am having difficulty with something that we have found "easy" in other programming...
Replies
3
Views
2,376
Back
Top Bottom