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