Buongiorno a tutti,
vorrei creare un sistema di lettura di temperatura con uscita 0-10V da attaccare ad un dataloog.
come faccio a convertire il dato di temperatura ricavato dal LTC2983 in 0-10V.
mi sapere dare qualche delucidazione
Grazie per L'aiuto
#include <Arduino.h>
64 #include <stdint.h>
65 #include <stdbool.h>
66 #include "SPI.h"
67 #include "Wire.h"
68 #include "Linduino.h"
69 #include "LT_SPI.h"
70 #include "UserInterface.h"
71 #include "LT_I2C.h"
72 #include "QuikEval_EEPROM.h"
73 #include "stdio.h"
74 #include "math.h"
75
76 #include "configuration_constants_LTC2983.h"
77 #include "support_functions_LTC2983.h"
78 #include "table_coeffs_LTC2983.h"
79
80 #define CHIP_SELECT QUIKEVAL_CS // Chip select pin
81
82 // Function prototypes
83 void configure_memory_table();
84 void configure_channels();
85 void configure_global_parameters();
86
87
88 // -------------- Configure the LTC2983 -------------------------------
89 void setup()
90 {
91 char demo_name[]="DC2209"; // Demo Board Name stored in QuikEval EEPROM
92 quikeval_I2C_init(); // Configure the EEPROM I2C port for 100kHz
93 quikeval_SPI_init(); // Configure the spi port for 4MHz SCK
94 quikeval_SPI_connect(); // Connect SPI to main data port
95 pinMode(CHIP_SELECT, OUTPUT); // Configure chip select pin on Linduino
96
97 Serial.begin(115200); // Initialize the serial port to the PC
98 print_title();
99 discover_demo_board(demo_name);
100
101 configure_channels();
102 configure_memory_table();
103 configure_global_parameters();
104 }
105
106
107 void configure_channels()
108 {
109 uint8_t channel_number;
110 uint32_t channel_assignment_data;
111
112 // ----- Channel 4: Assign Sense Resistor -----
113 channel_assignment_data =
114 SENSOR_TYPE__SENSE_RESISTOR |
115 (uint32_t) 0x9DD000 << SENSE_RESISTOR_VALUE_LSB; // sense resistor - value: 10100.
116 assign_channel(CHIP_SELECT, 4, channel_assignment_data);
117 // ----- Channel 5: Assign Thermistor Custom Table -----
118 channel_assignment_data =
119 SENSOR_TYPE__THERMISTOR_CUSTOM_TABLE |
120 THERMISTOR_RSENSE_CHANNEL__4 |
121 THERMISTOR_SINGLE_ENDED |
122 THERMISTOR_EXCITATION_MODE__NO_SHARING_NO_ROTATION |
123 THERMISTOR_EXCITATION_CURRENT__1UA |
124 (uint32_t) 0x14 << THERMISTOR_CUSTOM_ADDRESS_LSB | // thermistor - custom address: 20.
125 (uint32_t) 0x9 << THERMISTOR_CUSTOM_LENGTH_1_LSB; // thermistor - custom length-1: 9.
126 assign_channel(CHIP_SELECT, 5, channel_assignment_data);
127
128 }
129
130
131 void configure_memory_table()
132 {
133 uint16_t start_address;
134 uint16_t table_length;
135 // int i;
136
137 // -- Channel 5 custom table --
138 table_coeffs ch_5_coefficients[] =
139 {
140 { 0, 468480 }, // -- 0.0, 457.5
141 { 1280, 409805 }, // -- 80.0, 400.2
142 { 2944, 381235 }, // -- 184.0, 372.3
143 { 6771, 327782 }, // -- 423.2, 320.1
144 { 15574, 297523 }, // -- 973.36, 290.55
145 { 35820, 255304 }, // -- 2238.728, 249.32
146 { 82385, 246067 }, // -- 5149.0744, 240.3
147 { 428403, 235520 }, // -- 26775.18688, 230.0
148 { 2227696, 220467 }, // -- 139230.978, 215.3
149 { 11584017, 204800 } // -- 724001.0532, 200.0
150 };
151 start_address = (uint16_t) 712; // Real address = 620 + 0x250 = 712
152 table_length = (uint8_t) 10; // Real table length = 9 + 1 = 10
153 write_custom_table(CHIP_SELECT, ch_5_coefficients, start_address, table_length);
154
155
156 }
157
158
159
160 void configure_global_parameters()
161 {
162 // -- Set global parameters
163 transfer_byte(CHIP_SELECT, WRITE_TO_RAM, 0xF0, TEMP_UNIT__C |
164 REJECTION__50_60_HZ);
165 // -- Set any extra delay between conversions (in this case, 0100us)
166 transfer_byte(CHIP_SELECT, WRITE_TO_RAM, 0xFF, 0);
167 }
168
169 // -------------- Run the LTC2983 -------------------------------------
170
171 void loop()
172 {
173 measure_channel(CHIP_SELECT, 5, TEMPERATURE); // Ch 5: Thermistor Custom Table