RobWad Member R Join Date Jun 2012 Location Muskegon Posts 27 Dec 1, 2020 #1 Can someone explain to me the AND-16, and the AND 15 part of this indirect addressing? Thank you for any input. B18[(N57_34 AND -16)/16].[N57_34 AND 15]
Can someone explain to me the AND-16, and the AND 15 part of this indirect addressing? Thank you for any input. B18[(N57_34 AND -16)/16].[N57_34 AND 15]
rdrast Lifetime Supporting Member Join Date Apr 2003 Location South Carolina Lowcountry Posts 5,544 Dec 1, 2020 #2 They are masks. 15 = 0000 0000 0000 1111 -16 = 1111 1111 1111 0000 In one case, looking at only the low 4 bits of the word, in the other case, looking at only the high 12 bits of the word.
They are masks. 15 = 0000 0000 0000 1111 -16 = 1111 1111 1111 0000 In one case, looking at only the low 4 bits of the word, in the other case, looking at only the high 12 bits of the word.
RobWad Member OP R Join Date Jun 2012 Location Muskegon Posts 27 Dec 1, 2020 #3 Ahh thank you. It makes sense now. lol. This particular program was converted from a plc5 using the converter. Indirect logic is done differently in studio 5000 compared to the ole plc5 days. Thanks again.
Ahh thank you. It makes sense now. lol. This particular program was converted from a plc5 using the converter. Indirect logic is done differently in studio 5000 compared to the ole plc5 days. Thanks again.
drbitboy Lifetime Supporting Member Join Date Dec 2019 Location Rochester, NY Posts 8,146 Dec 1, 2020 #4 RobWad said: Can someone explain to me the AND-16, and the AND 15 part of this indirect addressing? Thank you for any input. B18[(N57_34 AND -16)/16].[N57_34 AND 15] Click to expand... Sidebar: in some environments (e.g. MicroLogix 1xxx/RSLogix 500), that is equivalent to Code: B18[0].[N57_34] OR B18[0].[N57_34 AND 2147483647] Also, the -16 should be positive and at most 2147482632 (0111 1111 1111 0000), because I doubt B18 has 16Melements, or even 8Melements. Dividing a negative number, which is what N57_34 will be if its MSBit is 1, by 16 will cause a fault, I think.
RobWad said: Can someone explain to me the AND-16, and the AND 15 part of this indirect addressing? Thank you for any input. B18[(N57_34 AND -16)/16].[N57_34 AND 15] Click to expand... Sidebar: in some environments (e.g. MicroLogix 1xxx/RSLogix 500), that is equivalent to Code: B18[0].[N57_34] OR B18[0].[N57_34 AND 2147483647] Also, the -16 should be positive and at most 2147482632 (0111 1111 1111 0000), because I doubt B18 has 16Melements, or even 8Melements. Dividing a negative number, which is what N57_34 will be if its MSBit is 1, by 16 will cause a fault, I think.