Showing results 1 to 8 of 8

Thread: UP/Down Button to increment/decrement PLC variable

  1. #1
    mattsd Gast

    Default UP/Down Button to increment/decrement PLC variable

    Hello,

    In my Zenon application, this is what I am trying to do (if it is possible):-

    I would like to have an 'up' and 'down' push button. When the up button is pressed, zenon will increment the value of the the Beckhoff Twincat PLC value, when the down button is pressed, this same variable will be decremented.

    Ie PLC value 'position' is displayed as 50%, 3 presses of the 'up' button and 53% will be sent to the PLC, then if 1 press of the 'down' button, then 52% will be sent to the PLC.

    I can't find a way of doing this but I will need a formula for the logic:-

    IF UP THEN
    position := position + 1
    END_IF

    IF DOWN THEN
    position := position - 1
    END_IF

    Is this possible?

    Thanks

    Matt

  2. #2
    sebastiank Gast

    Default Re: UP/Down Button to increment/decrement PLC variable

    You can create a send value to hardware function. In this function you select purpose current value and then you can type in the value in the change by box.
    for incrementing 1, for decrementing -1.

    Click image for larger version

Name:	ScreenShot017.jpg
Views:	77
Size:	122.7 KB
ID:	53

  3. #3
    mattsd Gast

    Default Re: UP/Down Button to increment/decrement PLC variable

    Thanks sebastiank,

    the only thing I am finding is that it counts up very slow, I can't press the button quicker that one every second therefore if the user wants to ramp from 50 to 75 % it will take +25 seconds.

    If I press the up button 10 times within a few seconds, it will only count up 2. Is there anyway of using an up/down button to do this but quicker response?

    Thanks

    Matt

  4. #4
    mattsd Gast

    Default Re: UP/Down Button to increment/decrement PLC variable

    Made the variable update rate to fastest, this makes the speed acceptable so please ignore last post.

    Regards

    Matt

  5. #5
    sebastiank Gast

    Default Re: UP/Down Button to increment/decrement PLC variable

    Quote Originally Posted by mattsd View Post
    Made the variable update rate to fastest, this makes the speed acceptable so please ignore last post.

    Regards

    Matt
    Hi Matt,

    Thanks,

    Please be aware, that if you update many variables too fast, if will affect the runtime functionality, especially the processor load.

  6. #6

    Default Re: UP/Down Button to increment/decrement PLC variable

    Hello Mat

    Can you write a bit more where is possible to find possibility to create a send value to hardware function. In my Zenon function configuration it is only possible to add type of function (write set value, screen switch, driver commands etc) .

    With regards Satyngar
    Last edited by satyngar : 9th July 2014 at 09:43 Reason: add info

  7. #7
    Join Date
    20.08.2009
    Posts
    293

    Default Re: UP/Down Button to increment/decrement PLC variable

    Quote Originally Posted by satyngar View Post
    Hello Mat

    Can you write a bit more where is possible to find possibility to create a send value to hardware function. In my Zenon function configuration it is only possible to add type of function (write set value, screen switch, driver commands etc) .

    With regards Satyngar
    Hi,

    create a new Function -> Set Value -> Chose Variable -> Chose value/operation, Enable checkbox "Send directly to Hardware"

    Regards,
    Bernhard

  8. #8

    Default Re: UP/Down Button to increment/decrement PLC variable

    Thank you for your answer Bernhard.

    But in this case button became fixed. ( if I choose Tongle ) it is needed to push it twice to make 1 and 0 after. Is it any way to make it unfixed so I can work as usual button ( send 1 only when it is pressed )

    With regards

Similar Threads

  1. Replies: 0
    Last Post: 20th August 2007, 14:00

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •