Help - Search - Members - Calendar
Full Version: CX-Designer macro works in test mode but not in NS terminal
Forums.MrPLC.com > PLCs and Supporting Devices > Omron > CX-Designer
PdL
I have created a sheet with a button bar at the bottom.
4 Buttons open a popup page with submenus.

The popup pages are set to close when the base screen switches, which all of the other buttons on the bar do.
In the popup screens a copy of the button which opens the screen is placed at the exact same position which is set to close the popup screen, so it looks like the button toggles the popup screen.
But I also want to popup pages to close when another popup screen is opened (another one of the 3 buttons pressed) so you can cycle the 4 menus.

IPB Image

I use the following macro code in the all 4 popup screen properties set to run "when loading a screen".

CODE

'When opening this popup screen, detect if there is already a popup screen opened
'besides this screen, so which is not equal to this screen.

$W110=BIN($W1);
'convert $W1 (system memory 1st popup screen number) to decimal
$W111=BIN($W4);
'convert $W4 (system memory 2nd popup screen number) to decimal

IF ($W111 <> 10);
'if the 2nd popup screen is not this screen
CLOSEPOPW($W111);
'close the 2nd popup screen
ELSEIF ($W110 <> 10);
'if the 2nd popup screen is this screen and the 1st popup screen is not  this screen
CLOSEPOPW($W110);
'close the 1st popup screen
ENDIF;


I use the $W1 and $W4 system memory values which are the 1st and 2nd opened popup screen numbers.
Each of the 4 buttons runs the same macro, only the screen numbers which are compared differ, the number is that of the popup screen the macro belongs to.

Now in test mode it works fine, I can cycle the 4 screens by pressing the 4 buttons one by one, and only the last opened popup screen is open, the previous one is closed.

But when I download the project to my NS terminal, it doesn't consequently close the popup screen when another one is opened. Sometimes I can open 2 or 3 popup screens and the previously opened screens don't close.
I monitor the $W1 and $W4 words and they reflect the right screen numbers.

Anyone knows why it doesn't work in the hardware ? I am no coding guru so I am always doing trial and error when it comes to this but as it works in test mode I don't know where to look for the problem.
Perhaps the execution time difference between test mode and NS ?

Are there any other ways to accomplish what I want ?


scottmurphy
I may be reading what your trying to acheive wrong, but what I understand is that if a popup
screen is selected, then the popup that it was selected from will close?

If each of the popups are unique, ie. fans = screen no. 1, cond = no.2 etc, could you not just
execute the closepopw for each of the other screens when the button is pressed, and then use the showpage command to display the popup that you want?

I am no guru either, but for the amount of code that you are putting in, it may be easier and quicker to just have the command 4 times, using the actual screen no?

If I understand this correctly let me know, I can look at this more later.


PdL
Hi Scott and thanks for your reply.

QUOTE(scottmurphy @ Nov 16 2006, 09:10 AM) [snapback]43664[/snapback]
I may be reading what your trying to achieve wrong, but what I understand is that if a popup
screen is selected, then the popup that it was selected from will close?
Not really. The 4 buttons COND, AHU, FANS and ROOMS each open a similar vertical popup screen like the one in the picture. The buttons in those popup pages open other screens, so the popup page is set to close when the base screen switches. This works fine.

But for example when you press COND and the popup opens, I want it to be possible to press AHU, and following the COND popup page must close and the AHU popup page must open.

QUOTE
If each of the popups are unique, ie. fans = screen no. 1, cond = no.2 etc, could you not just
execute the closepopw for each of the other screens when the button is pressed, and then use the showpage command to display the popup that you want?

I am no guru either, but for the amount of code that you are putting in, it may be easier and quicker to just have the command 4 times, using the actual screen no?
Yes I also thought it would and should be that simple. But when putting in a code on the buttons touch on timing like this:

CODE
CLOSEPOPW(20);
CLOSEPOPW(30);
CLOSEPOPW(40);
SHOWPAGE(10);

none of the macros seem to run as nothing happens when pressing the button. Not even the SHOWPAGE command is executed.

This confused me somewhat and I tried playing around with only running the macro on one button and nothing on the others. Then I could open the 3 other screens and when pressing the button with the macro, only the first line of code seems to be executed (first popup window closes), but not the following 2 CLOSEPOPW commands and the SHOWPAGE command.

Then I tried to find another way around to do this and I agree it looks like a bit too complicated for this job but until now the only way it works. In test mode that is.... sad.gif

Attached are 2 projects. One with my code (running on the "when loading screen" condition of the popup screens), and one with the simple code (running on the buttons "touch ON timing").

Again thanks again for your help.

Pim

Zoran Mihajlovic
Which CX-D you use.I heve V1.0 and can't open it.
PdL
QUOTE(Zoran Mihajlovic @ Nov 16 2006, 12:06 PM) [snapback]43670[/snapback]
Which CX-D you use.I heve V1.0 and can't open it.


oops.gif v2.0....

If you want I can create the same project in V1.0.
Zoran Mihajlovic
Yes, please.

Zoran
PdL
Here are the test projects for CXD V1

[attachmentid=3502]
[attachmentid=3501]

And here are the test project for CXD V2

[attachmentid=3504]
[attachmentid=3505]

Aargh!!
The macro that I created which works when in test mode with CXDV2 doesn't work in V1 wacko.gif
I have recreated the same project and all options were also available in CXD V1 but somehow it doesn't work, I don't see the active popup screen numbers reflected in $W1,$W4 and $W7 although they are enabled in the system memory list they stay 0, and I am able to open all popup screens.

As expected the simple macro also doesn't work in V1.

I think I have exhausted my own resources to figure this out and will (have to) move on with building the rest of the application but if anyone has a suggestion or some other solution I would be grateful!
scottmurphy
QUOTE
, only the first line of code seems to be executed (first popup window closes), but not the following 2 CLOSEPOPW commands and the SHOWPAGE command.


I just tried this in test mode, and came to the same conclusion.

To make it simpler, you could just make it so that the popup has to be closed before another one can be loaded, this is what I have done.

Not ideal, but will save a lot of time, and if someone has to follow it later could make it tricky.


Scott
PdL
QUOTE(scottmurphy @ Nov 16 2006, 06:57 PM) [snapback]43696[/snapback]
QUOTE
, only the first line of code seems to be executed (first popup window closes), but not the following 2 CLOSEPOPW commands and the SHOWPAGE command.


I just tried this in test mode, and came to the same conclusion.

To make it simpler, you could just make it so that the popup has to be closed before another one can be loaded, this is what I have done.

Not ideal, but will save a lot of time, and if someone has to follow it later could make it tricky.


Scott


Yeah that's what I am thinking now too...
This is done relatively easy by unchecking the "enable input on other screens" setting at the popup page properties.
I just hate it when I can't understand why this or that is not working. angry.gif
ECSI
a new approach...how about just assigning PLC bits to the buttons and using @MOV to display the various screens.
PdL
QUOTE(ECSI @ Nov 16 2006, 07:08 PM) [snapback]43699[/snapback]
a new approach...how about just assigning PLC bits to the buttons and using @MOV to display the various screens.


Yes have also thought of this option. It's just that I don't want to have screen control in the PLC program.
Also because I am not working on the program, and the screen will have more than one host.

Thanks guys.
ECSI
In your macro shouldn't the statements be:

CLOSEPOPW(n)

instead of

CLOSEPOPW($W111) or CLOSEPOPW($W110)

where n = the actual project screen number used for the popup?


EDIT: OK nevermind, it looks like you already tried this. How about using CLOSEPOPW($SW4) and CLOSEPOPW($SW1).
PdL
QUOTE(ECSI @ Nov 16 2006, 07:40 PM) [snapback]43704[/snapback]
In your macro shouldn't the statements be:

CLOSEPOPW(n)

instead of

CLOSEPOPW($W111) or CLOSEPOPW($W110)

where n = the actual project screen number used for the popup?




Yes you would think so... but the funny thing is that it seems that when you run the command to close a screen that is not opened, the following code after the command isn't executed, anyway something goes wrong.
I can't just close all other 3 screens, because I don't know which screen is opened.

And when a screen is opened and I open another one, the number is loaded in the second popup memory word $W4.

I admit it is quite confusing blink.gif

-edit-

I AM SO BLIND IPB Image
QUOTE

If you set pop-up screen page number that does
not exist, the process will not be performed.


PdL
QUOTE(ECSI @ Nov 16 2006, 07:40 PM) [snapback]43704[/snapback]
How about using CLOSEPOPW($SW4) and CLOSEPOPW($SW1).


That's the problem. I don't know if the screen to be opened will be loaded in the $W1 when it is the first to be opened, or in $W4 when it is opened after another one should close.
So I can't just close $W1 or/and $W4, I have to know if the screen which is supposed to open is already loaded and then I shouldn't close it.

I am surprised you can still follow me!
ECSI
LOL...it is getting a little confusing:

Here's something I just tried. I created a main screen #0 and 4 popup screens #1,2,3,4. I created the 4 buttons on the main screen just like you did. Each button is set as Function 'None'' and in the macro for Touch ON Timing I put a simple statement

$SW1=n;

where n equals either 1,2,3,or 4 depending on which button is pressed. This will display the corresponding popup for whichever button is pressed.

Set the popup window properties to enable input on other screens.

You shouldn't need to copy and overlay the buttons onto the popup screens.

This works for me in test mode. I think it is what you are trying to accomplish.
PdL
QUOTE(ECSI @ Nov 16 2006, 10:13 PM) [snapback]43715[/snapback]
LOL...it is getting a little confusing:

Here's something I just tried. I created a main screen #0 and 4 popup screens #1,2,3,4. I created the 4 buttons on the main screen just like you did. Each button is set as Function 'None'' and in the macro for Touch ON Timing I put a simple statement

$SW1=n;

where n equals either 1,2,3,or 4 depending on which button is pressed. This will display the corresponding popup for whichever button is pressed.

Set the popup window properties to enable input on other screens.

You shouldn't need to copy and overlay the buttons onto the popup screens.

This works for me in test mode. I think it is what you are trying to accomplish.


KEWL nana.gif

I thought it was a read only adress! Stupid me...
Will try tomorrow. Thanks!
PdL
Thanks ESCI,

It works great notworthy.gif

Only thing I don't really understand is the difference between $SW1 and $W1.
I know the S stands for system memory, but in the memory allocation list one assigns $SW1 to $W1 !?
In test tool both adresses reflect the same values and can be set a constant which opens the popup window, but in the macro setting a constant to $W1 doesn't work, it only works when using $SW1.

Learned a lot again !
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.