Dll interface, Opening a connection, Reading data from the neofox – Ocean Optics NeoFox Engineering Note User Manual
Page 5
NeoFox Communication Interfaces
013-20000-010-04-201211 5
Addr
Type
Name
Description
…
5031
be seen in the “sensor waveform window” in the NeoFox Viewer.
5032
uchar
Reserved3
Reserved. Do not depend on this value.
5033
uchar
Reserved4
Reserved. Do not depend on this value.
5034
uchar
Checksum
Set to the aggregate sum of all previous bytes modulus 256.
5035
uchar
Eof
End of transmission character. Set to 0x04
DLL Interface
The NeoFox DLL can be used by developers without the need to understand the USB or serial interface layers.
The DLL itself abstracts these layers and provides an interface of high-level function calls. This DLL interface
can be easily used with almost any programming language: Labview, C, C++, Visual Basic, Java, or even VBA
for excel.
The DLL enables the user to perform any of the following four common actions: It allows users to open a
connection to a NeoFox device, read values from the device, set parameters on the device, and close the
connection to the device. The functions which enable these actions are described below.
Opening a Connection
There are two steps to creating a connection to a NeoFox. First, the user must call the DevicePerformDiscovery
function, which internally creates an index list of all unopened NeoFox units that are connected to the computer.
In addition to creating an indexed list, this function will also inform the user of the number of unopened NeoFox
units that are connected.
Once the list has been created, the user must call the DeviceOpenChannel for each NeoFox unit for which a
connection is to be established. The DeviceOpenChannel function takes an index as its parameter and it opens
the particular NeoFox unit that corresponds to that index in the list that was generated by the
DevicePerformDiscovery function. However, since DevicePerformDiscovery does not provide any information
about the units that it discovers, the indices are essentially arbitrary and in order to select any particular NeoFox
unit, the user will basically need to open all available NeoFox units and they query them each individually to
determine its name. It can then close connections to the units that it does not need.
Reading Data from the NeoFox
Reading variables from the device is accomplished through either of two functions: DeviceGetParameter or
DeviceGetParameterFloat. The determination of which function to use is based on the type of the variable that is
to be read. Use DeviceGetParameterFloat for floating point type parameters and DeviceGetParameter for any
other type of parameter.
It is important to note that the NeoFox is a discrete sampling system. New samples are only refreshed from the
hardware device approximately once every tenth of a second, and operating system latency may result in even
lower throughput. Therefore, developers may find it useful to poll the Millisecond Count variable to evaluate
whether or not information in the DLL has been refreshed since the last time that information was read.