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)
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 "MFC Application" from "Visual C++" project type, and type project name and folder name. For example, project name could be "SavoyTutorialVC2008". If setting was OK, click "OK" button.


  3. Welcome screen will appear. Click "Next" button.



  4. Choose "Dialog based" application and uncheck "Use Unicode libraries". Since other settings are OK by default, click "Finish" button.



  5. 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. Assign as variable. Right click on SavoyHsms object, and click "Add Variable" from popup menu.




  3. Change variable type to "CSavoyHsms". The name of ".h file" and ".cpp file" will also be "SavoyHsms.h" and "SavoyHsms.cpp" respectively. Variable name will be "m_hsms". Click "Finish" button.




  4. Do same thing for SavoySecsII control. Change variable type to "CSavoySecsII". The name of ".h file" and ".cpp file" will be "SavoySecsII.h" and "SavoySecsII.cpp" respectively. Variable name will be "m_inmsg" and "m_outmsg" respectively.




  5. Variable for recipe name will be CString type and "m_strPPID".




Overwrite Wrapper Classes

Visual C++ 2008 has some issues regarding ActiveX control wrapper class. So Jazz Soft provided wrapper class to solve this issue. Wrapper class could be made by Visual C++ 6.0, but "enum" is not reflected.
  1. Close Visual C++ 2008 at this time.

  2. Overwrite newly created "SavoyHsms.h", "SavoyHsms.cpp", "SavoySecsII.h" and "SavoySecsII.cpp" with ones provided by Jazz Soft.

  3. Restart Visual C++ 2008 and reload project.

Process Buttons

  1. 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++

    void CSavoyTutorialVC2008Dlg::OnBnClickedButton1()
    {
      // Setup
      m_hsms.LoadIniFile();
      if(m_hsms.Setup(""))
      {
        // If OK button was pressed, establish connection
        m_hsms.SetConnect(true);
      }
    }



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

    Visual C++

    void CSavoyTutorialVC2008Dlg::OnBnClickedButton2()
    {
      // Send S1F13
      m_outmsg.SetSml("s1f13w{}");
      m_hsms.Send(m_outmsg.GetMsg());
    }



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

    Visual C++

    void CSavoyTutorialVC2008Dlg::OnBnClickedButton3()
    {
      // Send S2F41 PP-Select
      UpdateData();
      m_outmsg.SetSml("s2f41w{<a'PP-SELECT'>{{<a'PPID'><a'" + m_strPPID + "'>}}}");
      m_hsms.Send(m_outmsg.GetMsg());
    }



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

    Visual C++

    void CSavoyTutorialVC2008Dlg::OnBnClickedButton4()
    {
      // Send S2F41 Start
      m_outmsg.SetSml("s2f41w{<a'START'>{{}}}");
      m_hsms.Send(m_outmsg.GetMsg());
    }



Event Procedure

Capture events from SavoyHsms control. Event handler function can be created from "Properties" window.


  1. If Connected event occurs, send select request message.

    Visual C++

    void CSavoyTutorialVC2008Dlg::ConnectedSavoyhsmsctrl1(LPCTSTR lpszIPAddress, long lPortNumber)
    {
      // Connected
      // Send select request
      m_outmsg.SetSml("Select.req");
      m_hsms.Send(m_outmsg.GetMsg());
    }



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

    Visual C++

    void CSavoyTutorialVC2008Dlg::ReceivedSavoyhsmsctrl1(LPCTSTR lpszIPAddress, long lPortNumber, LPCTSTR lpszMsg)
    {
      m_inmsg.SetMsg(lpszMsg);



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

    Visual C++

      switch(m_inmsg.GetSType())
      {
      case 0:
        // Data message
        if(m_inmsg.GetWbit() && m_inmsg.GetFunction()%2)
        {
          // Need to reply something...
          m_outmsg.SetSml("<b 0>");
          m_outmsg.Reply(lpszMsg);
          m_hsms.Send(m_outmsg.GetMsg());
        }
        break;



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

    Visual C++

      case 1:
        // Select request
        m_outmsg.SetSml("Select.rsp");
        m_outmsg.Reply(lpszMsg);
        m_hsms.Send(m_outmsg.GetMsg());
        break;
      }
    }



Entire Source Code

That's it. Since the entire source code consists of multiple files, I don't put them here.
This project was created from zero, however, the number of lines in core source code "SavoyTutorialVC2008Dlg.cpp" is only 231 lines including empty lines and comments. Actual code we wrote was only 31 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.
Contact us?   JazzSoft@live.com
  Copyright © 1997 - 2018 Jazz Soft, Inc.