Trying to debug a VBA script in FTV SE 9

asterof

Member
Join Date
May 2007
Location
Califonia
Posts
554
so I am trying to figure out this syntax

Set Ingredient = Application.CreateTaggroup(Me.AreaName, 500)

Ingredient.add "[CompactLogix Processor]Ingredient_List"

Ingredient.Active = True

Set Tag1 = Ingredient.Item("{[CompactLogix Processor]Ingredient_List}")

So is [CompactLogix Processor] a tag group and
Ingredient_List a tag ?

or is

{[CompactLogix Processor]Ingredient_List}") a direct path to the Rslinx Enterprise topic
 
Ingredient --> Tag group
Tag1 --> FTV tag

CompactLogix_Processor ---> FTV shorcut to processor
Ingredient_List ---> PLC tag
 
First notice the [CompactLogix Processor]
has no underscore
Second, why do you need to touch the PLC shortcut
and not just reference the Tag in the FVT Database
directly


Ingredient --> Tag group
Tag1 --> FTV tag

CompactLogix_Processor ---> FTV shorcut to processor
Ingredient_List ---> PLC tag"



Set Ingredient = Application.CreateTaggroup(Me.AreaName, 500)
Ingredient.add "[CompactLogix Processor]Ingredient_List"

Ingredient.Active = True

Set Tag1 = Ingredient.Item("{[CompactLogix Processor]Ingredient_List}")
 
First notice the [CompactLogix Processor] has no underscore
Sorry, I always put underscores instead of spaces and it's a harcoded habit in my brain (almost an OCD).

Second, why do you need to touch the PLC shortcut and not just reference the Tag in the FVT Database directly
You can use HMI or PLC tags. Usually HMI tags have more delay than PLC tags.

Using HMI tags you'll have:
Code:
Ingredient.add "folder_name\Ingredient_List"
About this code:

Code:
Tag1 is a FTV Databse tag
Tag1.Value = 1.0
Tag1.Download
I'll test it later and give you some feedback.

---------
If you have TechConnect access, you can read this technote:

TN22114 FactoryTalk View SE: Read and Write Tags in Display Client VBA Code (Access Level: TechConnect)

The differences between HMI and PLC tags have been discussed before:

http://www.plctalk.net/qanda/showthread.php?t=95090

http://www.plctalk.net/qanda/showthread.php?t=57858
 
This is how I did it

Option Explicit
'Global declarations
Public MyTagGroup As TagGroup
____________________________________________________

Private Sub Display_AnimationStart()
Set MyTagGroup = Application.CreateTagGroup(Me.AreaName)
MyTagGroup.Add "Recipe\Currect_Recipe_Collector_Cnt"
MyTagGroup.Add ("Recipe\CheckBox_EB_P_CNTRL")
MyTagGroup.Add ("Recipe\Recipe_Index")
MyTagGroup.Add ("Recipe\Recipe1_Name")
MyTagGroup.Add ("Recipe\Recipe2_Name")
MyTagGroup.Add ("Recipe\Recipe3_Name")
MyTagGroup.Add ("Recipe\Recipe4_Name")
MyTagGroup.Add ("Recipe\Recipe5_Name")
MyTagGroup.Add ("Recipe\Recipe6_Name")
MyTagGroup.Add ("Recipe\Recipe7_Name")
MyTagGroup.Add ("Recipe\Recipe8_Name")
MyTagGroup.Add ("Recipe\Recipe9_Name")
MyTagGroup.Add ("Recipe\Recipe10_Name")
End Sub
_________________________________________________________

Private Sub Add_list()
Dim Recipe_Name As Tag
Dim Recipe_Index As Tag

Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe1_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe2_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe3_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe4_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe5_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe6_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe7_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe8_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe9_Name")
FormListBox.AddItem (Recipe_Name.Value)
Set Recipe_Name = MyTagGroup.Item("Recipe\Recipe10_Name")
FormListBox.AddItem (Recipe_Name.Value)

End Sub
 
It important to use the correct syntax
Ingredient.add "folder_name\Ingredient_List"
would be (Ingredient.add "folder_name\Ingredient_List")
 
Now you said reading directly from the PLC would be faster that
reading a database tag that already on poll, how is that ?
 

Similar Topics

Hi. I am writing VB Script in WinCC but cannot open the debugger to debug it. I installed the one from Microsoft but none pops up when I hit...
Replies
2
Views
7,569
I can't seem to get the Panel View Plus 7 standard edition to downgrade to V_11, when I check the AB downloads and compatibility websites for this...
Replies
1
Views
135
Hi I used to be able to launch PLCsim without any problem. Now it tells me " STEP 7 Professional Licence is required to simulate this PLC"...
Replies
15
Views
522
Hello! When trying to load the hardware configuration I get error 0050-133 2 2458, check the diagnostic buffer. When checking the buffer, it says...
Replies
4
Views
183
Back
Top Bottom