PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   Handling Data Types in PLCs (General) (http://www.plctalk.net/qanda/showthread.php?t=114182)

sabledanny February 9th, 2018 01:13 PM

Handling Data Types in PLCs (General)
 
Hello,

I've been meaning to study on PLC data types and how to ensure I do not move a data that exceeds the maximum value such as moving a DINT to INT etc. Do recommend me some links to read on.

Thanks and best regards,
Danny

mk42 February 9th, 2018 01:28 PM

Quote:

Originally Posted by sabledanny (Post 768165)
Hello,

I've been meaning to study on PLC data types and how to ensure I do not move a data that exceeds the maximum value such as moving a DINT to INT etc. Do recommend me some links to read on.

Thanks and best regards,
Danny

The first thing you can do is to check that the data type is valid when you're creating your program. Before you move the DINT into the INT, check that it is smaller than the max INT allowed.

Many systems automatically build these into the convert/move blocks. Check out Overflow errors. It's a topic that has probably been discussed for 30 years, in just about every programming language: PC or PLC.

cardosocea February 10th, 2018 08:32 AM

It seems like you are looking into AB... mind you that AB is very forgiving with data types, whilst other PLC manufacturers (like Siemens) aren't and you need to ensure that the right data type goes into the right place. Instead of being a case of fitting 32bits in 16 bits it's a case of getting a floating point value into an integer variable.

spaderkung February 10th, 2018 10:30 AM

How you move them and for what purpose is important.
Using built in functions, what kind, or if you do it on a lower level. For use internally or read write over raw tcp it all makes your method more or less important.


All times are GMT -5. The time now is 09:19 PM.

.