Sign in to follow this  
Followers 0
Guest BeeMan

Macro function in NSDesigner 6.02E

6 posts in this topic

I new to NS so bare with me. I have one PLC (CJ1) and one NS8. I would like to stop a button from switching to a specific page when pressed (when SerialA:HR00020.04 is off in the PLC). I have made a macro that i only works if i use $B-adresses. If i use the HR-adress the macro wont work because "variable name error". What am i missing? Can i only use adresses from the NS8 in macros? The Macro IF(SerialA:HR00020.04) MSGBOX("Function disabled","Information",5) & RETURN(1) ELSE RETURN(0) ENDIF Any ideas?

Share this post


Link to post
Share on other sites
Hi didn't know version 6 was out the version that I use , you also can't use plc address on if statement but however if you add before your statement, ------------------------------------------------- ReadCmem($B1,[serialA:HR00020.04],1); ------------------------------------------------- and use $b1 in your if statement in stead of hr20.04 it will read the state of your hr into the ns8 to $B1 hope that helps.. and makes sence :S

Share this post


Link to post
Share on other sites
Hi, You shouldn't need a macro to do this... Why not use the control flag? Simply tell the button not to work unless HR20.04 is on.... See diagram below, the control flag can be accessed by selecting 'display extension tabs' in the button properties dialog. Nibroc

Share this post


Link to post
Share on other sites
I already have the control flag enabled, but i would like to show a message to the user that the function is disabled, so he dont wonder why it doesnot work.

Share this post


Link to post
Share on other sites
Hi, OK, a macro is a good way to do this. Do you have it working yet? Nibroc

Share this post


Link to post
Share on other sites
I could not get it to work. But after a while of trying i found a solution. I have a switchscreen-button that switch to the same page the button is placed. I added a macro to this button: ReadCmem($B124,[serialA:HR00020.04],1); IF($B124) SHOWPAGE(124) ELSE MSGBOX("Function disabled!","Information",5) ENDIF So if "SerialA:HR00020.04" is on the button takes me to page 124 else the message shows. Thanks for all the help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0