5/30/2010 6:44 PM | |
Posts: 20 Rating:
|
I have got two QW. QW 260 and QW 262. I want those values to be converted in one dword. Thank you. |
5/31/2010 8:53 AM | |
Joined: 2/6/2009 Last visit: 9/20/2023 Posts: 937 Rating:
|
Dearelmucho, I thing you don't want to take the value'sdirectlyas QD, because you don't want to lose same data for theconversion. The only way to solve your issue is to convert your two words to a 32 bit value (Real / DINT) and transfer to atemporary location. Add those two temp variable. Finally after the addition move the final result to a Double word location. For Ex: L QW 260 ITD T TEMP_1 //Double Integer L QW 262 ITD T TEMP_2 //Double Interger L TEMP_1 L TEMP_2 +D T TEMP_3 //Double Interger L TEMP_3 T OUTPUT //Double Word If you want to have
|
_______________________________________________________________ |
|
This contribution was helpful to
1 thankful Users |
5/31/2010 8:57 AM | |
Joined: 3/21/2006 Last visit: 7/12/2023 Posts: 10221 Rating:
|
Hello Saravana, Is it possible to attach here this example? Best regards, Hristo Mihalev |
5/31/2010 9:21 AM | |
Joined: 3/24/2009 Last visit: 6/20/2023 Posts: 535 Rating:
|
Dear Saravana, if you access the QD directly, you don't have to use the convertion. So I think, that no data will be lost. But as dchartier said, the requirement is not completely clear. Best regards, yy1 |
5/31/2010 7:20 PM | |
Joined: 2/6/2009 Last visit: 9/20/2023 Posts: 937 Rating:
|
Dearyy1, The reason why I am telling data lose if we consider as QD is, >In our Siemens PLC's all integer values are Signed values.We cannot get Unsigned Integer. > That means if the input value is unsigned integer (0 to 65536) and in our PLC it is Signed Value (-32767 to 32767). > For Example, if the integer value what we receive is 40000 means, our PLC will show -25536 (65536-40000). > For Example: Input 1 = 30000, and Input 2 = 40000 and we need to add inputs. Without Conversion With Conversion = Input 1 + Input 2 = Input 1 + Input 2 = 30000 + (-25536) = 30000 + 40000 = 4464 = 70000 > I think now you understood the actual requirement for convertion. > These kind of conversion are very useful in communications between other devices such as Sinamics, Drivers Modbus, OPC, and IEC Etc. |
_______________________________________________________________ |
|
This contribution was helpful to
2 thankful Users |
5/31/2010 7:27 PM | |
Joined: 2/6/2009 Last visit: 9/20/2023 Posts: 937 Rating:
|
DearUMENCHO, The formula to convert "Signed integer to Unsigned Real" what I derived is shown as below, *If Value is negative (i.e input =< 0) Output = 65536 - 2s complement of input *if Value is positive (i.e input > 0) Output = input *If Value is equal to 32768 Output = 32768 Please revert me back for any clarifications.
|
_______________________________________________________________ |
|
This contribution was helpful to
3 thankful Users |
5/31/2010 7:40 PM | |
Joined: 3/24/2009 Last visit: 6/20/2023 Posts: 535 Rating:
|
Dear Saravana kumar, you are completely right, if there are 2 signed values, which should be added. When I understand the posting of elmucho right, there is a WORD, which is usually handled as unsigned (but I'm not so familiar with Sinamics Best regards, yy1 |
Follow us on