I need help!

fh43bktdh

Member
Join Date
Jan 2008
Location
HAI DUONG
Posts
5
L 0
T #i
A80a: L #i
L 3
<=I
JCN A809
L #i
ITD
L L#2
+D
L L#8
*D
TAR2
+D
LAR1
L DIB [AR1,P#64.0]
L #DB_SCALE
T LW 56
TAK
T LB 55
TAK
L #ti_ADR
L #i
+I
ITD
L L#8
*D
L LB 55
OPN DB [LW 56]
TAK
LAR1
TAK
L DBB [AR1,P#0.0]
<>I
JCN A80c
SET
= L 30.0
= #sb_APPL_ID_ERR
A80c: L #i
L 1
+I
T #i
JU A80a
A809



I need help from every one. why ar2 to be use that. before ar2 not use any LAR2 or other. content in curent have what?
anyone help me change to SCL please! that is loop:
FOR i:=0 TO 3 BY 1 DO....

END_FOR;
 
can't help with SCL, but AR2 points to the start of data in the instance DB of the current FB. That is why, if you use AR2, you must save it first and recover it after use (before you next wish to access your IDB data).
 
Here is some SCL
Code:
FUNCTION_BLOCK FB999
VAR_IN_OUT
sb_APPL_ID_ERR:BOOL;
END_VAR
VAR_OUTPUT
// Output Parameters
END_VAR
VAR_TEMP
// Temporary Variables
byData:BYTE;
db_scale:WORD;
byPadding:ARRAY[1..50] OF BYTE;
END_VAR
VAR
// Static Variables
i:INT;
ti_ADR:INT;
Scale:ARRAY[1..10,-2..0] OF BYTE;
END_VAR
FOR i:=0 TO 3 DO
	IF [b]not[/b](scale[1,i]) <> (WORD_TO_BLOCK_DB(db_scale).db[ti_ADR+i]) THEN sb_APPL_ID_ERR:=1; END_IF;	
END_FOR; 
END_FUNCTION_BLOCK
and produces this STL code
Code:
	 SET 
	 SAVE 
	 =	 L	 54.1
	 L	 0
	 T	 #i
A7d0: L	 #i
	 L	 3
	 <=I 
	 JCN A7d1
	 L	 #i
	 ITD 
	 L	 L#2
	 +D	
	 L	 L#8
	 *D	
	 TAR2 
	 +D	
	 LAR1 
	 L	 DIB [AR1,P#6.0]
[b]	 INVI [/b]
[b]	 AW	W#16#FF[/b]
	 L	 #db_scale
	 T	 LW	56
	 TAK 
	 T	 LB	55
	 TAK 
	 L	 #ti_ADR
	 L	 #i
	 +I	
	 ITD 
	 L	 L#8
	 *D	
	 L	 LB	55
	 OPN DB [LW	56]
	 TAK 
	 LAR1 
	 TAK 
	 L	 DBB [AR1,P#0.0]
	 <>I 
	 JCN A7d2
	 SET 
	 =	 #sb_APPL_ID_ERR
A7d2: L	 #i
	 L	 1
	 +I	
	 T	 #i
	 JU	A7d0
A7d1: CLR 
	 A	 L	 54.1
	 SAVE 
	 BE

The bold text is what I had to use to make the STL look like your posted code (apart from the base address of the scale array in the stat data area). If the not is removed from the SCL, the STL produced by my SCL compiler (V5.1+SP1) uses temp local data in a different way but produces the same processing as your posted code as shown below:

Code:
	 SET 
	 SAVE 
	 =	 L	 54.1
	 L	 0
	 T	 #i
A7d0: L	 #i
	 L	 3
	 <=I 
	 JCN A7d1
	 L	 #i
	 ITD 
	 L	 L#2
	 +D	
	 L	 L#8
	 *D	
	 L	 #db_scale
	 T	 LW	56
	 TAK 
	 T	 LD	58
	 TAK 
	 L	 #ti_ADR
	 L	 #i
	 +I	
	 ITD 
	 L	 L#8
	 *D	
	 L	 LD	58
	 TAK 
	 T	 LD	62
	 TAK 
	 TAR2 
	 +D	
	 LAR1 
	 L	 DIB [AR1,P#6.0]
	 OPN DB [LW	56]
	 LAR1 LD	62
	 L	 DBB [AR1,P#0.0]
	 <>I 
	 JCN A7d2
	 SET 
	 =	 #sb_APPL_ID_ERR
A7d2: L	 #i
	 L	 1
	 +I	
	 T	 #i
	 JU	A7d0
A7d1: CLR 
	 A	 L	 54.1
	 SAVE 
	 BE

Note that as you have not posted the interface section the scale array may not necessarily be located in the stat area, it may be in the IN area. Is is also not clear if you have posted the complete code as there is no BE and there is also no reference to the L30.0 variable.
 
thanks every one!

Thanks very much every one! I'm changing a FB43 that progame of modul weighing, from STL to SCL. But some code STL too difficult for to change to SCL. In the future I will need more help from every one. Thanks a lot!
 

Similar Topics

I'm fairly new to Rockwell software, I've had some basic training in the past but nothing too advanced. My company and I use Reliable products for...
Replies
11
Views
338
Hi all, I am having issues accessing my Cimplicity software - the site code changed after re-install and I am no longer able to attain a new key...
Replies
10
Views
164
Good day all! Can someone help me with the procedure to update Beijers E700 firmware? The Panel I am working on is firmware 2.04v and I would...
Replies
1
Views
70
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
317
Back
Top Bottom