Home
Location: Home > Source Code > S7-200 Example >

S7-200 Communication with VisualBasic via PPI
User Manual

Language:English Size:MB File type.rar Add time:2009-07-14 Count:
document description

recently to do a project, the use ofS7-200, but not a great amount of data exchange, andWINCCfeel compared to waste, so wanted to be their own monitoring software, on the thought of usingVBprogramming to callw95_s7.dlldynamic-link database. through3-day efforts, and finally the results of small, what is my basic method of test. For your reference!

1.Prodave forpc withs7 series ofplc data link communications between the toolbox. The essence is that the user by calling the "w95_s7.dll"such as library function to solve the PLC withPCbetween the data exchange and data-processing problem. by hardware required for:CPU22x, PC / PPIprogramming cable, withCOMpopulationPC. This is probably the simplest configuration, it is easy to achieve the purpose of the pilot. Here do not need to installProdavesoftware, as long as the"w95_s7.dll"paper copy to your program to the directory can be.2. communication settings: Open "Control Panel" in "SettingsPG / PCinterface" option in the "access point applications "list box, select"S7ONLINE (STEP7) PC / PPI Cable",in its attributes of "overtime" to set up big points, here set to100ms, "baud rate" is set to9.6kbps (because mypc / ppicables made in China, does not support multi-master), "address" for the0.3. Source Code: PLCprocedures:LD I0.0 MOVW 4766, VW0 VBprocedures:

****a statement in the module****:

Public plcadr As plcadrtype

Public gb_PlcConnected As Boolean

Type plcadrtype

adr As Byte 'station address, the default value for2

SEGMENTID As Byte 'paragraph identifier, fixed value of0

SLOTNO As Byte 'slot number, the default value of2

RACKNO As Byte 'rack number,0

End Type

Public Res As Long

Declare Function load_tool Lib "w95_s7.dll" (ByVal nr As Byte, ByVal dev As String, adr As plcadrtype) As Long

....... fixed 'omitted other defined functions.

Declare Function as200_vs_field_read Lib "w95_s7.dll" (ByVal nr As Long, ByVal anz As Long, value As Byte) As Long 'Reading200PLC Vstore data function

****a statement in the form****

Private Sub Form_Load ()

Dim buffer ( 1) As Byte

plcadr.adr = 2

plcadr.SEGMENTID = 0

plcadr.SLOTNO = 2

plcadr.RACKNO = 0

Res = load_tool (1, "S7ONLINE", plcadr)

Res = as200_vs_field_read (0, 2, buffer (0))

If Res <> 0 Then

MsgBox (" PLCconnection error")

gb_PlcConnected = False

Else

gb_PlcConnected = True

MsgBox ( "plcconnected correctly")

Label1.Caption = buffer (0) * 256 buffer (1)

End If

End Sub

through the above-mentioned procedure can be correctly read out thePLCdata. can be extended after the content, the preparation of a monitoring software.

Download url
Products
Document
Software
Example
Note
Please Use "Adobe Reader" to Open the PDF files.
Usefull
(10)
76.9%
Unusefull
(3)
23.1%
-------------------------------------
Latest Comments view all comment
Post comment view all comment
Please consciously abide by Internet-related policies and regulations, is strictly prohibited publication of pornographic, violent, reactionary remarks.
vote:
Expression:
User Name: Password: SafeCode:
Recommended Document
Rand
  • S7-200 Communication with Visua
  • S7-200 freeport example