Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AdiSense1000_V21 by
sample_lut_data.c
00001 /* 00002 * File: sample_lut_data.c 00003 * The following example illustrates how individual tables can be declared, and 00004 * later assembled into a complete LUT data structure using adi_sense_1000_AssembleLutData(). 00005 * That LUT data structure can then be written to the ADI Sense 1000 device 00006 * using adi_sense_1000_SetLutData(). 00007 */ 00008 00009 #include "adi_sense_1000_lut_data.h" 00010 #include "adi_sense_1000_sensor_types.h" 00011 00012 /* 00013 * The following table provide linearisation data for a 4-wire bridge sensor 00014 * identified with the ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2 00015 * sensor type. The Look-Up Table provided maps a range of input (X) 00016 * values to a corresponding range of output (Y) values. In this example, 00017 * the bridge sensor input in millivolts is effectively translated to volts. 00018 */ 00019 00020 ADI_SENSE_1000_LUT_DESCRIPTOR loadcell_1 = 00021 { 00022 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D, 00023 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT, 00024 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, 00025 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_DEF_L2 , 00026 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32, 00027 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */ 00028 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */ 00029 }; 00030 00031 ADI_SENSE_1000_LUT_1D_NES loadcell_1_data = 00032 { 00033 .nElements = 10, 00034 .lut = 00035 { 00036 -3300.0f, /* x(min) || mV */ 00037 -0.7556152f, 00038 -0.626709f, 00039 -0.5058594f, 00040 -0.3776855f, 00041 -0.1120605f, 00042 0.5334473f, 00043 1.1896973f, 00044 13.340413f, 00045 +3300.0f, /* x(max) || mV */ 00046 -0.001f, /* y(min) || kg */ 00047 0.0f, 00048 0.1f, 00049 0.2f, 00050 0.3f, 00051 0.5f, 00052 1.0f, 00053 1.5f, 00054 10.0f, 00055 +100.0f, /* y(max) || kg */ 00056 }, 00057 }; 00058 00059 ADI_SENSE_1000_LUT_DESCRIPTOR loadcell_2 = 00060 { 00061 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D, 00062 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT, 00063 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, 00064 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2 , 00065 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32, 00066 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */ 00067 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */ 00068 }; 00069 00070 ADI_SENSE_1000_LUT_1D_NES loadcell_2_data = 00071 { 00072 .nElements = 10, 00073 .lut = 00074 { 00075 -3300.0f, /* x(min) || mV */ 00076 0.2766113f, 00077 0.4162598f, 00078 0.5400391f, 00079 0.6694336f, 00080 0.9326172f, 00081 1.5837402f, 00082 2.2387695f, 00083 12.25284823f, 00084 +3300.0f, /* x(max) || mV */ 00085 -0.001f, /* y(min) || kg */ 00086 0.0f, 00087 0.1f, 00088 0.2f, 00089 0.3f, 00090 0.5f, 00091 1.0f, 00092 1.5f, 00093 10.0f, 00094 +100.0f, /* y(max) || kg */ 00095 }, 00096 }; 00097 00098 ADI_SENSE_1000_LUT_DESCRIPTOR loadcell_3 = 00099 { 00100 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D, 00101 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT, 00102 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, 00103 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2 , 00104 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32, 00105 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */ 00106 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */ 00107 }; 00108 00109 ADI_SENSE_1000_LUT_1D_NES loadcell_3_data = 00110 { 00111 .nElements = 10, 00112 .lut = 00113 { 00114 -3300.0f, /* x(min) || mV */ 00115 0.2521973f, 00116 0.3740234f, 00117 0.5178223f, 00118 0.6574707f, 00119 0.9311523f, 00120 1.6118164f, 00121 2.3029785f, 00122 13.96175153f, 00123 +3300.0f, /* x(max) || mV */ 00124 -0.001f, /* y(min) || kg */ 00125 0.0f, 00126 0.1f, 00127 0.2f, 00128 0.3f, 00129 0.5f, 00130 1.0f, 00131 1.5f, 00132 10.0f, 00133 +100.0f, /* y(max) || kg */ 00134 }, 00135 }; 00136 00137 ADI_SENSE_1000_LUT_DESCRIPTOR loadcell_4 = 00138 { 00139 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D, 00140 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT, 00141 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, 00142 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_DEF_L2 , 00143 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32, 00144 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */ 00145 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */ 00146 }; 00147 00148 ADI_SENSE_1000_LUT_1D_NES loadcell_4_data = 00149 { 00150 .nElements = 10, 00151 .lut = 00152 { 00153 -3300.0f, /* x(min) || mV */ 00154 0.4609375f, 00155 0.5895996f, 00156 0.7226562f, 00157 0.857666f, 00158 1.1184082f, 00159 1.7749023f, 00160 2.432373f, 00161 13.60091103f, 00162 +3300.0f, /* x(max) || mV */ 00163 -0.001f, /* y(min) || kg */ 00164 0.0f, 00165 0.1f, 00166 0.2f, 00167 0.3f, 00168 0.5f, 00169 1.0f, 00170 1.5f, 00171 10.0f, 00172 +100.0f, /* y(max) || kg */ 00173 }, 00174 }; 00175 00176 00177 /* 00178 * The following variables can be passed as parameters to 00179 * adi_sense_1000_AssembleLutData() 00180 */ 00181 ADI_SENSE_1000_LUT_DESCRIPTOR *sample_lut_desc_list[] = 00182 { 00183 &loadcell_1, 00184 &loadcell_2, 00185 &loadcell_3, 00186 &loadcell_4, 00187 00188 }; 00189 00190 ADI_SENSE_1000_LUT_TABLE_DATA *sample_lut_data_list[] = 00191 { 00192 00193 (ADI_SENSE_1000_LUT_TABLE_DATA *) &loadcell_1_data, 00194 (ADI_SENSE_1000_LUT_TABLE_DATA *) &loadcell_2_data, 00195 (ADI_SENSE_1000_LUT_TABLE_DATA *) &loadcell_3_data, 00196 (ADI_SENSE_1000_LUT_TABLE_DATA *) &loadcell_4_data, 00197 00198 }; 00199 00200 unsigned sample_lut_num_tables = 00201 (sizeof(sample_lut_desc_list) / sizeof(sample_lut_desc_list[0])); 00202
Generated on Wed Jul 13 2022 04:26:17 by
1.7.2
