[?]: How can add functions in SCL?

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
elektronikmuh
Posts: 11
Joined: Wed Feb 28, 2007 6:37 am
Location: Turkey

[?]: How can add functions in SCL?

Post by elektronikmuh »

how can add functions by using "uses:" command in SCL?
Can you explain with example about this matter.
Thanks advance...
frankw
Posts: 103
Joined: Tue Mar 06, 2007 5:59 am
Location: China

Post by frankw »

"uses:",I could not find it in Siemens SCL manual. What do you want to do?
elektronikmuh
Posts: 11
Joined: Wed Feb 28, 2007 6:37 am
Location: Turkey

Post by elektronikmuh »

(* @PATH := '\/Building\/electrical' *) // And what is that mean this?

Code: Select all

FUNCTION_BLOCK CLICK
TITLE = 'CLICK'

// Example below this PATH how can we introduce this??
//uses : oscat/engineering/measurements/T_PLC_MS    
//       oscat/engineering/measurements/STIME

VAR_INPUT
  in : BOOL;
END_VAR
VAR_OUTPUT
  Q : BOOL;
  single : BOOL;
  double : BOOL;
  triple : BOOL;
  status: BYTE;
END_VAR
VAR_INPUT
  T_debounce : TIME := t#10ms;
  T_short : TIME := t#200ms;
  T_pause : TIME := t#500ms;
  T_reconfig : TIME := t#1m;
END_VAR
VAR
  debounce : TON;
  tx : TIME;
  last : TIME;
  init : BOOL;
  edge : BOOL;
  standby: BOOL;
  state: INT;
END_VAR

BEGIN
  
  (* read system time *)
  tx := DINT_TO_TIME(DWORD_TO_DINT(T_PLC_MS()));
  
  (* set last and tx if never started before *)
  IF NOT init THEN
    init := TRUE;
    last := tx;
    debounce.PT := T_debounce;
    standby := in;
  END_IF;
  
  (* debounce input *)
  debounce(in := in XOR standby);
  Q := debounce.Q;
  
  (* delete outputs if input is inactive *)
  IF NOT Q THEN
    single := FALSE;
    double := FALSE;
    triple := FALSE;
    status := 110;
  END_IF;
  
  (* check for input edge *)
  IF Q XOR edge THEN
    edge := in;
    last := tx;
    IF Q THEN state := state + 1; END_IF;
  END_IF;
  
  IF (q AND tx - last >= T_short) OR (NOT q AND tx - last >= t_pause) THEN
    CASE state OF
      1:  single := TRUE;
        status := 111;
      2:  double := TRUE;
        status := 112;
      3:  triple := TRUE;
        status := 113;
    END_CASE;
    state := 0;
  END_IF;
  
  (* determine if high or low active *)
  IF tx - last >= t_reconfig THEN
    standby := in;
    last := tx;
  END_IF;
  
  
  

END_FUNCTION_BLOCK
graf_STEP7
Posts: 57
Joined: Tue Feb 13, 2007 5:41 pm
Location: Europe

Post by graf_STEP7 »

// Example below this PATH how can we introduce this??
//uses : oscat/engineering/measurements/T_PLC_MS
// oscat/engineering/measurements/STIME
Under SCL are // comments.

The Autor "Hugo" or "Daniel" will with the word "uses" say --> Copy the FB/FC with name "T_PLC_MS" and "STIME" in your projekt.

Your Funktion need this for Work without errors.


I allways use the OSCAT-Lib, it is very god.

do you have download your LIB for STEP7.

It is "READY to WORK".
elektronikmuh
Posts: 11
Joined: Wed Feb 28, 2007 6:37 am
Location: Turkey

Post by elektronikmuh »

Thanks for replay i understand,
i will try copy functions into my project.
Another question

Code: Select all

(* @PATH := '\/Building\/electrical' *)

this comment i dont understand what doest it mean?
Thanks in advance.
graf_STEP7
Posts: 57
Joined: Tue Feb 13, 2007 5:41 pm
Location: Europe

Post by graf_STEP7 »

Another question Code:
(* @PATH := '\/Building\/electrical' *)
this comment i dont understand what doest it mean?
This is an command to.
After open the lib, you can see Stuctur on Library.
(I dont know, if this multilingual, in german i see this in german)

----------------------------------------
I think, you have download the LIB for EXTENDED-SPSes

For Step 7 you can load an "ready-lib" for your system.
SCL-Source is in LIB aviable.

Follow steps:
Download LIB.
http://www.oscat.de/index.php?option=co ... cdesc=DESC

Urgend: Select "oscat.lib 2.74 für Step 7" for your System
Deutsch:
Starten von Simatic Manager

Datei --> Dearchivieren.. --> OSCAT.lib auswählen --> Zielverzeichnis und O.K.

English: ( I dont have English Version)
I will try it.
File --> dearchive --> select file and O.K.
You can open now the SCL and ready-compiled code.
Copy the FCs into your Programm.
You can rename the Function-Names.

You can open to: File --> open --> Tab Library -->

Have Fun
Post Reply