Hi Julian,


regarding your question.



As far as I have encountered, PLCs mostly transfer unsigned values and Java 
usually uses signed values ... this could generally cause problems. 

Fortunately as far as I know the size of the Java types is usually way bigger 
than the one of the PLC types. 



In case of the Int: The Siemens S7 Int datatypes is two bytes and the Java 
Integer is a 32 bit integer, therefore we don't have to confuse our users with 
any type problems.

If however a PLC would use 32 bit integers we would be having problems. In this 
case we would have to use the next smaller datatype that fits our requested 
datatype. So in this case reading a "Java Integer" would read a "PLC Short". I 
wouldn't like to have the user have to think of the PLC datatypes when writing 
his code. 





Chris



Am 02.08.18, 11:17 schrieb "Julian Feinauer" <j.feina...@pragmaticminds.de>:



    Hey all,

    

    

    again me with another question : )

    

    

    I started going through some examples on our PLC and came to a situation 
where we use signed and unsigned values in the PLC.

    

    This goes kind of back to my type system question.

    

    How could I tell the Reader to read me an Unsigned Int from a S7 (Usigned 
Int refers in this case to a two byte value on the PLC but return type had to 
be Int in Java).

    

    Is there some mechanism in Place to be able to do such a Thing?

    

    

    Or if not, do you have any ideas already in mind how one could introduce 
this (technically it's clear but how to give the information that we want our 
expected int to be read and interpreted as 2 byte unsigned)?

    

    

    Best

    

    Julian

    


Reply via email to