Hello
I need to detect a page change in my project , I have a lot of pages and buttons that change page with a "change shown visualization" event. I know there is a sys variabile "VisuElems.CURRENTVISU" where I can see the current page , but i need to start a timer since the last page change and I need something that tell me if there was one page change.. or something that save the last VisuElems.CURRENTVISU value. I want precise that in my code i set VisuElems.CURRENTVISU for 3 pages/10.
If you can help me will be appreciated.
Hello,
If you want to knows each page change, you can write something like that :
PROGRAM PLC_PRG
VAR
stMem_Page_Visu:STRING; (To memorize the name of the last page)
iCompteur:INT; (Only to test th program)
END_VAR
(Program)
(If the current page is different from the last page, you do what you want to do ...)
IF VisuElems.CURRENTVISU<>stMem_Page_Visu THEN
iCompteur:=iCompteur+1; (In this example I add 1 in a counter)
END_IF
...
(Here you can have some other parts of you program)
...
(At the end, you memorize the name of the last page, in order to test it on the beginning of the program)
stMem_Page_Visu:=VisuElems.CURRENTVISU;
I used the program PLC_PRG to test my idea, but you can use another program module name.
BR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you JAPIB but did you try it?
i think in 1 program cicle is difficult to intercept the new page , but i will try it !
My visu task is low speed respect the main program.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello FabioPD,
Before posting this idea, I tested it in a standard configuration and it works.
What is a standard configuration, for me :
- Periodic MainTask 20 ms calling PLC_PRG
- Periodic VISU_TASK 100 ms
- 3 visualization pages.
- Tests in simulation mode and with CODESYS Soft PLC.
- Target visualization and Web visualization.
BR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I need to detect a page change in my project , I have a lot of pages and buttons that change page with a "change shown visualization" event. I know there is a sys variabile "VisuElems.CURRENTVISU" where I can see the current page , but i need to start a timer since the last page change and I need something that tell me if there was one page change.. or something that save the last VisuElems.CURRENTVISU value. I want precise that in my code i set VisuElems.CURRENTVISU for 3 pages/10.
If you can help me will be appreciated.
Hello,
If you want to knows each page change, you can write something like that :
PROGRAM PLC_PRG
VAR
stMem_Page_Visu:STRING; (To memorize the name of the last page)
iCompteur:INT; (Only to test th program)
END_VAR
(Program)
(If the current page is different from the last page, you do what you want to do ...)
IF VisuElems.CURRENTVISU<>stMem_Page_Visu THEN
iCompteur:=iCompteur+1; (In this example I add 1 in a counter)
END_IF
...
(Here you can have some other parts of you program)
...
(At the end, you memorize the name of the last page, in order to test it on the beginning of the program)
stMem_Page_Visu:=VisuElems.CURRENTVISU;
I used the program PLC_PRG to test my idea, but you can use another program module name.
BR
Thank you JAPIB but did you try it?
i think in 1 program cicle is difficult to intercept the new page , but i will try it !
My visu task is low speed respect the main program.
Hello FabioPD,
Before posting this idea, I tested it in a standard configuration and it works.
What is a standard configuration, for me :
- Periodic MainTask 20 ms calling PLC_PRG
- Periodic VISU_TASK 100 ms
- 3 visualization pages.
- Tests in simulation mode and with CODESYS Soft PLC.
- Target visualization and Web visualization.
BR
Thank you very much it works fine!! good job