Hi, i developed my application in Visual Basic 6, and use a timer(1second) to receive a value from a PLC.
That works fine.
But after aproximadately 40minutes, he only receive a value 0, if i close and reopen my software, he back to receive a value normaly, but after aproximadately 40 minutes, receive only value 0 again.
I'm using a conection with a CLP Siemens S7 315, and a ethernet TCP/IP connection.
Any idea to resolve my problem?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My code actually:
Configuration of the module LIBNODAVE:
Private Function initialize(ByRef ph As Long, ByRef di As Long, ByRef dc As Long)
ph = 0
di = 0
dc = 0
Rem uncomment the daveSetDebug... line, save your sheet
Rem run excel from dos box with: excel yoursheet >debugout.txt
Rem send me the file debugout.txt if you have trouble.
Rem Call daveSetDebug(daveDebugAll)
initialize = -1
res = -1
peer$ = Form1.IP_PLC
ph = openSocket(102, peer$) ' for ISO over TCP
If (ph > 0) Then
di = daveNewInterface(ph, ph, "IF1", 0, daveProtoISOTCP, daveSpeed187k)
res = daveInitAdapter(di)
If res = 0 Then
MpiPpi = 2
Rack = 0
Slot = 2
dc = daveNewConnection(di, MpiPpi, Rack, Slot)
res = daveConnectPLC(dc)
If res = 0 Then
initialize = 0
End If
End If
End If
End Function
Then i added a new function, to easily my configuration in form:
FunctionSIEMENS_READ(ByValAREAAsString,DBAsInteger,ENDERECOAsInteger,QTDEAsInteger,TIPOAsString)IfQTDE>222ThenMsgBox("Quantidade de bytes excedida !!")SIEMENS_READ=-1ExitFunctionElseDimphAsLong,diAsLong,dcAsLongDimbuffer()AsVariantReDimbuffer(QTDE)res=initialize(ph,di,dc)Ifres=0Thenpdu=daveNewPDUCalldavePrepareReadRequest(dc,pdu)'VERIFICAPARAMETROAREAIfAREA="DB"ThenCalldaveAddVarToReadRequest(pdu,daveDB,DB,ENDERECO,QTDE)IfAREA="M"ThenCalldaveAddVarToReadRequest(pdu,daveFlags,"0",ENDERECO,QTDE)IfAREA="I"ThenCalldaveAddVarToReadRequest(pdu,daveInputs,"0",ENDERECO,QTDE)IfAREA="Q"ThenCalldaveAddVarToReadRequest(pdu,daveOutputs,"0",ENDERECO,QTDE)IfAREA="C"ThenCalldaveAddVarToReadRequest(pdu,daveCounter,"0",ENDERECO,QTDE)IfAREA="T"ThenCalldaveAddVarToReadRequest(pdu,daveTimer,"0",ENDERECO,QTDE)IfAREA="DI"ThenCalldaveAddVarToReadRequest(pdu,daveDI,DB,ENDERECO,QTDE)resultSet=daveNewResultSetres2=daveExecReadRequest(dc,pdu,resultSet)'VERIFICAPARAMETROTIPOIfTIPO="BYTE"ThenFori=0ToQTDE-1res3=daveUseResult(dc,resultSet,i)buffer(i)=daveGetS8(dc)NextEndIfIfTIPO="WORD"ThenFori=0To(QTDE/2)-1res3=daveUseResult(dc,resultSet,i)buffer(i)=daveGetU16(dc)NextEndIfIfTIPO="INT"ThenFori=0To(QTDE/2)-1res3=daveUseResult(dc,resultSet,i)buffer(i)=daveGetS16(dc)NextEndIfIfTIPO="DWORD"ThenFori=0To(QTDE/4)-1res3=daveUseResult(dc,resultSet,i)buffer(i)=daveGetS32(dc)NextEndIfIfTIPO="REAL"ThenFori=0To(QTDE/4)-1res3=daveUseResult(dc,resultSet,i)buffer(i)=daveGetFloat(dc)NextEndIfdaveFree(resultSet)daveFree(pdu)EndIfSIEMENS_READ=buffer()CallcleanUp(ph,di,dc)EndIfEndFunction
And a code used in timer from a form to receive the value from PLC:
PrivateSubTimer1_Timer()'Timer 1sEntradas=SIEMENS_READ("M","0","100","2","BYTE")'Faz a leitura da entrada, e envia a um arrayFori=0To1Forii=0To7Entrada=Entrada&SIEMENS_GETBIT(Entradas(i),ii)'Desmonta o array, convertendo a uma variavelNextiiNextiEndSub
I see more detailed informations at today, and this is here:
_A time for stop receive informations of PLC is: exactly 1hour, 21minutes and 44 seconds.
_A number of times the timer run, is exactly 3174 times.
Before this, the program receive a Speed of the machine, which is at a MW100.
After this, the program only receive a 0 speed. And this is resolved when i close my program, and start again(ONLY THE PROGRAM USING THE LIBNODAVE).
Any friend can help me?
I really need help, for apply his library to my work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You could try running a 2 seconds to see if it runs longer.
Do you keep the connection open? - I believe there is a Keep Alive feature?
Presumably no other application is accessing the PLC - e.g. an HMI?
No other traffic on the Ethernet (Try running it isolated, PC and Ethernet only)
I wrote something in C on a Linux box but it polls PLC once every minute.
Hope this helps,
Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I resolved it, after a very time, i see my error in program.
The problem is i open a connection(socket), and without read a instruction of Clean UP, i added with a close connection(port)
The problem is resolved when i change in Clean UP, sloseport to closesocket.
Now, the program is working fine!
NOTE: The PLC is under a network, working with PROFIBUS(traffic with other 6 PLCs) and a ethernet network too, comunicating with software iFix.
The libnodave in ethernet runs fine with other communication of PLC running at the same time ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, i developed my application in Visual Basic 6, and use a timer(1second) to receive a value from a PLC.
That works fine.
But after aproximadately 40minutes, he only receive a value 0, if i close and reopen my software, he back to receive a value normaly, but after aproximadately 40 minutes, receive only value 0 again.
I'm using a conection with a CLP Siemens S7 315, and a ethernet TCP/IP connection.
Any idea to resolve my problem?
Thanks!
My code actually:
Configuration of the module LIBNODAVE:
Then i added a new function, to easily my configuration in form:
And a code used in timer from a form to receive the value from PLC:
I see more detailed informations at today, and this is here:
_A time for stop receive informations of PLC is: exactly 1hour, 21minutes and 44 seconds.
_A number of times the timer run, is exactly 3174 times.
Before this, the program receive a Speed of the machine, which is at a MW100.
After this, the program only receive a 0 speed. And this is resolved when i close my program, and start again(ONLY THE PROGRAM USING THE LIBNODAVE).
Any friend can help me?
I really need help, for apply his library to my work.
You could try running a 2 seconds to see if it runs longer.
Do you keep the connection open? - I believe there is a Keep Alive feature?
Presumably no other application is accessing the PLC - e.g. an HMI?
No other traffic on the Ethernet (Try running it isolated, PC and Ethernet only)
I wrote something in C on a Linux box but it polls PLC once every minute.
Hope this helps,
Simon
Sorry man,
I resolved it, after a very time, i see my error in program.
The problem is i open a connection(socket), and without read a instruction of Clean UP, i added with a close connection(port)
The problem is resolved when i change in Clean UP, sloseport to closesocket.
Now, the program is working fine!
NOTE: The PLC is under a network, working with PROFIBUS(traffic with other 6 PLCs) and a ethernet network too, comunicating with software iFix.
The libnodave in ethernet runs fine with other communication of PLC running at the same time ;)