John_R Posted July 3, 2018 Report Share Posted July 3, 2018 Hey All, I have a project I did a while back with a V570, revamping an older relay logic machine with PLC/HMI controls, and as I've done with some other retrofits I am saving runtime data in a data table which then gets retrieved using DataXport, then some Quality Control type person uses that data to document performance. On this machine, I have been asked to implement "downtime" reporting. If the machine has been off for "X" amount of time, the operator must enter the reason for the machine being down before he can start it back up. The logic of this was not too difficult, after "X" amount of time the "Start" button becomes a "Go to downtime screen" button", where the operator selects one of sixteen predefined downtime codes, then it returns to the main screen where the Start button is now the Start button. So far, so good..... Now in my logic for selecting the downtime code, I have a screen with sixteen buttons that will be labeled with their predefined codes, these buttons are assigned to a block of sixteen MB's, and I am using a Bit-to-Number function to decode which button was pressed, then storing that number fur use in my report. But, the Bit-to-Number gives me the decimal value of the binary sequence of the block of MB's; 1 2 4 8 16 32 64 128 256 and so on up to 32768 Which I can deal with, but I'd rather just give them the numbers 1-16 on their report.... Now I know I can whip up 16 lines of equal-to/store to accomplish this, but I was hoping to find cleaner/neater way of doing this. Anybody got a better way of doing this? JohnR Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted July 3, 2018 MVP 2023 Report Share Posted July 3, 2018 How about putting the button MBs into MB 1-16 then use Vector Find? A: Use SB 1 for the compare. B: MB 1 C: #16 D: MI x will have the number 1-16. Link to comment Share on other sites More sharing options...
John_R Posted July 3, 2018 Author Report Share Posted July 3, 2018 Hey, Thanks Flex....... I knew there had to be a more elegant way, I actually looked at the vector find earlier, but wasn't sure what to do with the trigger (A), I always forget about using things like SB1...... nets may be free, but it's always nice to do things in a cleaner, less cluttered way..... Regards, JohnR 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