<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Visu input element control via POU</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4a6b7627fc/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4a6b7627fc/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4a6b7627fc/</id><updated>2020-06-17T05:22:10.148000Z</updated><subtitle>Recent posts to Visu input element control via POU</subtitle><entry><title>Visu input element control via POU</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4a6b7627fc/?limit=25#894a" rel="alternate"/><published>2020-06-17T05:22:10.148000Z</published><updated>2020-06-17T05:22:10.148000Z</updated><author><name>alexey</name><uri>https://forge.codesys.com/u/alexey/</uri></author><id>https://forge.codesys.com859a96ddc43abdd4710d59314188dd0ce59a513b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;PROGRAM VISU&lt;br/&gt;
VAR_IN_OUT&lt;br/&gt;
    SYNC: ST_SYNC;&lt;br/&gt;
    IO: ST_IO;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;VAR&lt;br/&gt;
    sIdentifier: STRING;&lt;br/&gt;
    sIdentifierBuffer: STRING;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;fbBlink&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BLINK&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;POINTER&lt;/span&gt; &lt;span class="n"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;bCharacter&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;usiCharacter&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;USINT&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;usiBuffer&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;USINT&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;*)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Joystick mapping:&lt;br/&gt;
Left: Move character left&lt;br/&gt;
Right: Move character right&lt;br/&gt;
Up: Increment character&lt;br/&gt;
Down: Decrement character&lt;br/&gt;
Ok: Confirm &lt;/em&gt;)&lt;br/&gt;
;&lt;/p&gt;
&lt;p&gt;IF IO.DISPLAY.BUTTON_LEFT.xRisingTrigger THEN&lt;br/&gt;
    (&lt;em&gt; Move character left during character display &lt;/em&gt;)&lt;br/&gt;
    usiCharacter := LIMIT(1, usiCharacter - 1, usiIdentifierLength);&lt;/p&gt;
&lt;p&gt;ELSIF IO.DISPLAY.BUTTON_RIGHT.xRisingTrigger THEN&lt;br/&gt;
    (&lt;em&gt; Move character right during character display &lt;/em&gt;)&lt;br/&gt;
    usiCharacter := LIMIT(1, usiCharacter + 1, usiIdentifierLength);&lt;/p&gt;
&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Getting pointer to identifier &lt;/em&gt;)&lt;br/&gt;
pCharacter := ADR(SYNC.LOGGER.sIdentifier);&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Increment pointer to identifier's character &lt;/em&gt;)&lt;br/&gt;
FOR usiBuffer := 1 TO (usiCharacter - 1) DO&lt;br/&gt;
    pCharacter := pCharacter + 1;&lt;/p&gt;
&lt;p&gt;END_FOR&lt;/p&gt;
&lt;p&gt;IF IO.DISPLAY.BUTTON_DOWN.xRisingTrigger THEN&lt;br/&gt;
    (&lt;em&gt; Decrement '_' to 'Z' to 'A' to '9' to '0' &lt;/em&gt;)&lt;br/&gt;
    CASE pCharacter^ OF&lt;br/&gt;
        16#5B..16#7F: pCharacter^ := 16#5A;&lt;br/&gt;
        16#42..16#5A: pCharacter^ := pCharacter^ - 1;&lt;br/&gt;
        16#3A..16#41: pCharacter^ := 16#39;&lt;br/&gt;
        16#31..16#39: pCharacter^ := pCharacter^ - 1;&lt;br/&gt;
        16#00..16#30: pCharacter^ := 16#30;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;END_CASE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;ELSIF IO.DISPLAY.BUTTON_UP.xRisingTrigger THEN&lt;br/&gt;
    (&lt;em&gt; Increment '0' to '9' to 'A' to 'Z' to '_' &lt;/em&gt;)&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;CASE&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt;
    &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;00&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;2F&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;30&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;30&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;38&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;39&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;40&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;41&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;41&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;59&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;5A&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;7F&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;pCharacter&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;16&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nn"&gt;5F&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;END_CASE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Buffer identifier &lt;/em&gt;)&lt;br/&gt;
sIdentifierBuffer := SYNC.LOGGER.sIdentifier;&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Getting pointer to identifier &lt;/em&gt;)&lt;br/&gt;
pCharacter := ADR(sIdentifierBuffer);&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Increment pointer to identifier's character &lt;/em&gt;)&lt;br/&gt;
FOR usiBuffer := 1 TO (usiCharacter - 1) DO&lt;br/&gt;
    pCharacter := pCharacter + 1;&lt;/p&gt;
&lt;p&gt;END_FOR&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Replacing existing character with '_' (underscore) character &lt;/em&gt;)&lt;br/&gt;
pCharacter^ := 16#5F;&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Underscore or Character blink &lt;/em&gt;)&lt;br/&gt;
fbBLINK(ENABLE := TRUE, TIMELOW := T#500ms, TIMEHIGH := T#1s);&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; Local visualization variables. Unfortunatly Codesys 2.3 visualization could not handle VAR_IN_OUT type variable.&lt;br/&gt;
To consolidate all HMI control in one place we have to create local copies of some SYNC variables &lt;/em&gt;)&lt;br/&gt;
sIdentifier := SEL(fbBLINK.OUT, sIdentifierBuffer, SYNC.LOGGER.sIdentifier);&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Visu input element control via POU</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4a6b7627fc/?limit=25#87ef" rel="alternate"/><published>2020-02-27T21:01:07.905000Z</published><updated>2020-02-27T21:01:07.905000Z</updated><author><name>jeffersonhui</name><uri>https://forge.codesys.com/u/jeffersonhui/</uri></author><id>https://forge.codesys.comef2ce80a22c1c926aec92b9f6f8ac7c39a2ed52c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Bumping this. Does anyone know if this is possible?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Visu input element control via POU</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4a6b7627fc/?limit=25#86ef" rel="alternate"/><published>2020-02-27T21:01:06.481000Z</published><updated>2020-02-27T21:01:06.481000Z</updated><author><name>Lowe</name><uri>https://forge.codesys.com/u/lowe/</uri></author><id>https://forge.codesys.com505c41eb5c20adddf6362538f2a374b00ca0c29c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;john_hedges_ifm hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi All,&lt;br/&gt;
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. &lt;br/&gt;
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?&lt;br/&gt;
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.&lt;br/&gt;
Any help would be much appreciated! &lt;br/&gt;
Best regards,&lt;br/&gt;
John&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I also need help with this, any help is highly appreciated&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;br/&gt;
Regards,&lt;br/&gt;
Lowe&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Visu input element control via POU</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4a6b7627fc/?limit=25#ba6c" rel="alternate"/><published>2020-02-27T21:01:02.359000Z</published><updated>2020-02-27T21:01:02.359000Z</updated><author><name>john-hedges-ifm</name><uri>https://forge.codesys.com/u/john-hedges-ifm/</uri></author><id>https://forge.codesys.com614307e09bf7ca18a993b202c4a01119b0ec7f14</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;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. &lt;/p&gt;
&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Any help would be much appreciated!   &lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;John&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>