NEW! SDK for Microsoft C++ and C#

The SDK includes all the latest SXVR functions and simplifies development of Starlight camera control software.

How to write your own software for an SXV camera


All SXV and SXVF cameras use the same basic communication and download protocol. A driver written for the SXV-H9 can be easily adapted to drive an SXV-M7 or SXV-M25, so a single program can be quite easily constructed to support any of the SXV range. SXV cameras use a USB2.0 interface based on the Cypress CY7C68013 and you will probably find the Cypress data sheets very useful, but certainly not essential for development. All of the ‘firmware’ is already written and is stored within an eeprom inside your camera and so there is no need to know the details of the USB chip operation – just the command set which can be sent from the PC and acted on by the camera.

How the camera initialises:

One of the very attractive features of the CY7C68013 is its inherent flexibilty. Rather than using fixed code, programmed in at manufacture, this chip can be reprogrammed at any time and the driver code updated whenever necessary. The driver is held in an eeprom chip within the camera and is approximately 8K bytes in length. When the camera is first connected to the USB port of the PC, it identifies itself as an ‘Empty Cypress CY7C68013’ but immediately examines the contents of the eeprom and loads them into the processor program memory. The new code then restarts the chip and it now identifies itself as a ‘Starlight Xpress USB2.0 camera driver’. This driver has a ‘VID’ (Vendor identifier) of 1278 (Starlight Xpress Ltd) and a ‘PID’ (Product identifier) which depends on the camera type – the SXV-H9 has a PID of 0119. The first time that the camera is plugged in, these numbers are used by the computer to search the Windows\Inf folder for a suitable Windows driver, and the inf file (e.g. SXVIO_BlockIO_H9.inf) then tells Windows to load ‘SXVIO.sys’. Once this driver has been successfully loaded for the first time, its details will be added to the Windows Registry and the camera will be identified automatically on subsequent occasions.

The camera is now connected as a USB peripheral device, but we can’t use it until Windows has established a link or ‘handle’ to the device. This is done within the camera control program, as follows:

Finding the camera with your software:

When your software starts, it needs to search the ‘Plug & Play’ system for your camera. This is done by using several Windows API calls and a device identification number called the ‘GUID’. The API calls are declared in the Visual Basic module ‘OSinterface.bas’ and the search for the camera is performed by the first part of ‘USBinterface.bas’

The search for USB devices will pick up any that are operating and so some form of unique label should be looked for. In this module, I look for the VID and PID string and check that it matches the camera being used. Make sure that you use the appropriate PID for your camera, we currently use 01** for mono cameras and 03** for colour versions. The SXV-M5 uses 0105, M7is 0107, M9 is 0109, H5 is 0115, H9 is 0119. Just use 03 instead of 01 for the colour types, e.g. the SXV-M5C is 0305. A full list of VID and PID values is given below.

Talking to the camera:

USBinterface.bas includes all of the commands for controlling the camera. Commands are sent in the form of a short string of numerical values, the type of command and the actions required being encoded according to the information in the file ‘sx_usb_prog_ref.txt

Exposures can be made in two ways. If you specify a set of values other than zero in the ‘Ex’ bytes, the internal hardware timer of the camera will start and end the exposure. If zero is sent in the Ex bytes positions, the exposure has to be started and stopped by a software timer. The hardware timer is very accurate (to a few microseconds) so hardware exposures are recommended for short times. Once your exposure time exceeds about 10 seconds the accuracy of either method is similar. A typical exposure sequence is shown in ‘exposure.txt‘.

A complete set of files for a universal Visual Basic application called ‘SXV_control’ is available. Please click here.

Current VID / PID listing for the SXV/SXVF and SXVR camera range:

SXVF-M5 1278 0105
SXVF-M5C 1278 0305
SXVF-M7 1278 0107
SXVF-M7C 1278 0307
SXVF-M8C 1278 0308
SXVF-M9 1278 0109
SXVR-M25C 1278 0325
SXVR-M26C 1278 0326
SXVR-H18 1278 0128
SXVR-H16 1278 0126
SXVR-H35 1278 0135
SXVR-H36 1278 0136
SXVR-H9 1278 0119 (pre June 2004 cameras are 1278 0100)
SXVR-H9C 1278 0319 (pre June 2004 cameras are 1278 0100)
SXV interface 1278 0200
Lodestar 1278 0507
Lodestar-C 1278 0507
CoStar 1278 0517