Sign in to follow this  
Followers 0
DiGGy

FT View ME v7 Startup Macro - Tags in Expression

6 posts in this topic

I hope no-one minds that I'm cross posting this from the RA forums, I just wanted to get as much visibility as possible since there doesn't seem to be anything on the net about this. Any issue, let me know, or feel free to delete it. I'm trying to use a startup macro in my manual mode HMI application to copy the current state of my outputs to the inputs so the machine does not move or change state when switching between auto and manual modes. However, when I run the application on my PanelView Plus400 HMI, I'm immediately greeted with errors like "<macro expression>: Unable to read the expression""Read from <tag> failed"Some info: This only occurs for lines that set a tag's value to another's; if I set the tag to just a numeric value (like in the first line of the sample below), its executes just fine.There are two separate HMI applications. One is for normal / automatic operation. This one is to allow the operator to manually activate individual solenoids on the machine to aid with building, setup, and troubleshooting; it is not seen nor used in production.This occurs long after the plc has booted (manual mode is not the startup application) - so running anything on first-scan is not an option - and the HMI has no trouble communicating to these tags during operation.They are RSLinx Enterprise tags, I think - not HMI tags; they only exist in the controller / ladder. I'm able to successfully browse to them online in FTView.The expression editor reports the "tag = tag" syntax is valid.Lastly, I'm using FT View v7, but I'm creating v5.10 runtime applications.Here is an excerpt of the macro: {[Gage]MANUAL.MODE_ON} = 1;{[Gage]MANUAL.STATION_1_ESC_CLAMP_EXT} = {::[Gage]Program:Station_1.STATION_1_ESC_CLAMP_EXT_SOL};{[Gage]MANUAL.STATION_1_MOV_CLAMP_EXT} = {::[Gage]Program:Station_1.STATION_1_MOV_CLAMP_EXT_SOL};{[Gage]MANUAL.STATION_1_PROBE_EXT} = {::[Gage]Program:Station_1.STATION_1_PART_PROBE_EXT_SOL};{[Gage]MANUAL.STATION_1_ROTATE} = {::[Gage]Program:Station_1.STATION_1_ROT_180_SOL};{[Gage]MANUAL.STATION_1_SLIDE_EXT} = {::[Gage]Program:Station_1.STATION_1_SLIDE_EXT_SOL};... and so on...FTView IS able to successfully execute the macro when I test it on the development computer while it is connected to the PV+ over ethernet. If the PV+ is not connected, or the application is running solo on the PV+, no dice / same errors. I have also tried using HMI tags in all combinations in the tag and expression by tying the RSLinx tag to an HMI tag. So far, they've had the same results as above. Absolute worst case, I could edit the ladder to latches or unlatches the inputs off of a one shot from the manual mode on bit, but it would require 7 manual program changes across many in-production machines and would be very time consuming. I've searched everywhere, and the manual's not been any help - maybe I don't know what to look for. Thanks for your time everyone, ~Anthony

Share this post


Link to post
Share on other sites
Just to clarify, when you say "copy the current state of my outputs to the inputs", I assume you mean the inputs/outputs of an add-on instruction or subroutine, not physical I/O? If all your tags are just digital tags, you could try an if-then-else statement, something like: If {Solenoid_1} = 1 Then {ManualLogic.Solenoid_1} = 1Else {ManualLogic.Solenoid_1} = 0That way you're not trying to do tag = tag, you're doing tag = constant. I can't remember offhand if you need an End If statement there; from memory on FTView Macro's you don't need one if you have an Else statement. But I'm sure it'll tell you about it if I'm wrong :)

Share this post


Link to post
Share on other sites
I am all new to this but I was not able to write a macro the way the two of you are showing. One thing I ran into was if you wanted to see is two Tags were the same you had to use two ='s instead of one, example: If {Tag1} == {Tag2} Then The other thing was I could not use = to assign a value to a Tag. When I opened a new macro it gave me a type of spread sheet where the left column was for the Tag that you wanted to assign something to and the right column was for the If Then, Else test. There was no: If {Tag1} == {Tag2} Then {Tag3} = 4 It was simply: {Tag3} If {Tag1} == {Tag2} Then 4 Else 0 The Else was mandatory and there was no End If. Both the mandatory Else and not having an End If made it harder to program; and I was not able to do what I needed to do using FactoryTalk's macro editor. I ended up editing the .mcr file that was created using Notepad and writing the macro that way. DiGGy's macro looks much different that what I ended up with, he is using PanelView Plus 400 and I am using a PanelView Plus 1000, maybe that is the difference. I don't seem to be able to paste a screen-shot of my FactoryTalk's macro editor or the .mcr macro file which is plain text. I hope this helps.

Share this post


Link to post
Share on other sites
Here is an attached word document with the information I tried to paste but was unable to. macro.doc

Share this post


Link to post
Share on other sites
Ah yes, sorry, you do have to use == for an equal comparison. If you can't use "{tag} = constant" to set your tags, try the Set command. So your command would now look something like: If {Tag1} == 1 Then Set {Tag2} 1Else Set {Tag 2} 0Again, this is all off the top of my head, so you may have to play around with it to make it work. Check the help files, they're usually pretty good and telling you how to structure your syntax :)

Share this post


Link to post
Share on other sites
Update: I discovered that the startup macro couldn't be successfully executed if I chose to replace communications when the HMI application started up. If I retained the communications set up by the default HMI application (which really should have always been the case), the macro could read the expressions just fine and executed appropriately. I guess that the startup macro doesn't have to wait for the HMI to fully establish communications before it executes... I still don't like it thought, as it requires proper knowledge beforehand that this is the case. Thus, I'm rewriting my ladder to execute an event driven task whenever my MANUAL.MODE_ON bit one shots ON. Case closed, thanks everyone.

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