Simatic OPC handling with VBasic

S

Thread Starter

seppoalanen

Hi,

I have SOFNET-S7 V3.3 and my problem is no open from it helps, no from Siemens web-pages or anywhere else. Whit softnet have example VB-codes, but they don't help me.
OPC-Server and VB-samples have documented 'krypticly' without Examples and so 'anemicly', I can't open some meanings in samble VB-codes.
I tried to do 'S7Conn'-string and that kind of definition have published in STARTUP.TXT file by COML S7 Configuration manager who have produced
name: S7_TCPIP with S7-Protocol.
VFD1 is VitualFieldDevice-name and CP_H1_1 is somwhere in OPC-Server S7-Procol-sheet.
In the ReadVariable-method, how absolute-parameter must write? Nowhere is exactly explained what is format for Input, Merker (Flag), DB-byte, word, doubleword etc..
In many files have contradictory explanations.
In LOG-files and in helps things are contradictory marked.
How must marked DB36's DINT-value who starts from databyte 0 and wants to read 4-bytes as Long-type variable ?
What tells about Status-variable gu (Long) ?
Where have explained error numbers whose functions return (-1073446910) ?

Dim IValue As Variant
Dim OValue As Variant
Dim qu As Long
Const S7Conn = "S7:[S7_TCPIP|VFD1|CP_H1_1:]"

Private Sub Form_Load()
Dim S7 As Long
' DB36.DBD0 includes ID for Access-Handling
' DB36.DBD10 is feedback to PLC, handling rdy
S7 = S7D.ReadVariable(S7Conn + "DB36.DBD0,4", IValue, qu, 100)
S7 = S7 + S7D.WriteVariable(S7Conn + "DB36.DBD10,4", OValue, 100)
S7 = S7 + S7D.Connect
Text4.Text = S7
End Sub

Best Regards, Seppo Alanen
http://www.alanen.info/
 
Top