Omerdf34 Posted April 29, 2021 Report Share Posted April 29, 2021 Hi, I am using US7-B5-TR22 and the UniLogic program. In the ladder diagram , i am trying to use bits manipulation on information i read from a Modbus Slave. The information i read is a 16 BITS long and according to the slave component's datasheet i should divide the 16 bits information into 4 nibbles (4 bits each) by some bits manipulations . Every nibble contains a different type of alarm For example : If i receive the following information : 1110 0010 0011 0001 the MSB nibble is : emergency stop alarm. the second nibble is : Low Oil Level the third nibble is : High Coolant Temperature. The LSB nibble is : Low Coolant Temperature. So let's say that i would like to check the Low Oil level alarm's status, Therefore , according to the datasheet , i should Right Shift Register by 8 and then multiple the result by a 16 bits mask. which supposed to be : 0000 0000 0000 1111. As i'm new to UniLogic i need a little help on how to perform those manipulations in the ladder diagram. Thanks in advance. Link to comment Share on other sites More sharing options...
dierkens Posted April 29, 2021 Report Share Posted April 29, 2021 2 hours ago, Omerdf34 said: Hi, I am using US7-B5-TR22 and the UniLogic program. In the ladder diagram , i am trying to use bits manipulation on information i read from a Modbus Slave. The information i read is a 16 BITS long and according to the slave component's datasheet i should divide the 16 bits information into 4 nibbles (4 bits each) by some bits manipulations . Every nibble contains a different type of alarm For example : If i receive the following information : 1110 0010 0011 0001 the MSB nibble is : emergency stop alarm. the second nibble is : Low Oil Level the third nibble is : High Coolant Temperature. The LSB nibble is : Low Coolant Temperature. So let's say that i would like to check the Low Oil level alarm's status, Therefore , according to the datasheet , i should Right Shift Register by 8 and then multiple the result by a 16 bits mask. which supposed to be : 0000 0000 0000 1111. As i'm new to UniLogic i need a little help on how to perform those manipulations in the ladder diagram. Thanks in advance. Can’t you just read those as individual coils without doing any bit manipulation? Use Modscan to read it as coils and see if you can figure it out from there. Link to comment Share on other sites More sharing options...
Gabriel Franco Posted April 29, 2021 Report Share Posted April 29, 2021 There are two functions you can use: Test Bit (to test specific bit on an integer tag) and Num To Bits, to convert integer to bits. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now