Sign in to follow this  
Followers 0
AndrewG

FactoryTalk View SE macro

6 posts in this topic

I need to write a macro in FactoryTalk View SE v7.0. I need to take some HMI tags, multiply by a certain number, and write to PLC tags. For example:

PLC_Tag1 = HMI_Tag1 * 0.75

The FactoryTalk Help says to do it like this:

Equal ( = ) command [&] <tag_name>=<expression>

but there are no examples shown and I don't understand the syntax. I have to do this offline so I can't test it. Do I write:

[&] <PLC_Tag1> = <HMI_Tag1 * 0.75>

 

Thanks in advance

Share this post


Link to post
Share on other sites

First, are you doing this as an expression of a numeric display, or as VB code?

 

Sorry.  Why are you doing this in a macro?  Pretty sure you can't do math in a macro.  If it were me, I would be doing this in VB code, unless it's just for display which then I would just do it as an expression within a numeric display.

 

Alternatively, you could do the math in the PLC and give it it's own tag.

Edited by adohm

Share this post


Link to post
Share on other sites
9 minutes ago, adohm said:

Sorry.  Why are you doing this in a macro?  Pretty sure you can't do math in a macro.  If it were me, I would be doing this in VB code, unless it's just for display which then I would just do it as an expression within a numeric display.

 

I was told to avoid adding new PLC tags/logic to this project. I will look into the VBA option too.

Share this post


Link to post
Share on other sites

There are examples in the on-line help. If you bring up the "Command Wizard Step 1 of 2" window and double click on "=", it opens a "Command Wizard Step 2 of 2" window. Click on the Help button at the bottom. It explains the syntax and has an Examples link near the top.

In your case, the syntax would be PLC_Tag1 = HMI_Tag1 * 0.75 if you have multiple commands that you want to execute in order (synchronously) or & PLC_Tag1 = HMI_Tag1 * 0.75 if you don't care what order they execute in (asynchronously).

Share this post


Link to post
Share on other sites

The concept with FTView macros is straightforward...you create new Macro tags and macro script reading system or PLC data into these new tags & you have to configure the FTView application to link to the macro (in the configuration setup).  The attached instruction walks you through establishing a PLC-HMI heartbeat using a Macro script.  

Start small...passing an analog PLC tag value, macro read the PLC tag value into a new HMI tag, add the display of the new HMI tag on a screen, add the Macro name to the HMI configuration.

You will need the macro, link the macro in the HMI configuration, and the action for when the macro is to run (a button being pressed?).

Work_Instruction_-_Allen-Bradley_PanelViewPlus_Heartbeat[1].doc

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