Jazz Soft 您要联络吗?   JazzSoft@live.com     简体字汉语   英语  日语  繁体字汉语  简体字汉语
提供半导体工厂自动化与生产效率改善法 
Skip Navigation Links首页 > 产品一览 > Swing > Samples > Host (Visual Basic 2008)

Dorian.Core is added. Dorian now supports .NET 6 and 7.

Swing ActiveX Control   



Programming Guide - Making a mini host in Visual Basic 2008

This chapter, let's make a mini-host to describe programming technique using SwingSecsI Control and SwingSecsII Control. We use Visual Basic for the development language.


Specification of mini-host

The specification of mini-host is as follows. Equipment that this mini-host can handle is a ordinary wafer inspection system.

  • It is available to handle 'Attempt Online', 'Select Recipe', 'Start Process Program' and 'Measurement Data'.
  • Following messages can be sent:

    S1F13W
    S2F41W
    S6F12

  • Following messages can be received:

    S1F14
    S2F42
    S6F11W

  • It is assumed that equipment has already been initialized and ready to use.
  • Does not concern about Stream 9 and Function 0.
  • Does not watch T3 time out.

Let's make a mini-host application

  1. Make new project
    Launch Visual Basic and select [File] - [New] - [Project] from the menu.



    Choose "Windows Forms Application".



    Project created as follow.




  2. Insert Swing ActiveX Control
    Right click on "Toolbox" and Select "Choose Items..." from the pop-up menu.



    Switch to "COM Components" tab and set check on each Swing ActiveX Control, and then press OK button.



    You will find that Swing ActiveX controls have appeared in tool box.




  3. Paste ActiveX Control
    Paste SwingSecsI Control and SwingSecsII Control on the form. I recommend that you paste 2 SwingSecsII Controls for convenience, because you can treat incoming message and outgoing message separately.



    I don't want to enforce you my programming style. These are all up to you and you can arrange by yourselves.


  4. Open serial port
    When you open serial port, let's write code in FormLoad Event. You can be ready to communicate right after the application comes up.


    .Active = True
    If Not .Active Then
      MsgBox "Error : Cannot open serial port!"
    End If


    This is a tiny sample code. I recommend that you put "Open" button and press it to open serial port, if you develop your system application. Sometimes it can not be opened properly, sometimes customer may not want to open from the beginning.


  5. Send 'Attempt Online' message
    If you send 'Attempt online' command, use Send Method in button pressed event handler function. If mini-host sends S1F13 to equipment, that must be empty list.


    .List = "s1f13w{}"
    AxSwingSecsI1.Send(.Msg)


    Send Method in SwingSecsI Control requires Msg Property of SwingSecsII Control.


  6. Send 'Select Recipe' command
    To specify recipe, send PP-SELECT of S2F41.


    .List = "s2f41w{<a'PP-SELECT'>{{<a'PPID'><a'" + TextBox1.Text + "'>}}}"
    AxSwingSecsI1.Send(.Msg)



  7. Start measurement
    To start measurement, send START of S2F41.


    .List = "s2f41w{<A'START'>{{}}}"
    AxSwingSecsI1.Send(.Msg)



  8. Catch events from equipment
    When you receive a message, it is reported as Read Event. At the very beginning of this event handler procedure, set received message to SwingSecsII Control. Doing so will allow you to browse other properties.


    .Msg = e.pszMsg


    You will receive S6F11 from equipment. We handle only following CEIDs.

    CEIDDescription
    10Recipe selected.
    11Recipe selection failure.
    20Measurement completed.
    30Measurement data.

    CEID is located at node '2'. First, we check this value, then do appropriate procedure.


    'CEID .Pointer = "2"
    Select Case CInt(.Value)
    Case 10
      MsgBox "Recipe selected."
    Case 11
      MsgBox "Recipe selection failure."
    Case 20
      MsgBox "Measurement completed."
    Case 30
      'Measurement data.
    End Select


    S6F11 is expecting for reply, so send binary 0 for secondary message.


    AxSwingSecsII2.List = "s6f12<b 0>"
    AxSwingSecsII2.Reply(e.pszMsg)
    AxSwingSecsI1.Send(AxSwingSecsII2.Msg)


    Besides this, you will receive S1F14 and S2F42, you can write the same kind of code.


  9. Run application
    Making mini-host has been completed. his is very simple but still has a minimum functionality as a host system. But entire source code is as short as 63 lines. It is very clear that it is more easier to develop software using Swing ActiveX control than without using it, if you write same kind of software from the beginning.


    Public Class Form1

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Attempt online
        With AxSwingSecsII2
          .List = "s1f13w{}"
          AxSwingSecsI1.Send(.Msg)
        End With
      End Sub

      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Select recipe
        With AxSwingSecsII2
          .List = "s2f41w{<a'PP-SELECT'>{{<a'PPID'><a'" + TextBox1.Text + "'>}}}"
          AxSwingSecsI1.Send(.Msg)
        End With
      End Sub

      Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Start measurement
        With AxSwingSecsII2
          .List = "s2f41w{<a'START'>{{}}}"
          AxSwingSecsI1.Send(.Msg)
        End With
      End Sub

      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With AxSwingSecsI1
          .Active = True
          If Not .Active Then
            MsgBox("Error : Cannot open serial port!")
          End If
        End With
      End Sub

      Private Sub AxSwingSecsI1_Read(ByVal sender As System.Object, ByVal e As AxSWINGLib._DSwingSecsIEvents_ReadEvent) Handles AxSwingSecsI1.Read
        With AxSwingSecsII1
          .Msg = e.pszMsg
          If .Stream = 1 And .Function = 14 Then
            'S1F14
            MsgBox("You are online")
          End If
          If .Stream = 6 And .Function = 11 Then
            'S6F11
            AxSwingSecsII2.List = "s6f12<b 0>"
            AxSwingSecsII2.Reply(e.pszMsg)
            AxSwingSecsI1.Send(AxSwingSecsII2.Msg)
            'CEID
            .Pointer = "2"
            Select Case CInt(.Value)
            Case 10
              MsgBox("Recipe selected")
            Case 11
              MsgBox("Recipe selection failure")
            Case 20
              MsgBox("Measurement completed")
            Case 30
              'Measurement data
            End Select
          End If
        End With
      End Sub
    End Class

您要联络吗?   JazzSoft@live.com
  Copyright © 1997 - 2024 Jazz Soft, Inc.