Visu input element control via POU

2019-02-12
2020-06-17
  • john-hedges-ifm

    john-hedges-ifm - 2019-02-12

    Hi All,

    I have a screen from ifm Electronic that is a target for visualisation, but is not touchscreen. It has buttons and a click wheel which can be utilised easily for page navigation etc.

    What I would like to do is map the click wheel variables (16 pulses per revolution + push) to a keypad or numpad so that the user can easily scroll over keys and numbers to enter values and strings etc without the need for a touch display. Until now my customers have been making their own numpads/keyboards which is very tedious! Is there an easy way to link variables to visu input elements in this way?

    When using visu on PC, keyboard shortcuts are available by default to navigate and control visu input objects for entering text or numbers. Using the TAB key whilst the numpad is open scrolls past each button so that the user doesn't have to use a mouse for input. I want to be able to replicate this type of control with my screen's click wheel/buttons.

    Any help would be much appreciated!

    Best regards,

    John

     
  • Lowe

    Lowe - 2019-05-21

    john_hedges_ifm hat geschrieben:
    Hi All,
    I have a screen from ifm Electronic that is a target for visualisation, but is not touchscreen. It has buttons and a click wheel which can be utilised easily for page navigation etc.
    What I would like to do is map the click wheel variables (16 pulses per revolution + push) to a keypad or numpad so that the user can easily scroll over keys and numbers to enter values and strings etc without the need for a touch display. Until now my customers have been making their own numpads/keyboards which is very tedious! Is there an easy way to link variables to visu input elements in this way?
    When using visu on PC, keyboard shortcuts are available by default to navigate and control visu input objects for entering text or numbers. Using the TAB key whilst the numpad is open scrolls past each button so that the user doesn't have to use a mouse for input. I want to be able to replicate this type of control with my screen's click wheel/buttons.
    Any help would be much appreciated!
    Best regards,
    John

    I also need help with this, any help is highly appreciated

    Thanks in advance.
    Regards,
    Lowe

     
  • jeffersonhui

    jeffersonhui - 2020-02-11

    Bumping this. Does anyone know if this is possible?

    Thanks!

     
  • alexey

    alexey - 2020-06-17

    Yes its possible with pointers. See code example below. This was done for IFM basic screen and example is using left and right arrow keys to move across STRING line and up and down keys to increment/decrement single character. Bottom part of the code blinks between '_' and entered symbol to give user some sort of idea which character of string is located on.

    PROGRAM VISU
    VAR_IN_OUT
    SYNC: ST_SYNC;
    IO: ST_IO;
    END_VAR

    VAR
    sIdentifier: STRING;
    sIdentifierBuffer: STRING;

    fbBlink: BLINK;
    pCharacter: POINTER TO BYTE;
    bCharacter: BYTE;
    usiCharacter: USINT := 1;
    usiBuffer: USINT := 1; *)
    

    END_VAR

    ( Joystick mapping:
    Left: Move character left
    Right: Move character right
    Up: Increment character
    Down: Decrement character
    Ok: Confirm
    )
    ;

    IF IO.DISPLAY.BUTTON_LEFT.xRisingTrigger THEN
    ( Move character left during character display )
    usiCharacter := LIMIT(1, usiCharacter - 1, usiIdentifierLength);

    ELSIF IO.DISPLAY.BUTTON_RIGHT.xRisingTrigger THEN
    ( Move character right during character display )
    usiCharacter := LIMIT(1, usiCharacter + 1, usiIdentifierLength);

    END_IF

    ( Getting pointer to identifier )
    pCharacter := ADR(SYNC.LOGGER.sIdentifier);

    ( Increment pointer to identifier's character )
    FOR usiBuffer := 1 TO (usiCharacter - 1) DO
    pCharacter := pCharacter + 1;

    END_FOR

    IF IO.DISPLAY.BUTTON_DOWN.xRisingTrigger THEN
    ( Decrement '_' to 'Z' to 'A' to '9' to '0' )
    CASE pCharacter^ OF
    16#5B..16#7F: pCharacter^ := 16#5A;
    16#42..16#5A: pCharacter^ := pCharacter^ - 1;
    16#3A..16#41: pCharacter^ := 16#39;
    16#31..16#39: pCharacter^ := pCharacter^ - 1;
    16#00..16#30: pCharacter^ := 16#30;

    END_CASE
    

    ELSIF IO.DISPLAY.BUTTON_UP.xRisingTrigger THEN
    ( Increment '0' to '9' to 'A' to 'Z' to '_' )

    CASE pCharacter^ OF
        16#00..16#2F: pCharacter^ := 16#30;
        16#30..16#38: pCharacter^ := pCharacter^ + 1;
        16#39..16#40: pCharacter^ := 16#41;
        16#41..16#59: pCharacter^ := pCharacter^ + 1;
        16#5A..16#7F: pCharacter^ := 16#5F;
    
    END_CASE
    

    END_IF

    ( Buffer identifier )
    sIdentifierBuffer := SYNC.LOGGER.sIdentifier;

    ( Getting pointer to identifier )
    pCharacter := ADR(sIdentifierBuffer);

    ( Increment pointer to identifier's character )
    FOR usiBuffer := 1 TO (usiCharacter - 1) DO
    pCharacter := pCharacter + 1;

    END_FOR

    ( Replacing existing character with '_' (underscore) character )
    pCharacter^ := 16#5F;

    ( Underscore or Character blink )
    fbBLINK(ENABLE := TRUE, TIMELOW := T#500ms, TIMEHIGH := T#1s);

    ( Local visualization variables. Unfortunatly Codesys 2.3 visualization could not handle VAR_IN_OUT type variable.
    To consolidate all HMI control in one place we have to create local copies of some SYNC variables
    )
    sIdentifier := SEL(fbBLINK.OUT, sIdentifierBuffer, SYNC.LOGGER.sIdentifier);

     

Log in to post a comment.