AC450 - convert dword to real
i want to convert a dword (i am reading it from a profibus device) to real. Is that possible ? How can i do it ?
Voted best answer
How is the real value coded in the DWORD ? Is it an IEEE 754 coded floating point number ?
there are two alternatives ...
1. You can write some code to split up the DWORD bits and decode the value. This works if you have only a few values to decode, but if you have quite a bit of data, then the program becomes quite long and repetitive.
2. You can use DataSets to do the type conversion. When you Send and Receive a Data Set, there is no validation check on the data type. ( only the total size of the data set is checked ) - So you can convert pretty much any type to any other. You can convert up to 24 values in each dataset pair.
- Create a Sending and Matching Receving DataSet.
- Send the DWORD (s) that you want to convert as DAT(IL)
- Receive the result as DAT(R) real values.
The sending and recieving datasets can be in the same node.