You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old May 30th, 2007, 05:19 AM   #1
ptine
Member
Canada

ptine is offline
 
ptine's Avatar
 
Join Date: Nov 2006
Location: bc
Posts: 79
Creating a HMI with Visual Basic/OPC (PLC5)

Hello gentlemen. What I am trying to learn is how to create my own HMI using Visual Basic/OPC/Excel. I had the good fortune of spending a little time with some techs from a neighbouring plant and was introduced to this built it yourself approach. Saw a few programs working. Very impressive. However, they were running on a controllogix platform and we are running PLC5s. Shouldn't make much of a difference as its all being driven by RSLinx I think. Spent a bit of time on Rockwells site trying to figure it out. Didn't learn much. What I need is a simple explanation with a few details on how to set up the OPC server/client. I can stumble through the VB part but I'm having difficulties getting my data out of the PLC and into the VB program. Any and all suggestions/ideas would be greatly appreciated. Thanks in advance.
  Reply With Quote
Old May 30th, 2007, 05:38 AM   #2
arun_mallah
Member
India

arun_mallah is offline
 
arun_mallah's Avatar
 
Join Date: Feb 2005
Location: Pune
Posts: 18
Arun Sahani

Hi,
I shall suggest you to visit www.softwaretoolbox.com
You can find ready made VB programs to get data from PLC as well as from OPC Servers.
Regards,
Arun Sahani
  Reply With Quote
Old May 30th, 2007, 05:40 AM   #3
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 11,696
http://www.opcconnect.com/tooltech.php#vb
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old May 30th, 2007, 09:53 AM   #4
s7xp.com
Member
Netherlands

s7xp.com is offline
 
s7xp.com's Avatar
 
Join Date: Jan 2007
Location: Rotterdam
Posts: 151
If you are going to use VB as an OPC client, program the ASYNC !! procedures/events and not the sync procedures/evets to read data or write data. Sync takes to much time to make a fast responding user interface.
__________________
S7XP Manager - The tool for Step 7 projects
(Trending - Logging - Monitoring - Exporting - DB Initialize)
V2.21 supports troublefree upload of "actual values" from DBs
  Reply With Quote
Old May 30th, 2007, 07:45 PM   #5
ptine
Member
Canada

ptine is offline
 
ptine's Avatar
 
Join Date: Nov 2006
Location: bc
Posts: 79
Thanks guys. I was really busy at work today and didn't have a chance to respond. I thank you for your responses. I plan to invest some time into this during the weekend. However, if anyone else has any experience I sure would appreciate a brief overview. Thanks.
  Reply With Quote
Old May 31st, 2007, 12:16 PM   #6
s7xp.com
Member
Netherlands

s7xp.com is offline
 
s7xp.com's Avatar
 
Join Date: Jan 2007
Location: Rotterdam
Posts: 151
Install opc server. EG kepware.
mnake reference to opcdaauto.dll (microsoft) or delivered with the opc server. Google on opcdaauto.dll for a manual about it.

Create routines in vb for:
0. Dim opcserver with events, OPCGroups, OPCGroup, OPCItems
1. Connect to opc server with: .Connect
2. Create groups on OPC server with: .OPCGroups
3. Make groups active with: .DefaultGroupIsActive
4. Create group with: .OPCGroup
5. Set properties: .UpdateRate; IsSubscribed; .IsActive
6. Add items to group with: .AddItem
7. DataChange event. Server fires event in case of a data change.
8. Delete group
9. Delete groups
10. Disconnect opcserver

When adding items to a group, the vb program receives a serverhandle for the item. In the data change event the serverhandles and the data are transferred. Store your serverhandles to make it work.
Remove groups and server connections before closing the program, otherwise your groups remains active.
It is also possible to hit the opc server to send all the data to your project with the datachange event.

Good luck.

Regards
__________________
S7XP Manager - The tool for Step 7 projects
(Trending - Logging - Monitoring - Exporting - DB Initialize)
V2.21 supports troublefree upload of "actual values" from DBs
  Reply With Quote
Old May 31st, 2007, 12:53 PM   #7
Jiri Toman
Member
United States

Jiri Toman is offline
 
Jiri Toman's Avatar
 
Join Date: Jun 2002
Posts: 498
You don't need to use OPC, all you need is a driver that will work as a component in VB.NET. I have one for free on my web site here:

http://www.tomantron.com
__________________
Prague-Czech Republic, the best place to visit.
  Reply With Quote
Old May 31st, 2007, 12:56 PM   #8
s7xp.com
Member
Netherlands

s7xp.com is offline
 
s7xp.com's Avatar
 
Join Date: Jan 2007
Location: Rotterdam
Posts: 151
Correct Jiri, but ptine talks about opc and vb.
__________________
S7XP Manager - The tool for Step 7 projects
(Trending - Logging - Monitoring - Exporting - DB Initialize)
V2.21 supports troublefree upload of "actual values" from DBs
  Reply With Quote
Old May 31st, 2007, 08:11 PM   #9
ptine
Member
Canada

ptine is offline
 
ptine's Avatar
 
Join Date: Nov 2006
Location: bc
Posts: 79
Just got home from work a few minutes ago. Still haven't even had a beer. Brutual problem at work today. Had to chase down a ground fault. Took all day. Thanks guys for the responses. I'll be looking into it tonight but I won't really have a lot of time until the weekend. Darn job. I'll keep you guys posted. Looks like a lot of fun. Anuthing else you can think of that will help would be great. I imagine that others want to know how to do this also.
  Reply With Quote
Old May 31st, 2007, 08:18 PM   #10
ptine
Member
Canada

ptine is offline
 
ptine's Avatar
 
Join Date: Nov 2006
Location: bc
Posts: 79
Jiri I was just looking into your DF1 driver but I don't believe that it supports AB PLC5s though.
  Reply With Quote
Old June 1st, 2007, 05:56 AM   #11
hagar
Member
United States

hagar is offline
 
Join Date: May 2007
Location: new england
Posts: 4
below is some simple sample code.

i use rslinx single node ($400) for single PLC applications and rslinx oem ($900) for multiple PLC applications. for me these have worked very well.

as you already may know, in rslinx you set up your driver and then set up a topic which points to the PLC via the driver. the topic name is the OPC access path.

good luck!




Option Explicit
Option Base 1

Private WithEvents mvarServer As RsiOPCAuto.OPCServer

Private WithEvents mvarProcessGroup As RsiOPCAuto.OPCGroup

Private mvarProcessHomingStateNumber As RsiOPCAuto.OPCItem
Private mvarProcessSolderTableStateNumber As RsiOPCAuto.OPCItem
Private mvarProcessGlassTableStateNumber As RsiOPCAuto.OPCItem
Private mvarProcessSolderTableLiftStateNumber As RsiOPCAuto.OPCItem



Private Sub Form_Load()

On Error GoTo ErrorHandler
'On Error Resume Next

Me.Caption = Me.Caption & " v" & App.Major & "." & App.Minor & " Build " & App.Revision

Set mvarServer = New RsiOPCAuto.OPCServer
mvarServer.Connect "RSLinx OPC Server"

Set mvarProcessGroup = mvarServer.OPCGroups.Add("LayupGroup1")

mvarProcessGroup.OPCItems.DefaultAccessPath = "process1"

mvarProcessGroup.UpdateRate = 1000

mvarProcessGroup.IsSubscribed = True

Set mvarProcessHomingStateNumber = mvarProcessGroup.OPCItems.AddItem("N7:5", 1)
Set mvarProcessSolderTableStateNumber = mvarProcessGroup.OPCItems.AddItem("N7:1", 2)
Set mvarProcessGlassTableStateNumber = mvarProcessGroup.OPCItems.AddItem("N7:2", 3)
Set mvarProcessSolderTableLiftStateNumber = mvarProcessGroup.OPCItems.AddItem("N7:3", 4)

mvarProcessGroup.IsActive = True

Exit Sub

ErrorHandler:
MsgBox "An error has occurred. Try again or contact a controls engineer.", , "Warning"

End Sub


Private Sub Form_Unload(Cancel As Integer)

On Error Resume Next

Set mvarProcessHomingStateNumber = Nothing
Set mvarProcessSolderTableStateNumber = Nothing
Set mvarProcessGlassTableStateNumber = Nothing
Set mvarProcessSolderTableLiftStateNumber = Nothing

Set mvarProcessGroup = Nothing

mvarServer.Disconnect
Set mvarServer = Nothing

End Sub



Private Sub mvarProcessGroup_DataChange(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)

Dim i As Long

On Error GoTo ErrorHandler

For i = 1 To NumItems
Select Case ClientHandles(i)
Case 1
lblHoming(0).Caption = ItemValues(i)
Case 2
lblSolderTable(0).Caption = ItemValues(i)
Case 3
lblGlassTable(0).Caption = ItemValues(i)
Case 4
lblSolderTableLift(0).Caption = ItemValues(i)
End Select
Next i

Exit Sub

ErrorHandler:
fraProcess(0).BackColor = vbRed
MessageBox Me.hWnd, Err.Description, "Error: " & Err.Number, vbExclamation

End Sub
  Reply With Quote
Old June 1st, 2007, 07:11 AM   #12
Jiri Toman
Member
United States

Jiri Toman is offline
 
Jiri Toman's Avatar
 
Join Date: Jun 2002
Posts: 498
Sorry

Quote:

Jiri I was just looking into your DF1 driver but I don't believe that it supports AB PLC5s though.
I apologize. Duh. It's been a while since I looked at it. It's true I never got around to do it for PLC5.
Since I have been doing the travel business I got disinterested in controls, particularly in view of the fact that the field is going to hell, just wait when H1B visas go up to 180 000 per year.
Our idiot in charge is working on that.
__________________
Prague-Czech Republic, the best place to visit.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Retain Controller Data in an HMI tag (Allen-Bradley) Money4Nothing LIVE PLC Questions And Answers 16 July 19th, 2007 07:38 AM
E-series HMI and Modems The_Wanderer LIVE PLC Questions And Answers 5 February 25th, 2004 10:46 AM
I/O Comm. problem btw PLC & HMI WFox LIVE PLC Questions And Answers 7 December 31st, 2003 01:09 PM
Creating an HOA switch in Lookout HMI Rmiller LIVE PLC Questions And Answers 2 February 23rd, 2003 12:43 AM
trouble creating plc5 project file fixit LIVE PLC Questions And Answers 1 February 10th, 2003 10:53 AM


All times are GMT -5. The time now is 09:12 PM.


.