7/30/2009 1:37 AM | |
Joined: 12/20/2008 Last visit: 8/12/2024 Posts: 556 Rating: (236) |
I have a compare instruction CMP 1- DB10.W0 CMP2- L# -1 What is L# -1? ( What type of memory area L is?) |
7/30/2009 2:02 AM | |
Joined: 10/7/2005 Last visit: 11/18/2024 Posts: 3027 Rating: (1057) |
Hello lalit it is NOT a memory area but rather a nomination of a DINTvalue (L = Long Integer). Attached is the overview of elementary Data types and where to find it in the S7 inbuilt help. |
Cheers |
|
This contribution was helpful to1 thankful Users |
7/30/2009 7:04 AM | |
Posts: 2348 Rating: (264) |
Very good example for understanding: add -1 to 100 000. Try this code and see the result:^) L 100 000 L -1 +D |
8/2/2009 1:23 AM | |
Joined: 10/7/2005 Last visit: 11/18/2024 Posts: 3027 Rating: (1057) |
Itis indeed lalit Negative Intergers are formed by the so called "Two complement" method which simplyinverts all bits of an (D)INT and then adds 1 to it. The alternative method is to start at the LSB, copy all bitsup to and including the first "1" and invert all remaining bits. Google "Two complement" and you'll get plenty more detaileddescription on this subject. I hope this helps |
Cheers |
|
This contribution was helpful to1 thankful Users |
8/3/2009 6:59 AM | |
Posts: 2348 Rating: (264) |
-1 = 2^16 -1 // FFFF L#-1 = 2^32 -1 //FFFF FFFF |
Follow us on