12.7 Operation of the SHT11
The SHT11 is based on serial communication where data is clocked in and out, in synchronisation with the SCK clock. The communication between the SHT11 and a microcontroller consists of the following protocols (see the SHT11 data sheet for more detailed information).
12.7.1 RESET
At the beginning of data transmission, it is recommended to send a RESET to the SHT11, just in case the communication with the device is lost. This signal consists of sending 9 or more SCK signals while the DATA line is HIGH. Then, a Transmission-Start-Sequence must be sent. Figure 12.36 shows the RESET sequence.
The C code to implement the RESET sequence as a function is given below (SDA and SCK are the DATA and SCK lines, respectively). Notice that the manufacturer's data sheet specifies that after the SCK changes state it must remain in its new state for a minimum of 100 ns. Here, a delay of 1 µs is introduced between each SCK state change:
Notice that when the direction of a port pin is set to 1 (i.e. when in input mode), the port pin presents itself as a logic HIGH.
12.7.2 Transmission-Start-Sequence
Before a temperature or relative humidity conversion command is sent to the SHT11, the transmission-start-sequence must be sent. This ...
Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.