tag change not forcing event change in factorytalk

macgioo2

Member
Join Date
Oct 2009
Location
Cambridge
Posts
98
Hi All,

I'm new to this with basic programming skills so forgive my ignorance.

I'm using factory talk to create I/O pages for the PLC.

I want a single HMI page where buttons display the i/o status and label for each set of Io's.

x_100 in a factorytalk memory tag which I can force with a button, which in turn should change the background color of Polygon2 from back to white, but it doesn't work.

I know the tag value is changing because I have displayed in a field on the same page.

How do you refresh the page to reflect the tag value change?
Or what is the correct method I have tried several!

Private Sub ActiveDisplay_Change()
If x_100 = 1 Then
Polygon2.BackColor = vbBlack
Else
Polygon2.BackColor = vbWhite
End If
End Sub
 
I'm not used to using VB code in FT View Studio, I always use the Animation function provided. I just need to assign the Color animation with the setting shown in the picture below. It is fast and easy and will not load your HMI with VB code (Extensive VB code will slow your HMI).

I will advise you to use the Animation instead of VB code, use VB code only for more complicated function that is not provided by FT View Studio. Actually I always do my whole project without VB code.

50791-01.gif
 
Without sounding lame, i was told to do it this way!!

The version is RSview Site Edition Release No. 5 CPR9.

I wanted to create two objects (polygon and text) and attach multiple tags to them.

So for example if Button1 is pressed Polygon1 shows on/off status of tag1 (plc input 1) and text1 shows electrical label for this same tag.

If another button, Button2 is pressed Polygon1 shows on/off status of tag10 (plc input 10) and text1 shows electrical label for this same tag, i.e. tag10

But as I say when I force the input value the background color does not change.

Any help would be great!
 
What you are trying to do, sounds as if it would be better accomplished using the built in animation, and just re-opening the display with different parameter files.

VBA is NOT executed continuously, and trying to update things are you are doing is only going to cause more trouble then it is worth in the end.
 
Well thanks everyone for your comments.

I had done this quite easily in wonderware and was trying to create a similar system here as there are is such a large quantity of io's.

But if it can't be done easily, then it is not worth it I guess.

One last query in relation to this if I create a macro called "Test" containing the code:

x_100=1

and then create an event who's action is Test and make expression always "True" will this change the value of the tag or is something else required here, as currently the tag remains x_100=0

Thanks again

event.jpg
 
FTView SE is not WonderWare.
There is no "While True" conditional script.
And event, is an event. Fired off once.

The tools you really sound like you need to be using are mentioned above. Parameter files, and Parameterized displays.
 
No worry. Here the VBA way of doing it. I can show you how to change the background color by clicking on a button as below:

First you need to enable the VBA for your Polygon (my polygon name is Polygon1, need this name later in the VBA code) by Setting the ExposeToVB value to "Type Info Extension" (refer to my attachment)

Next create a VBA button from the ActiveX Toolbox and use this VBA code.
Code:
Private Sub CommandButton1_Click()
        ' Change Background Color to Black
        ThisDisplay.Polygon1.BackColor = &H0
End Sub
The problem with your previous VBA code is it only run when you change to another page which I think did not occur when you test it. If it did run you will get the "method or data member not found" because the Polygon is not exposed to VBA.

The most challenging part will be adding a periodic task that call your color changing code. Hope this can help you started with your VBA adventure with FT View Studio...

50791-02.gif
 
Last edited:
His issue is that he wants to change the underlying DISPLAY tag to point to another tag. That is simply not a job for VBA. It could be done, by running VBA events off of hidden objects, but that is horribly inefficient, and could possibly run afoul of the per-screen tag-limit.

Running VBA loops is also a horrible idea, as the single-threaded runtime engine would get incredibly bogged down.
 
thanks allentcm but i did manage this much myself in the beginning but then hit a wall.

I have taken the advice of rdrast and I am now using parameter files to store the different tags for the same objects and have basically got what I needed except for one thing, perhaps someone can help!?

The label for the tag is updated using the vb code

Private Sub Button4_Released()

Dim L7 As String
L7 = "Input x_100"

x0_label1.Caption = L7

End Sub

Where Button4 is "Param1"

Inside the press action of "Param1" is the code

Display Station_Inputs /PInputs_pg1, which calls the appropriate parameter file.

However this seems to be overwriting the tag label and all i'm left with is the default caption name for this label.

How can I sequence the events to stop this from happening?

event2.jpg event3.jpg
 
rdrast, I agree with you I ever did VBA in FT View project that cause the whole thing to show down like hell (maybe my programming skill not so good). In the end I find that sticking to the function provide by the FT View is good enough for most project (maybe not all for sure).
 
In FT View you only want to use VBA when the built-in functions cannot do what you need. For those used to RSView32, the whole "expose to VBA" is new.

OG
 
Make your "Display" a pop-up window.
Open the display with the parameter file upon pressing a button.

I use this method, for example, to show the states of the front panel LED's on PLC Modules in maintenance screens... Each 'slot' in the rack on the screen, is a button, that calls up a parameterized blow-up view of the module, with the LED's reflecting the actual state.
 
Hi rdrast,

you know exactly what I am trying to do, here's the thing I really only want to use one "display" for all tags.

The method you explained will work if I create a separate display for each parameter file invoked by each of the buttons.

This is fast becoming my Everest of the week, but surely there is away of updating the tag, after the Display has been loaded, or while display is active, or on a loss of focus to an object or can I create an event in the background based around a timer which will do this.

I really appreciate your comments to date, please forgive my stubbornness!
 
Put simply, NO THERE IS NO WAY TO DO THAT.

Tell you what. Point the display to one register in the PLC. Use indirect addressing in the PLC to dynamically copy your data from the points you want to display, into the register the display is showing.

You can move different values around in the PLC and get the effect you are looking for.
 

Similar Topics

Basically I have created a bunch of local tags, is it possible to convert all of these to a global tag? Or would I need to re-add everything all...
Replies
5
Views
1,163
I have a Red Lion G09 scanning 8 Invertek P2 VFDs via modbus RTU - I've setup necessary comms and tags and all works well. I have a 'Settings'...
Replies
3
Views
1,873
Hello all, wondering if there's a simple way to detect when a tag's value has changed. I have some tags whose values get updated every so often...
Replies
4
Views
1,652
Is it possible to dynamically change Tag Names (in real-time) on these PLCs? I'm guessing the answer is "NO", right? Just externally, then...
Replies
10
Views
3,870
Hi All. I have been tasked with the HMI aspect of a PLC 5 to Logix 5000 upgrade. The plc code has been completed by others, it's up to me to...
Replies
6
Views
2,194
Back
Top Bottom