Jump to content

Reset TYPE bit


AjaS

Recommended Posts

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

  • MVP 2023
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

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).

image.png

Link to comment
Share on other sites

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.

image.png.3881fb9f38c800f3d1aa7e318692a54e.png

image.png.699241d6550b0265c9b023518036eda2.png

image.png.b329ebccdb650485503b184e2ddffd15.png

 

Ignore the image below it won't let me remove it from the post.

 

 

 

image.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.