Can't connect a pointer (string)

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
I made an SCL block.

I have a String parameter, 200 records...

Data_in: ARRAY[1..200] OF STRING;


On the outside of the block I'm trying to connect the right DB with his array of 200 strings (length = 30).

Why can't I connect a pointer ?

Message in S7: Actual data type ARRAY does not fit in the formal type ARRAY Of the formal parameter Data_in


...
 
Not sure what goes wrong for you.
I just made a test.

UDT "UDTstrARR" with
..strARR=ARRAY[1..200] OF STRRING[20]

DB "MyStrings" with
..in=UDTstrARR
..out=UDTstrARR

FC2 in SCL
Code:
 FUNCTION FC2 : INT 
VAR_INPUT
   strARRin : UDTstrARR ;
END_VAR
VAR_outPUT
   strARRout : UDTstrARR ;
END_VAR
 strARRout.strARR[1] := strARRin.strARR[2]  ;
 FC2 := 100;
END_FUNCTION
in OB1
Code:
       CALL  FC     2
       strARRin :="MyStrings".In
       RET_VAL  :=MW10
       strARRout:="MyStrings".out
      NOP   0
Works OK.
 
If you do not specify the length of the string, the compiler/editor will assume it is of length 254

As your DB has strings of length 30 in it, you must specify the same string length in the FC parameter, i.e.

Code:
Data_in: ARRAY[1..200] OF STRING[30];
 
ok

I've rewritten it a little easier, and did not need the input parameter anymore... But, I understand that I had to specify this, I tried it and you're right. Thanks, I learned.


L D[AR2 said:
If you do not specify the length of the string, the compiler/editor will assume it is of length 254

As your DB has strings of length 30 in it, you must specify the same string length in the FC parameter, i.e.

Code:
Data_in: ARRAY[1..200] OF STRING[30];
 

Similar Topics

The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
4
Views
30
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
87
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
104
Here's what happened, Operator turned on the disconnect for an auger while it was still running to cut power. Auger DID in fact turn off, but the...
Replies
8
Views
335
What has been your experience with year over year price increases on your Tech-connect service contracts? Is it up to the distributor? 30% seems...
Replies
5
Views
288
Back
Top Bottom