You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old March 10th, 2016, 08:56 AM   #1
SHKODRAN
Member
Albania

SHKODRAN is offline
 
Join Date: May 2010
Location: Italy
Posts: 102
Siemens - STL to SCL

someone is able to do the conversion?
Thank you.
Code:
A     BOOL 1
      A     BOOL 2
      AN    BOOL 3
      AN    BOOL 4
      JCN   Y030

      L     INT 1
      +     1
      T     INT 1
      L     50                          
      >I    
      JCN   Y040

      L     0
      T     INT 1
      S     BOOL 4
//*
Y030: A     BOOL 1
      A     BOOL 4
      JCN   Y040

      L     INT 1
      +     1
      T     INT 1
      L     10                         
      >=I   
      JCN   Y040

      L     0
      T     INT 1
      R     BOOL 4

Y040: NOP 0
  Reply With Quote
Old March 10th, 2016, 04:12 PM   #2
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,404
Literal conversion:

Code:
FUNCTION FC10:VOID
VAR_in_out
bool1:BOOL;
bool2:BOOL;
bool3:BOOL;
bool4:BOOL;
int1:INT;

END_VAR
var
L:INT;
nbool3:BOOL;
nbool4:BOOL;
END_VAR
LABEL
  Y030,Y040;
END_LABEL  

BEGIN
nbool3:=NOT bool3;
nbool4:=NOT bool4;
IF NOT (bool1 AND bool2 AND nbool3 AND nbool4) THEN GOTO Y030;
END_IF;
int1:=int1+1;

IF NOT (int1 > 50) THEN GOTO Y040;
END_IF;

int1:=0;
bool4:=True;

Y030: IF NOT(bool1 AND bool4) THEN GOTO Y040;
END_IF;    

int1:=int1+1;
IF NOT (int1 >= 10) THEN GOTO Y040;
END_IF;

int1:=0;
bool4:=False;


Y040: L:=L; //instead of nop


END_FUNCTION;
  Reply With Quote
Old March 11th, 2016, 03:27 AM   #3
SHKODRAN
Member
Albania

SHKODRAN is offline
 
Join Date: May 2010
Location: Italy
Posts: 102
Thank you!
  Reply With Quote
Old December 1st, 2020, 08:46 PM   #4
Alisha
Member
Australia

Alisha is offline
 
Join Date: Dec 2020
Location: SanRemo
Posts: 5
Hello, can you please help me on this?
SET ;
SAVE ;
= L 26.1;
L DW#16#10020008;
T LD 28;
L DINO;
T LW 32;
TAR2 ;
+ L#384;
T LD 34;
L LD 28;
T LD 0;
L LD 32;
T LD 4;
L LW 36;
T LW 8;
L DID [AR2,P#0.0];
T LD 10;
L DID [AR2,P#4.0];
T LD 14;
L DIW [AR2,P#8.0];
T LW 18;
L LW 2;
T LW 12;
L LD 10;
T LD 28;
L LD 14;
T LD 32;
L LW 18;
T LW 36;
L LD 0;
T LD 38;
L LD 4;
T LD 42;
L LW 8;
T LW 46;
TAR2 LD 48;
UC "BLKMOV" {
P#L 28.0,
P#L 22.0,
P#L 38.0};
LAR2 LD 48;
  Reply With Quote
Old December 2nd, 2020, 02:10 AM   #5
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,404
Post the whole block as source code.
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old December 2nd, 2020, 02:16 AM   #6
Alisha
Member
Australia

Alisha is offline
 
Join Date: Dec 2020
Location: SanRemo
Posts: 5
SET
SAVE
= L 26.1
L DW#16#10020008
T LD 28
L DINO
T LW 32
TAR2
+ L#384
T LD 34
L LD 28
T LD 0
L LD 32
T LD 4
L LW 36
T LW 8
L DID [AR2,P#0.0]
T LD 10
L DID [AR2,P#4.0]
T LD 14
L DIW [AR2,P#8.0]
T LW 18
L LW 2
T LW 12
L LD 10
T LD 28
L LD 14
T LD 32
L LW 18
T LW 36
L LD 0
T LD 38
L LD 4
T LD 42
L LW 8
T LW 46
TAR2 LD 48
UC "BLKMOV"
P#L 28.0
P#L 22.0
P#L 38.0
LAR2 LD 48
L #iTemp
L #Gross_In.GrossWeight
T #GrossPV.Value
L #Gross_In.NetWeight
T #NetPV.Value
L DIB [AR2,P#14.0]
L B#16#0
<>I
L DIB [AR2,P#15.0]
L B#16#0
= L 26.2
<>I
O L 26.2
= #Error.Value
L #Ls****chdog
L #WATCHDOG
<>R
JCN A7d0
CLR
= #Bad.Value
L B#16#80
T #Bad.ST
JU A7d1
A7d0: SET
= #Bad.Value
L B#16#0
T #Bad.ST
A7d1: L DW#16#10020008
T LD 28
L DINO
T LW 32
TAR2
+ L#448
T LD 34
L LD 28
T LD 0
L LD 32
T LD 4
L LW 36
T LW 8
L DID [AR2,P#16.0]
T LD 10
L DID [AR2,P#20.0]
T LD 14
L DIW [AR2,P#24.0]
T LW 18
L W#16#8
T LW 2
L LW 2
T LW 12
CLR
A #PresetReq
A #ClearReq
JCN A7d2
CLR
= #PresetReq
= #ClearReq
= #sx_SetClear
= #sx_ResetClear
= #sx_SetPreset
= #sx_ResetPreset
= #sx_SetTare
= #PresetReq
A7d2: CLR
A #PresetReq
JCN A7d3
A #sx_SetClear
NOT
= L 26.2
A #sx_ResetClear
NOT
A L 26.2
= L 26.2
A #sx_SetPreset
NOT
A L 26.2
= L 26.2
A #sx_ResetPreset
NOT
A L 26.2
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7d4
L W#16#1
T #Data_Out.ClearReq
SET
= #sx_SetClear
JU A7d3
A7d4: CLR
A #sx_ResetClear
NOT
A #sx_SetClear
= L 26.2
A #sx_SetPreset
NOT
A L 26.2
= L 26.2
A #sx_ResetPreset
NOT
A L 26.2
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7d6
L W#16#0
T #Data_Out.ClearReq
SET
= #sx_ResetClear
JU A7d3
A7d6: CLR
A #sx_SetClear
A #sx_ResetClear
= L 26.2
A #sx_SetPreset
NOT
A L 26.2
= L 26.2
A #sx_ResetPreset
NOT
A L 26.2
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7d7
L W#16#1
T #Data_Out.PresetReq
SET
= #sx_SetPreset
JU A7d3
A7d7: CLR
A #sx_SetClear
A #sx_ResetClear
A #sx_SetPreset
= L 26.2
A #sx_ResetPreset
NOT
A L 26.2
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7d8
L W#16#0
T #Data_Out.PresetReq
SET
= #sx_ResetPreset
JU A7d3
A7d8: CLR
A #sx_SetClear
A #sx_ResetClear
A #sx_SetPreset
A #sx_ResetPreset
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7d9
L #TareValue
T #sr_Tare
SET
= #sx_SetTare
JU A7d3
A7d9: CLR
A #sx_SetTare
JCN A7d3
CLR
= #sx_SetClear
= #sx_ResetClear
= #sx_SetPreset
= #sx_ResetPreset
= #sx_SetTare
= #PresetReq
A7d3: CLR
A #ClearReq
JCN A7db
A #sx_SetClear
NOT
= L 26.2
A #sx_ResetClear
NOT
A L 26.2
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7dc
L W#16#1
T #Data_Out.ClearReq
SET
= #sx_SetClear
JU A7db
A7dc: CLR
A #sx_ResetClear
NOT
A #sx_SetClear
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7de
L W#16#0
T #Data_Out.ClearReq
SET
= #sx_ResetClear
JU A7db
A7de: CLR
A #sx_SetClear
A #sx_ResetClear
= L 26.2
A #sx_SetTare
NOT
A L 26.2
JCN A7df
L #TareValue
T #sr_Tare
SET
= #sx_SetTare
JU A7db
A7df: CLR
A #sx_SetTare
JCN A7db
CLR
= #sx_SetClear
= #sx_ResetClear
= #sx_SetPreset
= #sx_ResetPreset
= #sx_SetTare
= #ClearReq
A7db: L #sr_Tare
T #Data_Out.TareValue
L LD 0
T LD 28
L LD 4
T LD 32
L LW 8
T LW 36
L LD 10
T LD 38
L LD 14
T LD 42
L LW 18
T LW 46
TAR2 LD 48
UC "BLKMOV"
P#L 28.0
P#L 22.0
P#L 38.0
LAR2 LD 48
L #iTemp
A L 26.1
SAVE
BE
  Reply With Quote
Old December 2nd, 2020, 04:22 AM   #7
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,404
That is not source code. Generate source code for the block and then export the source and attach.
Attached Images
File Type: jpg srca.jpg (34.9 KB, 125 views)
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old December 2nd, 2020, 04:33 AM   #8
Alisha
Member
Australia

Alisha is offline
 
Join Date: Dec 2020
Location: SanRemo
Posts: 5
I only have the FB not the source code, airry
  Reply With Quote
Old December 2nd, 2020, 08:32 AM   #9
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 2,075
You have to create the source files from the FB.
This gives some pointers on how to do it.

Without the source we can't see the local variables and interface configured for the FB and as such this particular bit of code (and another below)
is somewhat meaningless.


T LD 28
L DINO
T LW 32
TAR2
+ L#384
T LD 34
L LD 28
T LD 0
L LD 32
T LD 4
L LW 36
T LW 8
L DID [AR2,P#0.0]
T LD 10
L DID [AR2,P#4.0]
T LD 14
L DIW [AR2,P#8.0]
T LW 18
L LW 2
T LW 12
L LD 10
T LD 28
L LD 14
T LD 32
L LW 18
T LW 36
L LD 0
T LD 38
L LD 4
T LD 42
L LW 8
T LW 46
  Reply With Quote
Old December 2nd, 2020, 10:22 AM   #10
TurpoUrpo
Lifetime Supporting Member
Finland

TurpoUrpo is offline
 
Join Date: May 2008
Location: Switzerland
Posts: 1,553
Quote:
Originally Posted by Alisha View Post
I only have the FB not the source code, airry
https://www.youtube.com/watch?v=CURns6SRDDU
  Reply With Quote
Old December 2nd, 2020, 12:52 PM   #11
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,404
Quote:
Originally Posted by Alisha View Post
I only have the FB not the source code, airry

Your FB was originally written in SCL - how hard have you tried to find the original SCL source code in previous backups of the project?
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old December 2nd, 2020, 08:37 PM   #12
Alisha
Member
Australia

Alisha is offline
 
Join Date: Dec 2020
Location: SanRemo
Posts: 5
We couldn’t find the code back to archive project, now time to upgrade and we need the source code, the “generate scl” code, did the I/Os only
  Reply With Quote
Old December 2nd, 2020, 09:05 PM   #13
Alisha
Member
Australia

Alisha is offline
 
Join Date: Dec 2020
Location: SanRemo
Posts: 5
here is the "Generate source file" from STEP 7
Attached Files
File Type: txt WeightSC.txt (9.5 KB, 21 views)
  Reply With Quote
Old August 5th, 2022, 02:20 AM   #14
DaveJokeS
Member
Peru

DaveJokeS is offline
 
Join Date: Dec 2021
Location: Lima
Posts: 4
Pencil Help with program STL convert SLC

Hello everyone,

I am migrating a program from STL to SCL via S7-1200 portal, I would like you to help me by converting these lines of code.

Cheers,


L DBW 4
L DBW 6
-I
JM M001
JP M002
JU M003
M001: L DBW 10
-I
JM M004
JU M003
M002: L DBW 12
-I
JP M004
M003: L DBW 4
L DBW 8
-I
JM M005
JP M006
JU M007
M005: L DBW 10
-I
JM M004
JU M007
M006: L DBW 12
-I
JP M004
M007: L DBW 4
L DBW 6
+I
L DBW 8
+I
T DBW 14
L DBW 14
SRW 1
T DBW 16
L DBW 20
+I
T DBW 24
L DBW 0
S C 9
S C 10
L DBW 2
S C 20
S C 21
R M 0.3
R M 2.0
R M 2.1
R M 2.2
R M 2.3
R M 2.4
R M 2.5
M004: NOP 0
  Reply With Quote
Old August 5th, 2022, 08:21 AM   #15
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,373
In another thread someone suggested a more direct route; you should try that first.


Here is an awkward guess using what I think can be called transliteration; it only works because there are no reverse jumps. I don't understand addressing in STL at all; you are on your own for the VAR...END_VAR blocks. No warranty expressed or implied.

I would use this as a start to add SCL comments and understand what the program is doing, then re-write the SCL again using that understanding.

L DBW 4 ACC1 := DBW4;
L DBW 6 ACC2 := ACC1; ACC1 := DBW6;
-I ACC1 := ACC2 - ACC1;

JM M001 IF ACC1 < 0 THEN next := 1; ELSE
JP M002 IF ACC1 > 0 THEN next := 2;
JU M003 ELSE next := 3; END_IF;
END_IF;

M001: L DBW 10 IF next = 1 THEN ACC2 := ACC1; ACC1 := DBW10;
-I ACC1 := ACC2 - ACC1;
JM M004 IF ACC1 < 0 THEN next := 4;
JU M003 ELSE next := 3; END_IF;
END_IF;

M002: L DBW 12 IF next = 2 THEN ACC2 := ACC1; ACC1 := DBW12;
-I ACC1 := ACC2 - ACC1;
JP M004 IF ACC1 > 0 THEN next := 4;
ELSE next := 3; END_IF; (* Drop through to M003: if ACC1 is not positive *)

M003: L DBW 4 IF next = 3 THEN ACC2 := ACC1; ACC1 := DBW4;
L DBW 8 ACC2 := ACC1; ACC1 := DBW4;
-I ACC1 := ACC2 - ACC1;
JM M005 IF ACC1 < 0 THEN next := 5;
JP M006 ELSE IF ACC1 > 0 THEN next := 6; END_IF;
JU M007 ELSE next := 7; END_IF;
END_IF;

M005: L DBW 10 IF next = 5 THEN ACC2 := ACC1; ACC1 := DBW10;
-I ACC1 := ACC2 - ACC1;
JM M004 IF ACC1 < 0 THEN next := 4;
JU M007 ELSE next := 7; END_IF;
END_IF;

M006: L DBW 12 IF next = 6 THEN ACC2 := ACC1; ACC1 := DBW12;
-I ACC1 := ACC2 - ACC1;
JP M004 IF ACC1 > 0 THEN next := 4;
ELSE next := 7; END_IF; (* Drop through to M007: if ACC1 is not positive *)
END_IF;

M007: L DBW 4 IF next = 7 THEN ACC2 := ACC1; ACC1 := DBW4;
L DBW 6 ACC2 := ACC1; ACC1 := DBW6;
+I ACC1 := ACC2 + ACC1;
L DBW 8 ACC2 := ACC1; ACC1 := DBW8;
+I ACC1 := ACC2 + ACC1;
T DBW 14 DBW14 := ACC1;
L DBW 14 ACC2 := ACC1; ACC1 := DBW14;
SRW 1 ACC1 := (ACC1 & 16:FFFE) / 2;
T DBW 16 DBW16 := ACC1;
L DBW 20 ACC2 := ACC1; ACC1 := DBW20;
+I ACC1 := ACC2 + ACC1;
T DBW 24 DBW24 := ACC1;
L DBW 0 ACC2 := ACC1; ACC1 := DBW0;
S C 9 C9 := TRUE; (* Boolean ; I assume RLO is 1? *)
S C 10 C10 := TRUE;
L DBW 2 ACC2 := ACC1; ACC1 = DBW2;
S C 20 C20 := TRUE;
S C 21 C21 := TRUE;
R M 0.3 M0_3 := FALSE
R M 2.0 M2_0 := FALSE
R M 2.1 M2_1 := FALSE
R M 2.2 M2_2 := FALSE
R M 2.3 M2_3 := FALSE
R M 2.4 M2_4 := FALSE
R M 2.5 M2_5 := FALSE
next := 4; END_IF; (* Drop through to M004: *)

M004: NOP 0 IF next = 4 THEN
...
END_IF;



__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Help converting STL on Siemens S7-300 to ladder easingwm LIVE PLC Questions And Answers 16 February 16th, 2018 03:13 AM
Siemens TIA portal SCL view disassembly Hoffelhass LIVE PLC Questions And Answers 6 April 4th, 2015 02:41 AM
Siemens S7: How to: Multi instance offset in SCL inalvor1 LIVE PLC Questions And Answers 5 April 9th, 2013 08:07 AM
Siemens S7 STL Question(s) minerman LIVE PLC Questions And Answers 6 November 30th, 2012 12:55 AM
Alternative Siemens SCL builder Mysil2 LIVE PLC Questions And Answers 1 March 16th, 2009 04:57 AM


All times are GMT -4. The time now is 10:17 PM.


.