Starting with SCL

MartinW

Member
Join Date
Apr 2008
Location
UK
Posts
70
Hi,

I've recently started using SCL and I can't seem to find an answer to this problem...

I have created a DB, DB900, in a S7 project, called dbFred. dbFred is made up of a complex struct, say "Person":-

Person
Height : int
weight : int

The UDT compiles ok, no errors there.

So in my SCL code, I call dbFred.Person.Height but the compiler doesn't recognise any of the symbolic names. If I replace "dbFred" with DB900 some of the errors go away.

How do I get the compiler to recognise symbolic names?

Thanks,
 
The following compiles, dbFred is in the symbol table.

Code:
DATA_BLOCK "dbFred"
    STRUCT
    Person:STRUCT
     rHeight:REAL;
     rWeight:REAL;
     END_STRUCT;    
    END_STRUCT
BEGIN
END_DATA_BLOCK

FUNCTION FC999 : Void
VAR_TEMP
rData:REAL;
END_VAR
rData:="dbFred".Person.rHeight;
END_FUNCTION
 
Hi Simon,

My DB is in the symbol table. It was created in the LAD viewer normally, not by compiling the text declaration.

So do I have to declare all of the structs in a DB in SCL as well as the DB itself?
 
:oops:

ok, it seems my errors were being caused by addressing arrays in my structs with () rather than []
 

Similar Topics

Hi, I am attempting to turn on an output for one second, every thirty seconds, but am having some trouble. I have a XIC with S:1/15 (first pass)...
Replies
9
Views
591
Rather new to structured text. I'm trying to edit a machine so that it will reinitialize with some push buttons held in for 10 seconds. Pushing...
Replies
13
Views
2,748
Hi Guys, I'm using an ABL33ER with Panelview 600. I have datalogging running on the HMI using the view studio datalog model on startup of the...
Replies
4
Views
1,139
Hello guys, I have windows 10 on virtualbox guests and not on the host. On a windows 10 guest I have TIA Selection tool V2022.06. When I...
Replies
1
Views
1,509
Hi This message popped up when I created a new hard disk (image) (TwinCat IO Server. TwinCat is not starting because of an invalid device...
Replies
3
Views
1,542
Back
Top Bottom