Model 621 User’s Manual APPLICATION PROGRAMMING INTERFACE (API)
Bristol Instruments, Inc. 28
DECLSPEC float __cdecl CLGetPowerReading(int DevHandle);
Function:
Get the current power reading.
Parameters:
DeviceHandle: a valid CLDevice handle.
Returns:
32 bit floating point value of the power in units of milliwatts (mW).
Custom Program Interface - Direct Communication
Remote communication directly between a custom program and the 621 Laser
Wavelength Meter, without using the Windows dll, is described in this section.
The 621 Laser Wavelength Meter uses a Silicon Labs CP2101 USB to UART bridge
controller. The drivers, provided on the NuView Software CD, must be installed before
remote communication can occur. This installation was done during the Software
Installation described in Section 2. The port must first be opened to access the
instrument and then the port must be closed at the end of your program.
Acronyms used in this section:
APC Application Personal Computer
ET Escape Token
DSPB DSP Board inside the wavelength meter
PC Personal Computer
PPP Point-to-Point Protocol
RFC Request for Comment
ST Start Token
Interface Overview
A scheme implemented within the PPP as defined in the document RFC 1549 will be
utilized to uniquely identify the start of messages. RFC 1549 is a document created by
the Network Working Group as the PPP was being established. The PPP uses a 0x7E to
indicate the start/end of packets and 0x7D as an escape byte. The escape byte is used to
indicate that the next byte has been converted to a different value using a well-known
conversion function. This escaping of bytes allows the values of 0x7E and 0x7D to be
sent as data but in a converted format. The receiver of the converted values must convert
them back to their original values using the same well-known function. The APC-DSPB
will utilize this same scheme.
In order to facilitate the detection of message boundaries, all messages will begin with
the control byte 0x7E. Messages will not be terminated with a control byte. The 0x7E
byte will be referred to as the start token, abbreviated “ST”. Since messages can contain
the value 0x7E as part of its data, an escape byte, 0x7D, will be used to escape
occurrences of 0x7E. The 0x7D will be used to escape itself in data as well. The 0x7D
byte will be referred to as the escape token, abbreviated “ET”. Escaped values will be
calculated as the exclusive OR of the byte with the value 0x20. This same operation is
used to un-escape the byte.