Hallo everyone,
I am not an expert with VB6,
I am struggling to make an interface for controlling a PLC. I can connect to a client, but my start, stop, and disconnect buttons don't work. I don't really have a clue why. Can somebody maybe have a look and seee what I need to change?
8 Replies - 530 Views - Last Post: 17 November 2012 - 09:24 AM
#1
struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 03:06 AM
Replies To: struggling to make an interface for controlling a PLC
#2
Re: struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 05:07 AM
We're not mind readers....we need to have something to look at. :-)
Please post what code you have using the [ CODE] tags and we'll see if we can help
Please post what code you have using the [ CODE] tags and we'll see if we can help
#3
Re: struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 05:11 AM
Option Explicit
Dim Opc As OpcClass
Private Sub Check1_Click()
Opc.SetItemControl Check1.Tag, Check1.Value
End Sub
Private Sub Command1_Click()
MsgBox (CommandButton5.Top)
End Sub
Private Sub Disconnect_Click()
If Not Opc.OpcIsConnected Then Opc.OpcDisConnect
Connect.Enabled = False
Disconnect.Enabled = True
End Sub
Private Sub Start_Click()
Dim a As String
Dim b As Integer
a = Opc.GetItemData("unitelway!%m0")
If a = "0" Then
b = 1
Else
b = 0
End If
Opc.SetItemData "unitelway!%m0", b
End Sub
Private Sub Connect_Click()
If Not Opc.OpcIsConnected Then Opc.OpcConnect Me, "Schneider-Aut.OFS"
Dim Extravar(15) As String
Extravar(0) = "unitelway!%m0"
Opc.AddGroup Extravar
Connect.Enabled = False
Disconnect.Enabled = True
Opc.SetUpdateRateControl 200
End Sub
Private Sub Command5_Click()
MsgBox (Opc.GetGroupCtrlActive)
End Sub
Private Sub Form_Load()
Set Opc = New OpcClass
VScroll3.Max = Frame1.Height - CommandButton7.Height
VScroll3.Height = Frame1.Height
End Sub
Private Sub Stop_Click()
Dim c As String
Dim d As Integer
c = Opc.GetItemControl("unitelway!%m0")
If c = "0" Then
d = 1
Else
d = 0
End If
Opc.SetItemControl "unitelway!%m0", d
End Sub
Private Sub VScroll1_Change()
Opc.SetItemControl VScroll1.Tag, VScroll1.Value
End Sub
Private Sub VScroll2_Change()
CommandButton5.Top = VScroll2.Value
Text4.Text = VScroll2.Value
End Sub
Private Sub VScroll2_Scroll()
CommandButton5.Top = VScroll2.Value
Text4.Text = VScroll2.Value
End Sub
Private Sub VScroll3_Scroll()
CommandButton9.Top = VScroll3.Value
Text4.Text = VScroll3.Value
End Sub
Private Sub HScroll1_Change()
CommandButton10.Left = HScroll1.Value
End Sub
Private Sub HScroll2_Change()
CommandButton7.Left = HScroll2.Value
End Sub
Private Sub VScroll11_Scroll()
CommandButton6.Top = VScroll1.Value
End Sub
Private Sub VScroll12_Scroll()
CommandButton7.Top = VScroll1.Value
End Sub
#4
Re: struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 05:57 AM
Do you get any errors at all?
How are you determining that you have a successful connection?
How are you determining that you have a successful connection?
#5
Re: struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 06:02 AM
i don't get errors, I think the code for my start and stop buttons are not complete. But I don't know how to go further? maybe someone has an idea.
My disconnect button is now working.
I want to give a start signal to the PLC, but how?...
I am connecting via opc client server, and am sure i am rightly connected
My disconnect button is now working.
I want to give a start signal to the PLC, but how?...
I am connecting via opc client server, and am sure i am rightly connected
#6
Re: struggling to make an interface for controlling a PLC
Posted 13 November 2012 - 12:23 PM
Which OPC client are you using and which PLC is it?
When you say you're sure you're connected, how are you sure? What do you check?
Have you checked in the PLC whether the values you're trying to set are being set?
Did the OPC Client not come with any examples?
We can try to help you with the coding side of things, but it's going to be a little tricky around the PLC control side of things.
When you say you're sure you're connected, how are you sure? What do you check?
Have you checked in the PLC whether the values you're trying to set are being set?
Did the OPC Client not come with any examples?
We can try to help you with the coding side of things, but it's going to be a little tricky around the PLC control side of things.
#7
Re: struggling to make an interface for controlling a PLC
Posted 14 November 2012 - 12:23 AM
I am sure I am connected, I am using PL7 Pro. This software also has a client and a server. Using the server I can see if signals(inputs/ouputs/markers from the plc) get the values I send to it. The PLC is a Modicon TSX Premium
I need to know how I could send a start signal to an input signal of the PLC. Then the PLC needs to start up something else. That is already working...I only need put the link between my interface and my PLC.
I need to know how I could send a start signal to an input signal of the PLC. Then the PLC needs to start up something else. That is already working...I only need put the link between my interface and my PLC.
#8
Re: struggling to make an interface for controlling a PLC
Posted 14 November 2012 - 12:57 AM
Have you followed the code examples which came with the product as you didn't answer my question??
I found this link that suggests there is a VB example for modicon PLC's that shows you how to start and stop the PLC. I would suggest you try finding it on your PC or CD/DVD and have a look at it.
As this is a very niche area, you may need to wait for someone with specific knowledge on that set-up to reply. My experience is more with Siemens and Mitsubishi PLC's from many years ago.
I found this link that suggests there is a VB example for modicon PLC's that shows you how to start and stop the PLC. I would suggest you try finding it on your PC or CD/DVD and have a look at it.
As this is a very niche area, you may need to wait for someone with specific knowledge on that set-up to reply. My experience is more with Siemens and Mitsubishi PLC's from many years ago.
#9
Re: struggling to make an interface for controlling a PLC
Posted 17 November 2012 - 09:24 AM
Willem, you may not realize it, but maj is being very patient with you. He had to go to a great deal of extra effort to get you to explain your problem in any sort of way that he had a chance of helping you. Note that the information in your last post could very well have been in your first post. After all, you already knew it at that point. Perhaps you will look carefully at his responses and provide necessary information without being asked next time. Anyone else reading this might use it as an instruction manual on providing needed information to solve a problem.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|