Help with Instron-Merlin OLE Automation Interface

Jan 28, 2004 0 Replies

Hi, I try to use Merlin (ver 5.04) OLE Automation interface with VisualBasic in WindowsNT. Procedure works but after few consecutive RelativeMove commands Merlin stop to respond with severe message: stack overflow. The only way to recover is the system reset. What can you suggest? Thank you for your support. Best regards, Stefan Ion.



Here you are the test form (the project is modified Instron Samples project)



Option Explicit Dim is_connected As Label Dim bStart As Boolean



Private Sub Command1_Click() End End Sub



Private Sub Command2_Click() delta_ct = Text2.Text End Sub



Private Sub connect_Click() On Error GoTo ErrorHandler If MerlinAutomation Is Nothing Then Set MerlinAutomation = CreateObject("Mauto.Application") MerlinAutomation.connect "Load_ct.MerlinEvents" Else MerlinAutomation.disconnect "Load_ct.MerlinEvents" End If Exit Sub


ErrorHandler: If Err.Number = 15106 Then GoTo is_connected If Err.Number 0 Then DisplayError Resume Next End If End Sub



Private Sub disconnect_Click() If Not MerlinAutomation Is Nothing Then MerlinAutomation.disconnect "Load_ct.MerlinEvents" End If End Sub



Private Sub Form_Activate() speed = 0.001 ' mm/sec distance = 0.0001 'mm sens_old = 0 factor = 1 RelativeMoveSuccessful = True End Sub



Private Sub Form_Terminate() If Not MerlinAutomation Is Nothing Then MerlinAutomation.disconnect "Load_ct.MerlinEvents" Set MerlinAutomation = Nothing End If End Sub



Private Sub setload_Click() flag_setload = True Load = Text1.Text End Sub



Private Sub Start_Click() Load = Text1.Text delta_ct = Text2.Text Timer1.Enabled = True bStart = True End Sub



Private Sub Stop_Click() bStart = False Timer1.Enabled = False Shape1.FillColor = &H0 End Sub



Private Sub Timer1_Timer() If Not MerlinAutomation Is Nothing Then If Not bStart Then Timer1.Enabled = False 'sfarsit miscare opreste timer Shape1.FillColor = &H0 Exit Sub End If load1 = MerlinAutomation.GetLoad(E_kgf) Label1.Caption = Load Label2.Caption = load1 delta = load1 - Load Label3.Caption = delta sens_old = sens



If load1 < (Load - delta_ct / 2) Then sens = 1 'up If load1 > (Load + delta_ct / 2) Then sens = -1 'down If (load1 >= (Load - delta_ct / 2) And load1


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required