SIEMENS AG PRODAVE S7
Toolbox for Data Link PGs/PCs to SIMATIC S7
15
3.5.3 PRODAVE under Visual Basic (32-Bit) Example
To enable you to use the PRODAVE functions under Visual-Basic, they must
be declared as follows:
Declare Function load_tool Lib "w95_s7.dll" (ByVal nr As Byte,
ByVal dev As String,
adr As plcadrtype) As Long
Declare Function db_read Lib “w95_s7“ ( ByVal dbno As Long,
ByVal dwno As Long,
amount As Long,
buffer%) As Long
Declare Function unload_tool Lib “w95_s7“ () s Long
Example:
Dim dbno As Long, dwno As Long, amount As Long
Dim buffer(50) As Integer
Type plcadrtype
adr As Byte
SEGMENTID As Byte
SLOTNO As Byte
RACKNO As Byte
End Type
Dim plcadr (5) As plcadrtype
plcadr(0).adr = 2
plcadr(0).SEGMENTID = 0
plcadr(0).SLOTNO = 2
plcadr(0).RACKNO = 0
plcadr(1).adr = 0
res = load_tool (1, ”S7ONLINE”, plcadr)
res = db_read (dbno, dwno, amount, buffer(0))
res = unload_tool()