Communication Driver – Modbus Serial Terminate

Communication Driver – Modbus Serial Terminate

  • 14 marzo 2013 alle 5:25 pm #21043

    I need to terminate a communication driver during Runtime. I found this example in the help file:

    Public Sub Click()

    Dim bInitOk As Boolean
    Set Drv = CreateObject(‘SupervisorDriver.ModbusSerial.1’)
    ‘Drv.SetDriver ‘C:ProjectsTestPrjRESOURCESTestPrj’
    bInitOk = Drv.InitDriver(‘XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX’, ‘C:UsersCMSDocumentsMovicon Projects estemodbusRESOURCESTESTE MODBUS’)
    If Not bInitOk Then
    MsgBox ‘InitDriver failed’
    End If
    If Not Drv.TerminateDriver() Then
    MsgBox ‘TerminateDriver failed!’,vbExclamation,’ERROR’
    End If

    End Sub

    But when I execute this script it gives me an error in this line:

    Set Drv = CreateObject(‘SupervisorDriver.ModbusSerial.1’)

    Who knows the meaning of this function?

    Regards,

    Cristiano

  • 21 marzo 2013 alle 5:55 pm #21044
    Ian_C
    Membro

    Hi,

    in the Help is written that the Terminate Driver function is ‘Only available from external COM clients. Not available from Supervisor BasicScripts’.

    Anyway, why you need to terminate the communication in this way? What do you think about using State/Command variable on Station..?

    Regard

Devi essere loggato per rispondere a questa discussione.