| Electronic Components Datasheet Search |
|
ENS210 Datasheet(PDF) 21 Page - ams AG |
|
|
|||||||||||||||||||||||||||||
ENS210 Datasheet(HTML) 21 Page - ams AG |
|
21 / 43 page ![]() ams Datasheet Page 21 [v1-02] 2018-Feb-19 Document Feedback ENS210 − Functional Description The following fragment processes the T measurement as available in t_val. It relies on the crc7() function as shown previously. // Extract (and print) the fields uint32_t t_data = (t_val>>0 ) & 0xffff; uint32_t t_valid= (t_val>>16) & 0x1; uint32_t t_crc = (t_val>>17) & 0x7f; printf("ENS210: T: %06x %02x %01x %04x\n", t_val, t_crc, t_valid, t_data ); // Check the CRC uint32_t t_payl = (t_val>>0 ) & 0x1ffff; bool t_crc_ok= crc7(t_payl)==t_crc; // Convert to float (and print) float TinK = (float)t_data / 64; // Temperature in Kelvin float TinC = TinK - 273.15; // Temperature in Celsius float TinF = TinC * 1.8 + 32.0; // Temperature in Fahrenheit printf("ENS210: T: (i2c=%d crc=%d valid=%d) %5.1fK %4.1fC %4.1fF\n", i2c_ok, t_crc_ok, t_valid, TinK, TinC, TinF ); The following fragment processes the RH measurement as available in h_val. It is similar to the t_val processing. // Extract (and print) the fields uint32_t h_data = (h_val>>0 ) & 0xffff; uint32_t h_valid= (h_val>>16) & 0x1; uint32_t h_crc = (h_val>>17) & 0x7f; printf("ENS210: H: %06x %02x %01x %04x\n", h_val, h_crc, h_valid, h_data ); // Check the CRC uint32_t h_payl = (h_val>>0 ) & 0x1ffff; bool h_crc_ok= crc7(h_payl)==h_crc; // Convert to float (and print) float H = (float)h_data/512; // relative humidity (in %) printf("ENS210: H: (i2c=%d crc=%d valid=%d) %2.0f%%\n", i2c_ok, h_crc_ok, h_valid, H ); If registers 30 to 35 would contain fd 49 0b 6c 2e f5 (i.e. T_VAL in blue and H_VAL in green) the code would print ENS210: T: 0b49fd 05 1 49fd ENS210: T: (i2c=1 crc=1 valid=1) 296.0K 22.8C 73.0F ENS210: H: f52e6c 7a 1 2e6c ENS210: H: (i2c=1 crc=1 valid=1) 23% |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |