![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
(working) Use this code for calibrating the Load cells.
Fork of ADISense1000_Example_FW by
sample_lut_data.c@2:2f9f9f7f0243, 2018-07-19 (annotated)
- Committer:
- RGurav
- Date:
- Thu Jul 19 13:25:33 2018 +0000
- Revision:
- 2:2f9f9f7f0243
(Working); Code to read values from bridge load cell
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RGurav | 2:2f9f9f7f0243 | 1 | #include "adi_sense_1000_lut_data.h" |
RGurav | 2:2f9f9f7f0243 | 2 | #include "adi_sense_1000_sensor_types.h" |
RGurav | 2:2f9f9f7f0243 | 3 | |
RGurav | 2:2f9f9f7f0243 | 4 | /* |
RGurav | 2:2f9f9f7f0243 | 5 | * The following example illustrates how individual tables can be declared, and |
RGurav | 2:2f9f9f7f0243 | 6 | * later assembled into a complete LUT data structure using |
RGurav | 2:2f9f9f7f0243 | 7 | * adi_sense_1000_AssembleLutData(). That LUT data structure can then be |
RGurav | 2:2f9f9f7f0243 | 8 | * written to the ADI Sense 1000 device using adi_sense_1000_SetLutData(). |
RGurav | 2:2f9f9f7f0243 | 9 | */ |
RGurav | 2:2f9f9f7f0243 | 10 | |
RGurav | 2:2f9f9f7f0243 | 11 | |
RGurav | 2:2f9f9f7f0243 | 12 | |
RGurav | 2:2f9f9f7f0243 | 13 | /* |
RGurav | 2:2f9f9f7f0243 | 14 | * The following table provide linearisation data for a 4-wire bridge sensor |
RGurav | 2:2f9f9f7f0243 | 15 | * identified with the ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2 |
RGurav | 2:2f9f9f7f0243 | 16 | * sensor type. The Look-Up Table provided maps a range of input (X) |
RGurav | 2:2f9f9f7f0243 | 17 | * values to a corresponding range of output (Y) values. In this example, |
RGurav | 2:2f9f9f7f0243 | 18 | * the bridge sensor input in millivolts is effectively translated to volts. |
RGurav | 2:2f9f9f7f0243 | 19 | */ |
RGurav | 2:2f9f9f7f0243 | 20 | ADI_SENSE_1000_LUT_DESCRIPTOR bridge_4wire_1_def_l2_range1_desc = { |
RGurav | 2:2f9f9f7f0243 | 21 | .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D, |
RGurav | 2:2f9f9f7f0243 | 22 | .equation = ADI_SENSE_1000_LUT_EQUATION_LUT, |
RGurav | 2:2f9f9f7f0243 | 23 | .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, |
RGurav | 2:2f9f9f7f0243 | 24 | .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2, |
RGurav | 2:2f9f9f7f0243 | 25 | .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32, |
RGurav | 2:2f9f9f7f0243 | 26 | .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */ |
RGurav | 2:2f9f9f7f0243 | 27 | .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */ |
RGurav | 2:2f9f9f7f0243 | 28 | }; |
RGurav | 2:2f9f9f7f0243 | 29 | ADI_SENSE_1000_LUT_1D_NES bridge_4wire_1_def_l2_range1_data = { |
RGurav | 2:2f9f9f7f0243 | 30 | .nElements = 2, |
RGurav | 2:2f9f9f7f0243 | 31 | .lut = { |
RGurav | 2:2f9f9f7f0243 | 32 | -3300.0f, /* x(min) */ |
RGurav | 2:2f9f9f7f0243 | 33 | +3300.0f, /* x(max) */ |
RGurav | 2:2f9f9f7f0243 | 34 | -3.3f, /* y(min) */ |
RGurav | 2:2f9f9f7f0243 | 35 | +3.3f, /* y(max) */ |
RGurav | 2:2f9f9f7f0243 | 36 | }, |
RGurav | 2:2f9f9f7f0243 | 37 | }; |
RGurav | 2:2f9f9f7f0243 | 38 | |
RGurav | 2:2f9f9f7f0243 | 39 | /* |
RGurav | 2:2f9f9f7f0243 | 40 | * The following variables can be passed as parameters to |
RGurav | 2:2f9f9f7f0243 | 41 | * adi_sense_1000_AssembleLutData() |
RGurav | 2:2f9f9f7f0243 | 42 | */ |
RGurav | 2:2f9f9f7f0243 | 43 | ADI_SENSE_1000_LUT_DESCRIPTOR *sample_lut_desc_list[] = { |
RGurav | 2:2f9f9f7f0243 | 44 | |
RGurav | 2:2f9f9f7f0243 | 45 | &bridge_4wire_1_def_l2_range1_desc, |
RGurav | 2:2f9f9f7f0243 | 46 | |
RGurav | 2:2f9f9f7f0243 | 47 | }; |
RGurav | 2:2f9f9f7f0243 | 48 | |
RGurav | 2:2f9f9f7f0243 | 49 | ADI_SENSE_1000_LUT_TABLE_DATA *sample_lut_data_list[] = { |
RGurav | 2:2f9f9f7f0243 | 50 | |
RGurav | 2:2f9f9f7f0243 | 51 | (ADI_SENSE_1000_LUT_TABLE_DATA *) &bridge_4wire_1_def_l2_range1_data, |
RGurav | 2:2f9f9f7f0243 | 52 | |
RGurav | 2:2f9f9f7f0243 | 53 | }; |
RGurav | 2:2f9f9f7f0243 | 54 | |
RGurav | 2:2f9f9f7f0243 | 55 | unsigned sample_lut_num_tables = |
RGurav | 2:2f9f9f7f0243 | 56 | (sizeof(sample_lut_desc_list) / sizeof(sample_lut_desc_list[0])); |
RGurav | 2:2f9f9f7f0243 | 57 |