Jazz Soft Contact us?   JazzSoft@live.com     English   English  Japanese  Chinese (Traditional)  Chinese (Simlified)
Factory Automation & Yield Management Solution Provider 
Skip Navigation LinksHome > Products > Savoy > Samples > Host (Visual C# 2008)

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

Savoy ActiveX Control   




Brochures

Japanese

Savoy Sample - Mini Host (Visual C# 2008)

This tutorial will explain programming with Savoy by making a mini host application.


Specification of Mini Host

Following is the specification of mini host which will control a general wafer inspection tool.

  • Attempt on-line, select recipe, start inspection and collect data.
  • The messages this software can send are as follows.


    Select.req
    Select.rsp
    S1F13
    S2F41
    S6F12


  • The messages this software can receive are as follows.


    Select.req
    Select.rsp
    S1F14
    S2F42
    S6F11


  • Initial setting on equipment side had already been configured and done.
  • Stream 9 and function 0 will not be processed.
  • Don't check T3 timeout.

Create New Project

  1. Launch Visual Studio 2017 and click [New] - [Project...] from File menu.


  2. Choose "Windows Forms Application" from "Visual C#" project type, and type project name and folder name. For example, project name could be "SavoyTutorialCS2008". If setting was OK, click "OK" button.


  3. New project was created.



Add Savoy into Toolbox

Following procedure should be done only once. User doesn't have to do this again next time.
  1. Right click on empty area on Toolbox, click "Choose Items..." from the popup menu. This may take more than one minute until the next screen will appear.




  2. Select "COM Components" tab and put check mark on "Savoy ActiveX Control module". Click "OK" button.




  3. Since Savoy will be added to tool box, add new tab such as "Jazz Soft" and put them in it for ease of access in a future, if needed.




Paste Savoy into Form

  1. Place 1 SavoyHsms and 2 SavoySecsIIs on the form as follows.




  2. Make button event handler function. If user clicks "Open" button, communication setting dialog box of SavoyHsms will appear on the screen. And then establish connection, if user clicks "Open" button. Since communication setting would be saved in "Savoy.ini" file, user doesn't have to change the setting next time.

    Visual C#

    private void button1_Click(object sender, EventArgs e)
    {
      // Setup
      hsms.LoadIniFile();
      if (hsms.Setup(""))
      {
        // If OK button was pressed, establish connection
        hsms.Connect = true;
      }
    }



  3. If user clicks "Online" button, send S1F13 message.

    Visual C#

    private void button2_Click(object sender, EventArgs e)
    {
      // Send S1F13
      outmsg.SML = "s1f13w{}";
      hsms.Send(outmsg.Msg);
    }



  4. If user clicks "PP Select" button, send remote command "PP-SELECT".

    Visual C#

    private void button3_Click(object sender, EventArgs e)
    {
      // Send S2F41 PP-Select
      outmsg.SML = "s2f41w{<a'PP-SELECT'>{{<a'PPID'><a'" + textBox1.Text + "'>}}}";
      hsms.Send(outmsg.Msg);
    }



  5. If user clicks "PP Start" button, send remote command "START".

    Visual C#

    private void button4_Click(object sender, EventArgs e)
    {
      // Send S2F41 Start
      outmsg.SML = "s2f41w{<a'START'>{{}}}";
      hsms.Send(outmsg.Msg);
    }



Event Procedure

Capture events from SavoyHsms control.
  1. If Connected event occurs, send select request message.

    Visual C#

    private void hsms_Connected(object sender, AxSAVOYLib._DSavoyHsmsEvents_ConnectedEvent e)
    {
      // Connected
      // Send select request
      outmsg.SML = "Select.req";
      hsms.Send(outmsg.Msg);
    }



  2. If Received event occurs, pass incoming message to SavoySecsII control to analyze message structure.

    Visual C#

    private void hsms_Received(object sender, AxSAVOYLib._DSavoyHsmsEvents_ReceivedEvent e)
    {
      inmsg.Msg = e.lpszMsg;



  3. If incoming message requires reply message, return appropriate message such as "<b 0>".

    Visual C#

    switch(inmsg.SType)
    {
    case 0:
      // Data message
      if(inmsg.Wbit && (inmsg.Function % 2)!=0)
      {
        // Need to reply something...
        outmsg.SML = "<b 0>";
        outmsg.Reply(e.lpszMsg);
        hsms.Send(outmsg.Msg);
      }
      break;



  4. If select request message arrives, reply select response message.

    Visual C#

    case 1:
    // Select request
    outmsg.SML = "Select.rsp";
    outmsg.Reply(e.lpszMsg);
    hsms.Send(outmsg.Msg);
    break;



Entire Source Code

That's it. This project was created from zero, however, the number of lines of entire source code is only 83 lines including empty lines and comments. Actual code we wrote was only 30 lines except comment lines. We didn't write any configuration file or data file which typically was required by competitors' products. Competitors' products are never as simple as Savoy.

Visual C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SavoyTutorialCS2008
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      // Setup
      hsms.LoadIniFile();
      if (hsms.Setup(""))
      {
        // If OK button was pressed, establish connection
        hsms.Connect = true;
      }
    }

    private void button2_Click(object sender, EventArgs e)
    {
      // Send S1F13
      outmsg.SML = "s1f13w{}";
      hsms.Send(outmsg.Msg);
    }

    private void button3_Click(object sender, EventArgs e)
    {
      // Send S2F41 PP-Select
      outmsg.SML = "s2f41w{<a'PP-SELECT'>{{<a'PPID'><a'" + textBox1.Text + "'>}}}";
      hsms.Send(outmsg.Msg);
    }

    private void button4_Click(object sender, EventArgs e)
    {
      // Send S2F41 Start
      outmsg.SML = "s2f41w{<a'START'>{{}}}";
      hsms.Send(outmsg.Msg);
    }

    private void hsms_Connected(object sender, AxSAVOYLib._DSavoyHsmsEvents_ConnectedEvent e)
    {
      // Connected
      // Send select request
      outmsg.SML = "Select.req";
      hsms.Send(outmsg.Msg);
    }

    private void hsms_Received(object sender, AxSAVOYLib._DSavoyHsmsEvents_ReceivedEvent e)
    {
      inmsg.Msg = e.lpszMsg;
      switch(inmsg.SType)
      {
      case 0:
        // Data message
        if(inmsg.Wbit && (inmsg.Function % 2)!=0)
        {
          // Need to reply something...
          outmsg.SML = "<b 0>";
          outmsg.Reply(e.lpszMsg);
          hsms.Send(outmsg.Msg);
        }
        break;
      case 1:
        // Select request
        outmsg.SML = "Select.rsp";
        outmsg.Reply(e.lpszMsg);
        hsms.Send(outmsg.Msg);
        break;
      }
    }
  }
}

Contact us?   JazzSoft@live.com
  Copyright © 1997 - 2024 Jazz Soft, Inc.