
2.11 Communications with a Windows PC (FA-Server)
Using Automatic Reception with the MP3000 as a Slave
2-323
Ethernet Communications
• Using OPC in Visual Basic
Turn ON the power to the MP3000 that you set up. Place the FA-Server that you set up in online status.
Start Visual Basic 6.0 and select
New
−
Standard EXE
.
Select
Project
−
References
from the menu bar and select
OPC Automation2.0
.
Place four TextBox controls from the toolbar onto the form.
Add processing code for the Form Load and Unload events.
•Add processing to connect to the server, access path settings (“U01.F01.”).
•Add DDE items such as “T01”.
Place four
CommandButton
controls from the toolbar onto the form.
Double-click the
CommandButton
Control and enter the following code.
This concludes the program creation in Visual Basic. Change the program as necessary and save it (create
an EXE file).
Starting Communications
Use the following procedure to communicate between the Visual Basic application on the PC via the FA-
Server and the MP3000.
1.
Turn ON the power to the MP3000 to start receiving messages.
The system will automatically start the message reception operation. No further operation is required.
2.
Start the FA-Server and place it online.
3.
Start the Visual Basic application.
This starts communications with the MP3000.
CommandButton
Settings to Write the Value in
TextBox
to T01 (MW00000)
In this example, T01 is set as the first handler in step 5.
Private Sub Command1_Click()
Dim vntValue(1) As Variant
Dim IngltemServerError() As Long
VntValue(1) = CDbl(Text1.Text)
gobjMyOpcGroup.SyncWrite 1, glngItemServerHandles, vntValue, lngItemServerErrors
End Sub
Example