AjaS Posted June 7, 2019 Report Share Posted June 7, 2019 Hi all, I have button on the screen. When touched, one out of many actions is to set certain bit high in logic to enable rung (if button is not touched, the rung does not perform anything). The rung works nice and perform everything as expected, except for the enable bit stays 'set'. The function 'reset bit' is only for integers. I do not want to use entire integer to enable/disable rung. If used integer to enable rung, the action from HMI can be increment/decrement only, therefore I would have to put there two conditions :equal-less 0 then store 0 and equal-greater 1 as conditions then store 1, to actually stay in 0-1 range. Or is it possible to access integers that are used for data types 'bit', then I could use the premade function reset bit (in integer) like mask byte in assembler. Does anyone have any better idea how to do it, please? Thanks Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted June 7, 2019 MVP 2023 Report Share Posted June 7, 2019 Having difficulty understanding what you're trying to do. Can you post your code? Link to comment Share on other sites More sharing options...
Gabriel Franco Posted June 7, 2019 Report Share Posted June 7, 2019 In ladder, use RESET COIL to reset the bit you use in HMI button Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted June 7, 2019 MVP 2023 Report Share Posted June 7, 2019 1 hour ago, Gabriel Franco said: In ladder, use RESET COIL to reset the bit you use in HMI button Better to use the "Release" function of the HMI button to reset the bit. Link to comment Share on other sites More sharing options...
Saragani Posted June 7, 2019 Report Share Posted June 7, 2019 Not if you want the action to perform only once per button press. Resetting the bit on release would keep the bit set for many cycles. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted June 7, 2019 MVP 2023 Report Share Posted June 7, 2019 2 hours ago, Saragani said: Not if you want the action to perform only once per button press. Resetting the bit on release would keep the bit set for many cycles. You're right of course, but that's what the positive transition contact is for. Link to comment Share on other sites More sharing options...
AjaS Posted June 10, 2019 Author Report Share Posted June 10, 2019 On 6/8/2019 at 1:13 AM, Gabriel Franco said: In ladder, use RESET COIL to reset the bit you use in HMI button I have done this. it became infinite reset/set status Link to comment Share on other sites More sharing options...
AjaS Posted June 10, 2019 Author Report Share Posted June 10, 2019 There is button on HMI having two states:0 enable, 1 disable depending on current state of the device. (If text window says 'Device enabled', the button says 'Disable' that's why 'Disable' correspond to 1 as current state of the device). This button regardless of its status trigger high UserInput if pressed to power the rung. The second action of this HMI button when it is pressed, is to set x high if button says enable, then store 1 or reset x if push button says disable and store 0. Then compare current state of the device with user input. If they are different, write to table (the condition not equal is probably unnecessary). Link to comment Share on other sites More sharing options...
Cam Posted June 10, 2019 Report Share Posted June 10, 2019 I'm confused is the button action linked to triggering UserInput? or RangeCheckDone?? and what does the action collection for the button look like(do you have more than one??) If the UserInput is the HMI button it more than likely should be a postive transition contact so that it only executes once on the rising edge no matter how long the button is held. here's an example from a different program we did. Ignore the image below it won't let me remove it from the post. 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