first time SCL, how to ref. REAL in DB

mspath

Member
Join Date
Mar 2004
Posts
7
Hello:
I've just started (literally) to use SCL and I'm making a small SCL OB and trying to get access to a REAL in a data block.
Do I have to use DWORD_TO_REAL conversion?
Thanks
Mike
 
Last edited:
Hello, mspath;
Type conversions (type-castings)are only necessary if you are accessing a variable that has been defined as a different type, origibally.
If you define a DB-variable of type REAL, you access it directly as a REAL.
Open your DBx, from Simatic Manager, S7 Program, Blocks. you will bw shown all defined variabes for that DB, with their names, addresses and data type. You can change the data type of these variables in the declaration view of the DB, and use them as required in your programs (be it through SCL, STL, Ladder....)

Hope this helps,
Daniel Chartier
 
access to DB reals in SCL

Thanks for the reply fellas:
I guess that I'm asking how to you reference REALs in an SCL program that are sitting inside the global DBs.
for example, I tried:

FUNCTION_BLOCK FB5
VAR_TEMP
//reserved
//info: ARRAY[0..19] OF BYTE;
tempCor, diaCubed, capShift : REAL;
dwType : DWORD;

END_VAR

tempCor := DB1.DBD0 // try to accesss the first real and get
// Invalid Data Type compile error
END_FUNCTION_BLOCK
 
had to use all symbolic name

hey all:
Thanks for the help. I was only using the symbolic name for the DB side (ie. SymbolName.DBD0), had to use SymbolicName.ParamName
:)
 

Similar Topics

HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
82
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
559
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
318
Hi everyone, I am new to this amazing world of PLC, well... I mean, in practice, since I already knew electronics, programming languages, IT, and...
Replies
7
Views
654
Hi all, This is my first post; I am new to PLC Controls stuff and English is not my native language, so I apologize in advance if something is...
Replies
4
Views
512
Back
Top Bottom