Visual Studio HMI with RSLogix OPC Server

A

Thread Starter

andersonleal76

Hi.

I'm trying to develop a HMI using visual studio 2010 to connect with a RSLogix 5000 by OPC server. Someone could help me because i have been trying a lot and i cannot set a single bit on logix5000.

How do i do to set the tags on visual studio to read and write datas on RSLogix 5000?

Thanks.
[email protected]
 
A

andersonleal76

Hi,Mark!

Thanks for your support.

I got it using VB6 but when i try to use other newer version of Visual basic as visual basic 2008 express edition I can"t ready or write values in my PLC when i write "teste = LinxItem1" appears for me this sentence " Value of type 'RsiOPCAuto_OpcItem' cannot be converted to 'Integer'.

this is the code that i'm using.<pre>
Imports RsiOPCAuto

Public Class Form1
Public MyRsLinxOPCServer As RsiOPCAuto_OPCServer
Public WithEvents LinxOPCGroup As RsiOPCAuto_OPCGroup
Public LinxItem1 As RsiOPCAuto_OPCItem
Public LinxItem2 As RsiOPCAuto_OPCItem

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Create Server
MyRsLinxOPCServer = New RsiOPCAuto_OPCServer

'Connect to Server
MyRsLinxOPCServer.Connect("RSLinx OPC Server")

'Add Group to Server
LinxOPCGroup = MyRsLinxOPCServer.OPCGroups.Add("TestGroup") 'Group name can be anything you want it to be

'Set Group Active for Data Updates and Events
LinxOPCGroup.IsActive = True

'Group Update Rate
LinxOPCGroup.UpdateRate = 1000
LinxOPCGroup.IsSubscribed = True

'Add Items to Group, the specifier on the end Needs to be Unique for each Tag
LinxItem1 = LinxOPCGroup.OPCItems.AddItem("[TESTE]Variavel1,L1,C1", 1)
LinxItem2 = LinxOPCGroup.OPCItems.AddItem("[TESTE]Variavel2,L1,C1", 2)

End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
LinxItem1 = LinxOPCGroup.OPCItems.AddItem("[TESTE]Variavel1,L1,C1", 1)
Dim teste As Integer
teste = LinxItem1
TextBox1.Text = teste</pre>
Could you tell me if this code is right?

Thanks.
 
Hello,

VB is not my first or fifth programming language. I have only dabbled with it.

Having said that, I do not see any read or write functions.

On our website under Downloads/LogixOPC Demo is an example project and a short video, using Excel and VBA to read/write tags in a Logix PLC.

Good luck,

Mark
http://www.peakhmi.com/
 
You can save yourself a lot of work by using AdvancedHMI. It is a Visual Studio based HMI solution with native drivers for ControlLogix and CompactLogix. It's easy to get started and requires no code to make the basic HMIs, but still allows you full access to the drivers for reading/writing via code for more complex applications. The base package is free which includes the drivers.
 
Top