Roman85 Posted October 29, 2017 Report Share Posted October 29, 2017 Hello, I'm using Combo Box in my HMI. My Combo Box has 16 options and the user choice is stored in a tag name "Select_Valve" (of type INT8). I want to convert the value of "Select_Valve" to binary type. In the end, I want to open one of the values according to the user selection using "UID_0016 -> Outputs_0:Outputs3" Thank You! Quote Link to comment Share on other sites More sharing options...
Saragani Posted October 29, 2017 Report Share Posted October 29, 2017 There is a Ladder Element called Num to Bits, which should take a number and convert it to bits. For example, I took an Int8 and used the Num to Bits elements with a bits array of size of 4 (0 to 3), and it behaves as you've would expect (value 0 gets 0 on all bits, and value 15 gets 1 in all bits). One note though, when I've outputed the result to the UID-0016 outputs, all the bits were reset (oven ones that are not from 0 to 3). If you don't want that behavior, when you can use a bits array with size 4, and then copy the array (with Copy array part to array) to the outputs Quote Link to comment Share on other sites More sharing options...
Roman85 Posted October 29, 2017 Author Report Share Posted October 29, 2017 Thank you, 1. Num to Bits works 2. How to work with 'Copy array Part to array'? I made a bits array size 4 (Valve_Selction), but I can't copy directly to the output of UID-0016. Quote Link to comment Share on other sites More sharing options...
Saragani Posted October 29, 2017 Report Share Posted October 29, 2017 A = source array b = 0 (offset) c = 4 (length) d = outputs This worked for me. (i might be mixing the order of b and c. I don't have unilogic in the computer i'm replying from) Quote Link to comment Share on other sites More sharing options...
Roman85 Posted October 29, 2017 Author Report Share Posted October 29, 2017 Thank you It's working! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.