Engineering Note Topic: NeoFox Communication Interfaces Products Affected: NeoFox Date Issued: 04/18/2011 Updated: November 2012 Description NeoFox is a dynamic measurement system that has been designed to work with a variety of optical probes to measure oxygen in a variety of conditions.
NeoFox Communication Interfaces Architecture Overview Variables and Parameters All communication with the NeoFox centers upon either reading or setting variables on the hardware device. For instance, a developer may want to set the number of scans to average parameter or read the current sensor temperature value. In either case, there is a specific variable in the system’s memory which should be set or read.
NeoFox Communication Interfaces NeoFox Serial Interface Overview The NeoFox serial protocol can be used for a number of purposes. Most significantly, future versions of the NeoFox hardware may have an RS232 serial output that will directly expose this protocol.
NeoFox Communication Interfaces Addr Type Name Description 0 uchar Stx Start of transmission character. Set to 0x03. 1 uchar PacketType Set to 0xC8 2 ushort FrameSize Set to 20 (0x14). 4 ulong CmdNumber Reserved. Set to 0. 8 ulong ParamType Type code for the parameter that is to be set. 12 n/a ParamValue Value for the parameter to be set. Can be a float or integer type. 16 uchar Reserved1 Reserved. Set to 0. 17 uchar Reserved2 Reserved. Set to 0.
NeoFox Communication Interfaces Addr Type Name … 5031 Description 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.
NeoFox Communication Interfaces Writing Data to the NeoFox Writing variables to the device is similarly accomplished through either of two functions: DeviceSetParameter or DeviceSetParameterFloat. Again, the determination of which function to use will be based on the type of the data that is to be sent. Closing a Connection When interaction with the device is complete, the connection should be closed by calling the DeviceClose function.
NeoFox Communication Interfaces NeoFox DLL Function Reference int DeviceSetParameter(int hDevice, int ParamType, int dValue) Description Sets an integer parameter on the NeoFox. Parameters int hDevice Handle to an open NeoFox device. int ParamType Unique code for the parameter which is to be set. int dValue Value to be written to the parameter. Return Value Number of bytes written to the hardware device in order to issue the set parameter command message.
NeoFox Communication Interfaces Parameters int hDevice Handle to an open NeoFox device int ParamType Unique code for the parameter which is to be read. LPTSTR szText A character buffer (char*). Be sure to pass this parameter a pointer to an initialized buffer of at least 50 bytes. Return Value The function returns an int that represents the value that has been queried from the device. In some cases, it will also populate the szText buffer with a textual representation of the integer value.
NeoFox Communication Interfaces Return Value This function always returns a value of 1. Remarks This function should be called at the beginning of any user program, before any other DLL functions are called. int DevicePerformDiscovery(int vendorID, int productID, int ShowGUI) Description This function instructs the DLL to create an indexed list of all NeoFox devices that are connected to the system via USB but have not been opened already. Parameters int vendorID Vendor ID for the NeoFox product.
NeoFox Communication Interfaces Remarks This function should be called immediately after the DevicePerformDiscovery function has been called. The DevicePerformDiscovery function will create an indexed list of all NeoFoxes that are connected to the computer via USB and the DevicePerformDiscovery function will then instruct it to open a connection to one of those devices by passing in a specific index from the list and receiving a handle to the connection.
NeoFox Communication Interfaces Driver Interface and Hardware Interface Some developers may wish to access the NeoFox device at the USB driver level or the hardware level. To do this, developers will need to combine the information from the serial interface description in this document with information from the USB-UART bridge chip manufacturer, FTDI. The chip that is used on the NeoFox is the FT232RQ.
NeoFox Communication Interfaces Parameter Name DLL ParamType Constant • • • • • • • • Type Set Function Range Param Type Get Function Address V1 Parameter Name – The name of the parameter, as you will find it throughout this document and others that describe the NeoFox. Type – The data type of the parameter. Range – The valid range of values for the parameter or value. For writable parameters, developers should ensure that the values written are within the acceptable range.
NeoFox Communication Interfaces Float Read-Only Tau NEOFOX_TAU -1 < X 19 736 DeviceGetParameterFloat Tau is an intermediate value, expressed in microseconds, that is calculated in the conversion from phase to oxygen. It should be used for diagnostic purposes only. Temperature Source NEOFOX_CAL_TEMP_SOURCE Uint Enum DeviceSetParameter 165 316 DeviceGetParameter Temperature Source determines which source should be used for temperature measurement during calibration.
NeoFox Communication Interfaces Name NEOFOX_NAME char[] Read-Only n/a 1 n/a DeviceGetParameter This is the unique serial number that is programmed in to every NeoFox unit. Unfortunately, it cannot be read through the serial interface. To read this parameter from the DLL, call DeviceGetParameter and the serial number will be populated into the szText buffer. The serial number cannot be set through the DLL.
NeoFox Communication Interfaces 0-5V Data Source NEOFOX_AOUT_VOLTAGE_SOURCE Char Enum DeviceSetParameter 212 468 DeviceGetParameter The 0-5V Data Source parameter is one of the 0-5V analog output settings. The value of this particular parameter sets the source value for the following formula, which determines the 0-5V analog output voltage. In the formula, the source value and bound parameters are considered dimensionless scalars – that is, only the actual values matter. The units are irrelevant.
NeoFox Communication Interfaces Uint Enum DeviceSetParameter Autogain Enable NEOFOX_AUTOGAIN_ENABLE 101 600 DeviceGetParameter The Autogain Enable parameter controls whether the NeoFox device will set its gain settings automatically. When autogain is enabled, the APD voltage, LED drive levels, and gain levels will be optimized automatically.
NeoFox Communication Interfaces Ambient Pressure NEOFOX_ADC_PRESSURE Uint Read-Only n/a 15 780 DeviceGetParameter This parameter represents the ambient pressure sensor that is embedded in the NeoFox electronics. It is also important to note that because the ambient pressure sensor is embedded in the electronics and not the probe itself, this sensor will not be sensitive to the pressure in the measurement environment if that environment is distinct from the environment of the electronics unit.
NeoFox Communication Interfaces Firmware Version Hi NEOFOX_FIRMWARE_VER Char Read-Only n/a 2 12 DeviceGetParameter The microcontroller firmware version is stored in two distinct bytes – the Firmware Version Hi value and the Firmware Version Lo value. Concatenated together, these produce the firmware version. Usually, the firmware version is expressed as a hex short, such as 0x0208. This is how the firmware version is displayed in the NeoFox Viewer. It is important to note the following.
NeoFox Communication Interfaces Two Point Slope NEOFOX_CAL_2PT_SLOPE Float n/a DeviceSetParameterFloat 174 196 DeviceGetParameterFloat This is a two point calibration parameter. See the NeoFox Calibration and Measurement engineering note and the NeoFox manual for more information about this parameter. Two Point Offset NEOFOX_CAL_2PT_OFFSET Float n/a DeviceSetParameterFloat 175 200 DeviceGetParameterFloat This is a two point calibration parameter.
NeoFox Communication Interfaces Multi Point Orig C0 NEOFOX_CAL_MULTI_C0 Float n/a DeviceSetParameterFloat 206 232 DeviceGetParameterFloat This is a Multi Point calibration parameter. See the NeoFox Calibration and Measurement engineering note and the NeoFox manual for more information about this parameter. Multi Point Orig C1 NEOFOX_CAL_MULTI_C1 Float n/a DeviceSetParameterFloat 207 236 DeviceGetParameterFloat This is a Multi Point calibration parameter.
NeoFox Communication Interfaces Multi Point Orig C1 NEOFOX_CAL_MULTI_C1 Float n/a DeviceSetParameterFloat 207 236 DeviceGetParameterFloat This is a Multi Point calibration parameter. See the NeoFox Calibration and Measurement engineering note and the NeoFox manual for more information about this parameter. Multi Point Orig C2 NEOFOX_CAL_MULTI_C2 Float n/a DeviceSetParameterFloat 208 240 DeviceGetParameterFloat This is a Multi Point calibration parameter.
NeoFox Communication Interfaces Multi Point SP B0 n/a Float n/a n/a 268 n/a This is a Single Point calibration parameter. It is a copy of its counterpart from the multi-point calibration parameter that is copied during a single point reset. It cannot be read or set through DLL function calls. It also cannot be set through the serial protocol, but it can be read. See the NeoFox Calibration and Measurement engineering note and the NeoFox manual for more information about this parameter.
NeoFox Communication Interfaces Multi Point SP T1 n/a Float n/a n/a 296 n/a This is a Single Point calibration parameter. It is a copy of its counterpart from the multi-point calibration parameter that is copied during a single point reset. It cannot be read or set through DLL function calls. It also cannot be set through the serial protocol, but it can be read. See the NeoFox Calibration and Measurement engineering note and the NeoFox manual for more information about this parameter.
NeoFox Communication Interfaces Float n/a 155 624 Analog Value 2 n/a DeviceSetParameterFloat Not Supported This parameter can be used to drive the analog outputs to a user-specified voltage or current. Just as with the other potential sources for the analog output, it is treated as a dimensionless value that is compared against the upper and lower bound parameters. A typical use would be as follows. A user wants to set the 4-20mA output to a static value of 16mA.
NeoFox Communication Interfaces RS-232 Pins GPIO Connector (as viewed looking towards the back of the NeoFox unit with the graphic label down and the power jack to the left of the connector It is important to note that the device will disable RS232 communications in certain conditions: • • When the RS232 enable parameter is set to 0.
NeoFox Communication Interfaces Target Baud Actual Baud Relative Error Divisor Latch Multiply Value Divisor Add Value 110 110 0.00% 6250 1 11 300 300 0.00% 2500 0 2 1200 1200 0.00% 625 0 2 2400 2400 0.00% 250 1 4 4800 4800 0.00% 125 1 4 9600 9603 0.03% 71 1 10 19200 19182 -0.10% 23 7 10 38400 38352 -0.12% 11 7 9 57600 57692 0.16% 13 0 2 115200 115385 0.16% 6 1 12 230400 230769 0.16% 3 1 12 460800 461538 0.
NeoFox Communication Interfaces Data Copy Settings By default, the NeoFox’s “data dump” structure is big, and many host devices cannot handle a data stream of around 60,000 KBps. Therefore, settings have been developed that allow the user to reduce the size and frequency of the NeoFox’s data dump. Specifically, there are two features which have been added: • Data Copy Mode • Data Copy Type To understand what these features do, it is important to understand how the Neofox samples and transmits its data.
NeoFox Communication Interfaces Type 3 Structure Format Addr Type Name Description 0 uchar Stx Start of transmission character. Set to 0x03. 1 uchar PacketType Set to 0xDC 2 ushort FrameSize Set to 5036 (0x13AC) 4 uchar FrameCount Number of frames uploaded since the device powered on. This rolls over after 255. It can be used to determine whether any frames have been missed. 5 uchar ProtocolRev This byte will always be 0x03 when the Data Copy Type is 0x03.
NeoFox Communication Interfaces Data Copy Parameters Uart Data Copy Mode Unsigned char 0,1 88 Determines whether new samples should be copied to the Uart automatically or whether the device should wait for a request from the host before copying the next sample. When the value of this parameter is 0, the device will be in Auto mode and samples will be copied automatically.
NeoFox Communication Interfaces Single Point Temperature float X ≤ 200 188 Temperature (in degrees C) to use for next SPR calculation. Most users will want to set this to the current value of Temperature read by the instrument while in the SPR environment. Single Point Tau float X ≤ 10.0 186 Tau (in microseconds) to use for next SPR calculation. Most users will want to set this to the current value of Tau read by the instrument while in the SPR environment.