Oriel Cornerstone 130 User manual

Family of Brands –ILX Lightwave® • New Focus™ • Ophir® • Corion • Richardson Gratings™ • Spectra-Physics®
CS API v3.01 QSG, Rev A
S
Programming Interface
Manual
Quick Start Guide
Cornerstone™130 & 260

CS API v3.01 QSG
Programming Interface Manual
2
TABLE OF CONTENTS
1SAFETY INFORMATION .....................................................................................................................3
2INTRODUCTION..................................................................................................................................4
2.1 BUILDS...................................................................................................................................4
2.2 GETTING STARTED..............................................................................................................4
2.3 USING IN C#.NET AND C++.................................................................................................4
3C# DLL USAGE....................................................................................................................................4
3.1 Calling the DLL in C#.NET.....................................................................................................6
4USAGE C++ DLL..................................................................................................................................8
5WARRANTY AND SERVICE .............................................................................................................10
5.1 CONTACTING NEWPORT CORPORATION......................................................................10
5.2 REQUEST FOR ASSISTANCE / SERVICE.........................................................................11
5.3 REPAIR SERVICE ...............................................................................................................11
5.4 NON-WARRANTY SERVICE...............................................................................................11
5.5 WARRANTY SERVICE........................................................................................................12
5.6 LOANER / DEMO MATERIAL..............................................................................................13

CS API v3.01 QSG
Programming Interface Manual
3
1 SAFETY INFORMATION
Thank you for your purchase of the Cornerstone 130/260 spectroscopy instrument from Oriel
Instruments®.
Please carefully read the important safety precautions provided with each instrument that will be
controlled by the software, prior to unpacking and operating the equipment. In addition, please refer to
the complete User’s Manual and all other documentation provided for additional important notes and
cautionary statements regarding the use and operation of the instruments.
Do not attempt to operate any system without reading all the information provided with each of the
components.
Please read all instructions that were provided prior to operation of the system. If
there are any questions, please contact Oriel Instruments or the representative
through whom the system was purchased.

CS API v3.01 QSG
Programming Interface Manual
4
2 INTRODUCTION
This is a description of low-level drivers for 32 and 64-Bit Windows 7 and newer Operating Systems. The
information in this Quick Start Guide is applicable only for version 3.01 of the Cornerstone Series API. If
support for a different version is required, contact your Oriel Sales Representative.
2.1 BUILDS
Driver for C++,
Driver for C#.NET
2.2 GETTING STARTED
Before using any of these projects, the user must first setup and configure their Oriel Cornerstone unit for
use. Going through the setup steps in their unit’s User’s Manual is recommended.
The correct USB Drivers for their Operating System also need to be installed on the computer intended
for use with the Cornerstone unit.
Verify the DLL is in the same folder or in command path of executable before running, or it will not be
found.
Note: The DLLs provided in the Cornerstone Series API v3.01 .zip files are not backwards
compatible with commands and project files associated with previous versions of Cornerstone
APIs.
2.3 USING IN C#.NET AND C++
The following pages will detail how to interface with the instrument from either language. Other .NET
languages can also interface with the C#.NET DLL, as this is a function of the .NET languages. Please
see Microsoft documentation on how to adapt the code accordingly.
3 C# DLL USAGE
Provided DLL’s:
-In lib Folder of CornerstoneSample-v3-01.zip → CornerstoneApp
Cornerstone.dll –Specific to Cornerstone
CyUSB.dll –Required support DLL
These DLLs are compatible with both 32 and 64-bit versions of Windows 7 and newer operating systems.
See Sample Project File titled CornerstoneApp.sln for functioning C# sample.
Commands Supplied in C# API:
Cornerstone(Boolean connect)
Cornerstone(Boolean connect, Int32 deviceNumber)
void setActiveDevice(Int32 deviceNumber)
bool connectAll()
void disconnect()

CS API v3.01 QSG
Programming Interface Manual
5
bool sendCommand(string command)
string getResponse()
string getResponseFromCommand(string command) // Most Used Command
// These are variations of getResponseFromCommand that formats the return for you:
int getIntResponseFromCommand(string command)
double getDoubleResponseFromCommand(string command)
string getStringResponseFromCommand(string command)
string getLastMessage() –Updates with commands/responses sent and received
double getBandpass()
void setBandpass(double bandpass)
int getFilter()
void setFilter(int filter)
string getFilterLabel(int filter_position)
void setFilterLabel(int filter_position, string label)
double getWavelength()
bool setWavelength(double wavelength)
bool getShutter()
void setShutter(bool status)
string getUnits()
void setUnits(WAVELENGTH_UNITS unit)
Here is the enum that is used for the above commands:
enum WAVELENGTH_UNITS
{
NM,
UM,
WN
}
int getSlitWidth(CS_PORT port)
void setSlitWidth(CS_PORT port, int width)
int getSlitMicrons(CS_PORT port)
Here is the enum that is used for the above commands:
enum CS_PORT
{
ONAXISC,
OFFAXISB,
INPORTA
}
double getGratZero(int grating)
void setGratingZero(int grating, double zero)
string getGrating()
bool setGrating(int grating)

CS API v3.01 QSG
Programming Interface Manual
6
string getGratingLabel(int grating)
void setGratingLabel(int grating, string label)
double getGratingOffset(int grating)
int getGratingLines(int grating)
void setGratingLines(int grating, int lines)
double getFactor(int grating)
void setFactor(int grating, double factor)
void handshake(bool on)
void setStep(int step)
void setWaitTime(int wait)
Set communication timeout, it defaults to 10 (ms).
int getWaitTime()
Get current communication timeout
3.1 CALLING THE DLL IN C#.NET
This demonstrates how to call the DLL in C# .NET.
Below the code is how to add a DLL Reference to a .NET project. (You will need to right click on the
project and Add a Reference to the DLL’s also, to add these references to your project).
The code below is the clearest way to see how to connect, but here are the steps.
1. Add Code Reference to both the Cornerstone DLL and the CyUSB (Cypress) DLL.
2. In the Form Designer file {Form.Designer} add the ‘using’ sections
3. {Form.Designer} Create new Cornerstone object
4. {Form.Designer} Connect and verify instrument responds
Changes to (Form Designer) file: –Abbreviated to show added code snippets
//…
using CyUSB;
using CornerstoneDll;
namespace CornerstoneApp
{
partial class MainForm
{
/// <summary>
//….
USBDeviceList usbDevices;
CyUSBDevice cornerstone;

CS API v3.01 QSG
Programming Interface Manual
7
Cornerstone cs = new Cornerstone(true);
Int32 deviceCount = 0;
public MainForm()
{
InitializeComponent(); // This is C# standard form init function
connect();
usbDevices.DeviceAttached += new EventHandler(usbDevices_DeviceAttached);
usbDevices.DeviceRemoved += new EventHandler(usbDevices_DeviceRemoved)
}
/// These two functions below handle dynamic USB plug and unplug events
void usbDevices_DeviceRemoved(object sender, EventArgs e)
{
USBEventArgs usbEvent = e as USBEventArgs;
cs.disconnect();
}
void usbDevices_DeviceAttached(object sender, EventArgs e)
{
USBEventArgs usbEvent = e as USBEventArgs;
cs.connect();
connect();
}
void connect()
{
cornerstone = cs.device;
usbDevices = cs.usbDevices;
deviceCount = usbDevices.Count;
}
void toggleButtons(Boolean toggle)
{
btnResponse.Enabled = toggle;
btnSend.Enabled = toggle;
btnQuery.Enabled = toggle;
}
C# (Form file) code –Abbreviated to show added code snippets
..
using CornerstoneDll;
namespace CornerstoneApp
{

CS API v3.01 QSG
Programming Interface Manual
8
public partial class MainForm : Form
{
public Int32 nActiveUnit = 1; // Used only for multiple devices (default) below
private void btnSend_Click(object sender, EventArgs e)
{
cs.sendCommand(txtComand.Text);
txtInfo.Text = cs.getLastMessage();
}
private void btnResponse_Click(object sender, EventArgs e)
{
txtInfo.Text = cs.getResponse();
}
//====================== Second Controls for second device if needed
// NOT needed for only one device.
private void btnSend2_Click(object sender, EventArgs e)
{
cs.setActiveDevice(cs.usbDevices.Count);
cs.sendCommand(txtComand2.Text);
txtInfo.Text = cs.getLastMessage();
cs.setActiveDevice(nActiveUnit);
}
private void btnResponse2_Click(object sender, EventArgs e)
{
cs.setActiveDevice(cs.usbDevices.Count);
txtInfo.Text = cs.getResponse();
cs.setActiveDevice(nActiveUnit);
}
4 USAGE C++ DLL
This demonstrates how to call the Oriel Cypress DLL in C++.
Files:
Oriel_USB.h –Header file of functions (inside a class object that needs to be created)
X86(32 Bit) / x64 (64 Bit) versions of:
Oriel_USB.dll and Oriel_USB.lib
The .lib file is used for programmic linking, and the .DLL needs to be in the folder or path to be found by
any executable that uses it.
Oriel_USB.h file provides an COriel_USB class that links DLL functions to connect and control the
Cornerstone.

CS API v3.01 QSG
Programming Interface Manual
9
To use the DLL:
1) Add Oriel_USB.lib and Oriel_USB.dll to project
2) Add Oriel_USB.h to #include in header file of project.
3) Create class object with “COriel_USB myDevice;”
4) Call functions in DLL such as: “myDevice.Send(strCommand);”
Reminder: Verify the DLL is in the same folder or in command path of executable before running.
Functions Defined in class:
char * GetLibraryVersion(void);
INT32 Send(const char* strCommand);
INT32 Read(LPSTR strReturn);
INT32 Query(const char* strCommand, char* strReturn);
Sample Query code:
void OnBtnQuery()
{
CString strCommand;
CString strCommunication;
char strPass[256];
char strReturn[1024];
// Command to send
GetDlgItemTextW(cntlCommand, strCommand);
strcpy_s(strPass, CStringA(strCommand).GetString());
strcpy_s(strReturn, "");
LPSTR pstrReturn = strReturn; // Response variable
// Query instrument
INT32 bSuccess = myDevice.Query(strPass, pstrReturn);
if (bSuccess)
{
strCommunication.Append(CString(strReturn));
}
else
{
strCommunication.Append(L"Attempting Read... Failed");
}
History.SetWindowTextW(strCommunication);
}

CS API v3.01 QSG
Programming Interface Manual
10
5 WARRANTY AND SERVICE
5.1 CONTACTING NEWPORT CORPORATION
Oriel Instruments belongs to Newport Corporation's family of brands. Thanks to a steadfast
commitment to quality, innovation, hard work and customer care, Newport is trusted the world over
as the complete source for all photonics and laser technology and equipment.
Founded in 1969, Newport is a pioneering single-source solutions provider of laser and photonics
components to the leaders in scientific research, life and health sciences, photovoltaics,
microelectronics, industrial manufacturing and homeland security markets.
Newport Corporation proudly serves customers across Canada, Europe, Asia and the United
States through numerous international subsidiaries and sales offices worldwide. Every year, the
Newport Resource catalog is hailed as the premier sourcebook for those in need of advanced
technology products and services. It is available by mail request or through Newport's website.
The website is where one will find product updates, interactive demonstrations, specification charts
and more.
To obtain information regarding sales, technical support or factory service, United States and
Canadian customers should contact Newport Corporation directly.
Newport - Oriel Instruments
1791 Deere Avenue
Irvine, CA 92606 USA
Telephone: 800-222-6440 (toll-free in United States)
949-863-3144
Fax: 949-253-1680
Sales: oriel.sales@newport.com
Technical assistance: oriel.tech@newport.com
Repair Service: rma.service@newport.com
Customers outside of the United States must contact their regional representative for all sales,
technical support and service inquiries. A list of worldwide representatives can be found on the
following website: http://www.newport.com/oriel.

CS API v3.01 QSG
Programming Interface Manual
11
5.2 REQUEST FOR ASSISTANCE / SERVICE
Please have the following information available when requesting assistance or service:
Contact information for the owner of the product.
Instrument model number (located on the product label).
Product serial number and date of manufacture (located on the product label).
Description of the problem.
To help Newport’s Technical Support Representatives diagnose the problem, please note the
following:
Is the system used for manufacturing or research and development?
What was the state of the system right before the problem?
Had this problem occurred before? If so, when and how frequently?
Can the system continue to operate with this problem, or is it non-operational?
Were there any differences in the application or environment before the problem occurred?
5.3 REPAIR SERVICE
If the instrument needs to be returned, a Return Material Authorization (RMA) number or Return
(RE) number must be obtained prior to shipment to Newport. This RMA or RE number must
appear on both the shipping container and the package documents.
Return the product to Newport, freight prepaid, clearly marked with the RMA or RE number and it
either will be repaired or replaced it at Newport's discretion.
Newport is not responsible for damage occurring in transit. The Owner of the product bears all risk
of loss or damage to the returned Products until delivery at Newport’s facility. Newport is not
responsible for product damage once it has left the facility after repair or replacement has been
completed.
Newport is not obligated to accept products returned without an RMA number. Any return
shipment received by Newport without an RMA number may be reshipped by Newport, freight
collect, to the Owner of the product.
5.4 NON-WARRANTY SERVICE
For Products returned for repair that are not covered under warranty, Newport's standard repair
charges shall be applicable in addition to all shipping expenses. Unless otherwise stated in
Newport's repair quote, any such out-of-warranty repairs are warranted for ninety (90) days from
date of shipment of the repaired Product.
Newport will charge an evaluation fee to examine the product and determine the most appropriate
course of action. Payment information must be obtained prior to having an RMA number
assigned. Customers may use a valid credit card, and those who have an existing account with
Newport Corporation may use a purchase order.
When the evaluation had been completed, the owner of the product will be contacted and notified
of the final cost to repair or replace the item. If the decision is made to not proceed with the
repair, only the evaluation fee will be billed. If authorization to perform the repair or provide a
replacement is obtained, the evaluation fee will be applied to the final cost. A revised purchase
order must be submitted for the final cost. If paying by credit card, written authorization must be
provided that will allow the full repair cost to be charged to the card.

CS API v3.01 QSG
Programming Interface Manual
12
5.5 WARRANTY SERVICE
If there are any defects in material or workmanship or a failure to meet specifications, notify
Newport Corporation promptly, prior to the expiration of the warranty.
Except as otherwise expressly stated in Newport’s quote or in the current operating manual or
other written guarantee for any of the Products, Newport warrants that, for the period of time set
forth below with respect to each Product or component type (the "Warranty Period"), the Products
sold hereunder will be free from defects in material and workmanship, and will conform to the
applicable specifications, under normal use and service when correctly installed and maintained.
Newport shall repair or replace, at Newport's sole option, any defective or nonconforming Product
or part thereof which is returned at Buyer's expense to Newport’s facility, provided, that Buyer
notifies Newport in writing promptly after discovery of the defect or nonconformity and within the
Warranty Period. Products may only be returned by Buyer when accompanied by a return material
authorization number ("RMA number") issued by Newport, with freight prepaid by Buyer. Newport
shall not be responsible for any damage occurring in transit or obligated to accept Products
returned for warranty repair without an RMA number. The buyer bears all risk of loss or damage to
the Products until delivery at Newport’s facility. Newport shall pay for shipment back to Buyer for
Products repaired under warranty.
WARRANTY PERIOD
All Products (except consumables such as lamps, filters, etc.) described here are warranted for a
period of twelve (12) months from the date of shipment or 3000 hours of operation, whichever
comes first.
Lamps, gratings, optical filters and other consumables / spare parts (whether sold as separate
Products or constituting components of other Products) are warranted for a period of ninety (90)
days from the date of shipment.
WARRANTY EXCLUSIONS
The above warranty does not apply to Products which are (a) repaired, modified or altered by any
party other than Newport; (b) used in conjunction with equipment not provided or authorized by
Newport; (c) subjected to unusual physical, thermal, or electrical stress, improper installation,
misuse, abuse, accident or negligence in use, storage, transportation or handling, alteration, or
tampering, or (d) considered a consumable item or an item requiring repair or replacement due to
normal wear and tear.

CS API v3.01 QSG
Programming Interface Manual
13
DISCLAIMER OF WARRANTIES; EXCLUSIVE REMEDY
THE FOREGOING WARRANTY IS EXCLUSIVE AND IN LIEU OF ALL OTHER WARRANTIES.
EXCEPT AS EXPRESSLY PROVIDED HEREIN, NEWPORT MAKES NO WARRANTIES,
EITHER EXPRESS OR IMPLIED, EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY
OR OTHERWISE, REGARDING THE PRODUCTS, SOFTWARE OR SERVICES. NEWPORT
EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE FOR THE PRODUCTS, SOFTWARE OR SERVICES. THE
OBLIGATIONS OF NEWPORT SET FORTH IN THIS SECTION SHALL BE NEWPORT'S SOLE
LIABILITY, AND BUYER'S SOLE REMEDY, FOR BREACH OF THE FOREGOING
WARRANTY. Representations and warranties made by any person including distributors, dealers
and representatives of Newport Corporation which are inconsistent or in conflict with the terms of
this warranty shall not be binding on Newport unless reduced to writing and approved by an
expressly an authorized officer of Newport.
5.6 LOANER / DEMO MATERIAL
Persons receiving goods for demonstrations or temporary use or in any manner in which title is not
transferred from Newport shall assume full responsibility for any and all damage while in their care,
custody and control. If damage occurs, unrelated to the proper and warranted use and
performance of the goods, recipient of the goods accepts full responsibility for restoring the goods
to their original condition upon delivery, and for assuming all costs and charges.
Confidentiality & Proprietary Rights
Reservation of Title:
The Newport programs and all materials furnished or produced in connection with them ("Related Materials") contain trade secrets
of Newport and are for use only in the manner expressly permitted. Newport claims and reserves all rights and benefits afforded
under law in the Programs provided by Newport Corporation.
Newport shall retain full ownership of Intellectual Property Rights in and to all development, process, align or assembly technologies
developed and other derivative work that may be developed by Newport. Customer shall not challenge, or cause any third party to
challenge the rights of Newport.
Preservation of Secrecy and Confidentiality and Restrictions to Access:
Customer shall protect the Newport Programs and Related Materials as trade secrets of Newport, and shall devote its best efforts to
ensure that all its personnel protect the Newport Programs as trade secrets of Newport Corporation. Customer shall not at any time
disclose Newport's trade secrets to any other person, firm, organization, or employee that does not need (consistent with
Customer's right of use hereunder) to obtain access to the Newport Programs and Related Materials. These restrictions shall not
apply to information (1) generally known to the public or obtainable from public sources; (2) readily apparent from the keyboard
operations, visual display, or output reports of the Programs; 3) previously in the possession of Customer or subsequently
developed or acquired without reliance on the Newport Programs; or (4) approved by Newport for release without restriction.
First printing 2015
© 2015 by Newport Corporation, Irvine, CA. All rights reserved.
No part of this manual may be reproduced or copied without the prior written approval of Newport Corporation.
This manual has been provided for information only and product specifications are subject to change without notice.
Any change will be reflected in future printings.
Newport Corporation 1791 Deere Avenue Irvine, CA, 92606 USA
This manual suits for next models
1
Table of contents