Array of DINT in S7 SCL

Hanky

Member
Join Date
Jun 2007
Location
Oosterwolde
Posts
11
How do i set an array of DINT IN S7 SCL? (SCL V5.3 SP1)
For a REAL's and INT's it works just fine:

Reals : ARRAY[1..10] OF DINT := 0,0,0,0,0,0,0,0,0,0;
Integer : ARRAY[0..10] OF INT := 0,0,0,0,0,0,0,0,0,0;

How to do this for DINT's?
everything i try gives a compilation error in SCL.



Thx in advance.
 
Henk

The line you show prefixed by "Reals :" does seem to define an ARRAY of DINT correctly. What you have created is an ARRAY named "Reals" which contains DINTs! The default value for numeric data-types in an ARRAY is 0 or 0.0 so you don't actually need the assignment here.

I think there also some way of assigning an identical value to every element in ARRAY, like

Reals : ARRAY[1..10] OF DINT := 0;
DINTs : ARRAY[1..10] of DINT := 0;

should produce two identical ARRAYs with different names.

What name are you using when you try to creat an ARRAY of DINT? Could it be a reserved word like 'DINT' rather than DINTs?

Regards

Ken
 
The following code compiles ok:

Code:
FUNCTION_BLOCK FB10
VAR_TEMP
  // Temporary Variables
END_VAR
VAR
  // Static Variables
iArrayOfInts: ARRAY[0..10] OF INT := 0,0,0,0,0,0,0,0,0,0;
rArrayOfReals: ARRAY[0..10] OF REAL := 0,0,0,0,0,0,0,0,0,0;
iArrayOfDInts: ARRAY[0..10] OF DINT := 0,0,0,0,0,0,0,0,0,0;
END_VAR
  // Instruction Section
  ;
END_FUNCTION_BLOCK
 
Ken M said:
Henk

The line you show prefixed by "Reals :" does seem to define an ARRAY of DINT correctly. What you have created is an ARRAY named "Reals" which contains DINTs! The default value for numeric data-types in an ARRAY is 0 or 0.0 so you don't actually need the assignment here.

I think there also some way of assigning an identical value to every element in ARRAY, like

Reals : ARRAY[1..10] OF DINT := 0;
DINTs : ARRAY[1..10] of DINT := 0;

should produce two identical ARRAYs with different names.

What name are you using when you try to creat an ARRAY of DINT? Could it be a reserved word like 'DINT' rather than DINTs?

Regards

Ken

Hello Ken
Sorry i typed an error i ment:

REALs : ARRAY[1..10] OF REAL := 0,0;
DINTs : ARRAY[1..10] of DINT := 0;

The name DINT or DINTs is not used twice.



hello L D[AR2,P#0.0]
I tried to comile it in a new SCL file and it worked just fine,
In the old file the lines were whitin an STRUCT area, maybe that is not allowed.

But anyhow, my problem is solved, Thanks guys.

Henk
 

Similar Topics

I have a Structure in my project which has a few nested UDTs. They are ultimately of type DINT. What I would like to do is copy the values out of...
Replies
5
Views
2,292
Studio 5000 Ladder logic, i have a dint. We will call it Station. I want to see if there is a cleaner way of saying if bit .1 is true, then a dint...
Replies
11
Views
2,239
Thank you so much for your help! I am trying to use an INT or DINT as a setpoint for my remote device using Modbus TCP/IP. My code is...
Replies
2
Views
2,426
Hi All, I cannot seem to find a way to move a Boolean from an Arrays UDT into a DINT. I have an Array of 32 elements with a UDT data type of 4...
Replies
3
Views
1,760
Hello, Iam new here and use Rslogix for first Time. How can I move DINT_Value to an Array Of INT. For example: Move DINT_Value1 to...
Replies
9
Views
3,974
Back
Top Bottom