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.
If you want to knows each page change, you can write something like that :
stMem_Page_Visu:STRING; (To memorize the name of the last page)
iCompteur:INT; (Only to test th 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)
(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)
I used the program PLC_PRG to test my idea, but you can use another program module name.
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.
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.
Thank you very much it works fine!! good job
Log in to post a comment.