Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/05/03 21:42
Read: times


 
#44862 - RE: Neat humidity sensor project
Responding to: ???'s previous message
The SHTxx are I2c ,so code's no problem to a man of your calibre.

Not quite regarding the I2C part. Unless things have changed recently, for the SHT-11 at least, it's close to I2C, but uses some unconventional sequences. Assuming one has access to some "standard" I2C software (bit-bang) implementation or some built-in I2C hardware in their microcontroller:
/** Implements the "Connection reset sequence" described in the
 *  SHT11 datasheet.
 *
 *  @par Datasheet quote:
 *
 *      "If communication with the SHT1x is lost the following
 *      signal sequence will reset its serial interface: While
 *      leaving DATA high toggle SCK 9 or more times.  This must
 *      be followed by a "Transmission Start" sequence preceding
 *      the next command."
 *
 *  This is accomplished by performing an I2C receive (8 bits
 *  with SDA pulled high) with a NAK (1 bit with SDA high) for a
 *  total of 9 clocks.
 */
#define CONNECTION_RESET()  (void)I2cRx(I2C_NAK)

/** Implements the "Transmission start" sequence described in
 *  the SHT11 datasheet.
 *
 *  @par Datasheet quote:
 *
 *      "To initiate a transmission a "Transmission Start"
 *      sequence has to be issued.  It consists of a lowering of
 *      the DATA line while SCK is high, followed by a low pulse
 *      on SCK and raising DATA again while SCK is still high."
 *
 *  This is accomplished by generating an unconventional I2C
 *  condition sequence -- a RESTART followed by a STOP.
 */
#define TX_START()  do { I2cRestart(); I2cStop(); } while (0)

Which might be used as follows:
{
    /*  Measure humidity.  This 8-bit measurement requires 11ms
     *  +/-15% to complete.
     */
    CONNECTION_RESET();
    TX_START();
    (void)I2cTx(ADDR_CMD_MEAS_HUMI);
    POLL_FOR_COMPLETION();
    (void)I2cRx(I2C_ACK);
    h = I2cRx(I2C_NAK);
    I2cStop();
}



List of 12 messages in thread
TopicAuthorDate
Neat humidity sensor project            01/01/70 00:00      
   RE: Neat humidity sensor project            01/01/70 00:00      
      RE: Neat humidity sensor project            01/01/70 00:00      
   RE: Neat humidity sensor project            01/01/70 00:00      
      RE: Electronics [and Wireless] World            01/01/70 00:00      
   RE: Neat humidity sensor project            01/01/70 00:00      
      RE: Neat humidity sensor project            01/01/70 00:00      
         RE: Neat humidity sensor project            01/01/70 00:00      
         RE: Neat humidity sensor project - Rob            01/01/70 00:00      
   RE: Neat humidity sensor project            01/01/70 00:00      
      RE: Neat humidity sensor project            01/01/70 00:00      
         RE: Neat humidity sensor project            01/01/70 00:00      

Back to Subject List