Write a Tag with Visual Basic in FactoryTalk

StevN

Member
Join Date
Sep 2014
Location
lima
Posts
3
from visual basic I am trying to write to a variable in factorytalk called alarm, this variable is of binary type, should not be a problem but I try several ways and so far can not,

This is the code that relates to a button,


Private Sub Button1_Release()
Dim alarm as Boolean
If alarm = 1 Then
alarm = 0
Else
alarm = 1
End If
End Sub


as you can see is very basic, the alarm variable already exists in the list tags of plc and lists of factorytalk tags

Thanks for your time,

Best regards,
 
Since you define the variable 'alarm' in your sub, it is scoped locally so cannot refer to anything outside the sub. You could try not defining it in the sub and see if it compiles OK. If not, then your reference to it must not be proper.
I haven't worked with the VB in FT so maybe the help file can shed some light on how to address a more global variable.
 
Hello,
Thanks for the answer, try without definition, does not work, I was searching through the help file but did not find an example or a clue to the solution, I will continue searching the web.

Best regards,
 
Is this a standalone Visual Basic application, or are you trying to write a VBA routine inside the FactoryTalk View application ?

You don't need VBA just to write a value to a FactoryTalk tag on release of a button; that's an ordinary FactoryTalk View Command.

Or you can use an ordinary FactoryTalk View Button object.

The logic you posted will set the tag = 0 if it's already 1, and set it to 1 if it's already 0.

That's how an ordinary Maintained Button works, when it's configured for the next state to be based on the current state.
 
Hello Ken,

Correct, Im trying to write a VBA routine inside the FactoryTalk View application

Is an existing project, I might add password to the condition before changing to 1, the easiest way to do this without knowing the key is with VBA, maybe I'm wrong,

Thanks for your time

Best regards,
 

Similar Topics

When using System Platform, I can use the object viewer to directly manipulate attributes/tags/whatever. When I have a standalone InTouch...
Replies
11
Views
992
Hardware: 5069-L320ERMS2 Software: Logix Designer 35.11 / Ignition 8.1 Issue: When attempting to write to the tag "HMI_DRV200_DynamicTrim" in...
Replies
5
Views
763
I am using FactoryTalk View Studio ME to create an application for an allen-bradley panelview plus7. I am attempting to get the loaded application...
Replies
17
Views
1,561
Hi I am trying to Write into a PLC Tag using the Inger v7 , the Plc is a Micrologix 850 2080-LC50-48QWB , I can write bool , interger , but when...
Replies
1
Views
398
Dear colleagues, I am reaching out for assistance with an issue I am having. I have a code that can successfully insert data from FactoryTalk...
Replies
6
Views
1,050
Back
Top Bottom