Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

hexadecimal conversion

I am communicating with DL205/250 PLC over MODBUS. I am using 40001-49999 addressing and getting valid replies. However the data appears to be in hex. How can I convert to decimal ? Using Lookout 4.0. Thanks
0 Kudos
Message 1 of 2
(3,167 Views)
I am using Lookout 4.5. This should work with 4.0. I attached a file. The .l4p file will not work for you but you may be able to compile the script (.lks) file with a few minor modifications:

Lookout does recognize hexadecimal code as a number if it is proceeded with "0x". So here is what you do:
1) This is if you need to use the decimal value of the hex code elsewhere in your process or chart the data using a hypertrend object:
Create an expression and have it reference the source of the hex data. In the expression concatenate 0x with the source of the data: "0x"&datasource. Now, since Lookout supports data polymorphism you can connect this expression to a pot. The pot will reflect the data in a decimal format and you can use this value elsewhe
re in your process.
2) This is if you just want to display the data on a panel.
If you drag and drop the expression in 1) above it automatically evaluates to text so you must do what follows. From the insert menu select expression. In the expression reference the expression in 1) above. In the "Display Type" dropdown select numeric. Now you can see hex in decimal format without the need of a pot.

Regards,
Tommy Scharmann
Message 2 of 2
(3,167 Views)