I did a project in Vision that controlled a PLC that could work in both auto and manual modes. For the next button implementation (during manual operation) in Vision, I used a momentary switch. I want to work on the same project in Perspective but I'm having a hard time figuring out how to implement the operation of the next button in perspective. I will highly appreciate detailed guidance on how to go about it.
There's a reason there's no built-in momentary button. It's been discussed countless times:
Try and get the habit of using the search tool before asking something that's been answered before, you'll find information faster, and we won't have to repeat what's been said already.
It's not clear to me what the next button does. Is it truly a jog button? ...because that's what we're imagining when we read momentary switch, and it's the jog button that's problematic to use from a web browser.
Each time the button is pressed, counter value (CTU) increases leading to the activation of the next step of a a sequential operation.
Maybe a bit risky if using perspective. Your browser deciding to crash etc. while running these operations isn't an insignificant risk
How many steps are there on average, would it be a terrible idea to just have a button incremement by one each time it's pressed?
There are approximately 28 steps. My aim was to bind the button to that PLC tag so that the CTU can do the count. I have no idea how to increment the value with a button then pass it to the PLC.
Use a simple integer tag instead of a counter. Subscribe to that tag in Ignition (drag it from the OPC browser, whatever). You probably want it anyways to display what state you are in.
In your button, bidirectionally bind that tag to a custom property. Then you can do arithmetic and/or assign to it in scripts with natural syntax. In Perspective, your button's action performed event script would look like this:
def ..... self.custom.someProp += 1
In Vision, like this:
event.source.someProp += 1
You should also bind your button's enable property so that it cannot act when the sequence is complete or interlocks have it on hold.
That doesn't sound like a reason to need a momentary button, just use a regular button. Let the PLC reset the command sent from the HMI.
I think the point of a momentary button would be if you need to halt the operation at a moments notice by releasing your finger, which in something like a browser isn't very reliable.
Hence either increment like Phil suggests with a button, or just have a start operation and stop operation button and let the PLC do the heavy lifting