siemens Step7: REAL or DINT

obi wan

Member
Join Date
Aug 2009
Location
Ro
Posts
13
Hi,

How can I know if a value is double integer or real? I use this for a check a input parameter in a function.

Thx.
 
If you add that MD200 to symbol table, then you can assing type that step7 can check for it.
 
Last edited:
Anyway, it is not possible to check if the incoming values in the parameters are DINTs or REALs.
All possible bit combinations can be represented as a DINT value, and all but a few bit combinations can be represented as a REAL value. How to know that a bit combinmation is a DINT or a REAL ?
One way could be to check for values outside certain limits that cannot be "realistic". But it will be a lot of work, and will not be bulletproof. All just to catch that the idiot programmer dont use symbols.

edit: I dont mean to say that obi wan is an idiot. I assume that obi wan is refering to that someone else may use his FC, and he want to check if it is done right.
 
Last edited:
This situation can be

Hi,

I want only to say that this situation can be.
I post 2 *.jpg file with a function that convert seconds in hours, minutes, seconds.
We can see 2 different situation with 2 values dint and real from a DB. How can I protect the user of function for this situation? Sure, I can convert real value to dint but it is not correct.

bye

inp value DINT - ok.jpg inp value REAL - not ok.jpg
 
Options > Customize > LAD/FBD > Select: Type Check of Addresses

The Editor will not allow a variable declared as REAL to be used on a FC input that is declared as a DInt.

Other than that, there is no way to check/prevent it.
 
Whatever I try, I cannot get the editor to accept a variable with a REAL symbol on a DINT input, regardless if type checking is on or not. So I cannot recreate the situation in the screenshot.

Obi wan, how did you get that screenshot ? Did you just change "representation" from "decimal" to "floating point" ? That has nothing to do with the checking of the variables type. That is just how the value is displayed when looking online.
 
I changed the DB value with right-click/Modify...
Sorry if I dust-up with my question. But I just wanted more information.
Thanks for your support.
 
In the S7 program, it cannot happen by accidence, as long as you use symbols.
In a Siemens HMI, it also cannot happen by accidence, if the HMI uses the symbols from the STEP7 project.
If using OPC, it also cannot happen by accidence, if using symbols from the STEP7 project.
If not using symbols, it requires a lot more attention and care of what you do.

Anyway, as I wrote before it is not possible to do a test for REAL or DINT.
 

Similar Topics

Hi, I'm writing a program to perform some basic math calculations, but somewhere in the middle something's going wrong, and variables with a real...
Replies
1
Views
3,129
Hey All, I'm looking for a simple way to take an incoming value in DWORD format and convert it to a real number. Does anyone know of a simple way...
Replies
4
Views
9,341
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
168
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
157
I have a word in some DB which I want to load to AR1 and use as a pointer. In order to do this I need to write L DBxy.DBW xy SLD 3 LAR1 I...
Replies
3
Views
550
Back
Top Bottom