Hi Guys,
I have a problem with reading the following HEX string into a CompactLogix PLC. The HEX string is "D852268A" which if converted to a number using UINT32 - Little Endian (DCBA) gets me the 3629262474 . Which is bigger than the 2^31 = 2147483648 which is what a DINT can take.
Now the issue is that this comes from a vehicle's GPS as the Longitude and I am supposed to multiply this number with 10^-7 then subtract 210 and that will give me the longitude. The latitude works as the number I got from the truck (the four HEX groups) are smaller than 2^31 so I can fit it into a DINT and no issues. But the Longitude and the GPS time both bigger than 2^31.
Not sure if there is something I could do ? I tried the LINT but my f/w doesn't allow Rev 32 or bigger of Logix ,where apparently, there are inbuilt instruction for LINT data types, and also other data types to handle this ? It would be nice if I could do that multiplication on the two integers which I receive before copying them into the DINT or should I try to do this on the HMI? I am running FTViewSE and maybe there is some VBA code able to do this? All I have to do with this is to display it on a screen at this stage.
Anyone came across something like this before?
So once again I receive from the truck 4 HEX groups which are 4 X SINT . The gateway which puts these into the PLC gives the data as two integers . First integer for the example above is -21059 the second is -10315. The two combined (use an online converter like https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ ) give you the 3629262474 value * 10^-7 = 362.9262474 - 210 = 152.9262474 which is the exact latitude.
Thanks for reading this and hopefully someone has an idea
I have a problem with reading the following HEX string into a CompactLogix PLC. The HEX string is "D852268A" which if converted to a number using UINT32 - Little Endian (DCBA) gets me the 3629262474 . Which is bigger than the 2^31 = 2147483648 which is what a DINT can take.
Now the issue is that this comes from a vehicle's GPS as the Longitude and I am supposed to multiply this number with 10^-7 then subtract 210 and that will give me the longitude. The latitude works as the number I got from the truck (the four HEX groups) are smaller than 2^31 so I can fit it into a DINT and no issues. But the Longitude and the GPS time both bigger than 2^31.
Not sure if there is something I could do ? I tried the LINT but my f/w doesn't allow Rev 32 or bigger of Logix ,where apparently, there are inbuilt instruction for LINT data types, and also other data types to handle this ? It would be nice if I could do that multiplication on the two integers which I receive before copying them into the DINT or should I try to do this on the HMI? I am running FTViewSE and maybe there is some VBA code able to do this? All I have to do with this is to display it on a screen at this stage.
Anyone came across something like this before?
So once again I receive from the truck 4 HEX groups which are 4 X SINT . The gateway which puts these into the PLC gives the data as two integers . First integer for the example above is -21059 the second is -10315. The two combined (use an online converter like https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ ) give you the 3629262474 value * 10^-7 = 362.9262474 - 210 = 152.9262474 which is the exact latitude.
Thanks for reading this and hopefully someone has an idea