Menu

How can i use libnodave.dll

Help
sinan
2011-03-03
2013-05-09
  • sinan

    sinan - 2011-03-03

    hi everbody,

    i am new user to visual studio 2008 ,c# ,  i could not  add  yo referance libnodave.dll in my console project, (i can add libnodave.net.dll  easly)  is there a special methot to use libnodave.dll,

    i manage to connect with usb mpi cable with s7online test program is there any simple examle to usb mpi  porgram with c#

    Thanks a lot, 

     
  • Fernando

    Fernando - 2011-03-03

    In addition to establishing reference frameworks libnodave.net.dll in VS2008, libnodave.dll must be added in the same directory as libnodave.net.dll.

    I have successfully connected via MPI cable. Attached is a sample function, but in VB

    PS: If not connect in the first attempt, try again. In my case connected to the 2 nd attempt

        Private Function Conectar_MPI() As Integer
            Dim res As Integer
            Conectar_MPI = -1
            Try
                mfds = New libnodave.daveOSserialType() 
                mfds.rfd = libnodave.openS7online("S7ONLINE")
                mfds.wfd = mfds.rfd
                res = 0
                If mfds.rfd > 0 Then  ' if step 1 is ok 
                    'Socket establecido
                    'Establecemos el interface que representa la conexión fisica al PLC o a una red de PLCs 
                    '--------------------------------------------------------------------------------------
                    mdi = New libnodave.daveInterface(mfds, "Interface1",0, libnodave.daveProtoS7online, libnodave.daveSpeed187k)
                    '  daveNewInterface(mfds, "IF1", localMPI, daveProtoXXX, daveSpeedYYY);
                    ' LocalMPI y daveSpeed solo tienen sentido para conexiones MPI y profibus
                    mdi.setTimeout(1000)  ' Make this longer if you have a very long response time
                    'Establecemos ahora la conexión lógica al PLC
                    mdc = New libnodave.daveConnection(mdi, 2, 0, 2)  ' rack amd slot don't matter in case of MPI
                     '    mdc =daveNewConnection(mdi, MPI_address, Rack, Slot);
                    'Ahora conectamos
                    res = mdc.connectPLC()
                    If res = 0 Then
                        mEstadoConexion = eEstadoCommPLC.Conectado 'Conectado
                    Else
                        mdc.disconnectPLC()
                        libnodave.closePort(mfds.rfd)
                        mEstadoConexion = eEstadoCommPLC.Desconectado 'Desconectado
                    End If
                Else
                    mEstadoConexion = eEstadoCommPLC.Desconectado 'Desconectado
                End If 'mfds.rfd >0
                If mEstadoConexion = eEstadoCommPLC.Conectado Then 'Conectado 
                    Conectar_MPI = 0
                End If
            Catch ex As Exception
                'tratar aqui el error msgbox ex.description
            End Try
        End Function
    
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.