The DS2405 Match ROM command: The Match ROM command has characteristics for the DS2405 that are a little different from what we saw earlier. The procedure is very similar: the bus master issues a rest pulse, waits for a presence pulse, then issues a 64-bit ROM ID, and the device that matches it is then selected. But in the case of the DS2405, after a device receives its 64th bit and is selected, it toggles the state of the PIO output node. This is the mechanism by which one turns the DS2405 on and off: by selecting it. Once selected with a Match ROM command, it will output the state of its switch (on or off) during every subsequent data time slot initiated by the bus master until a reset is issued. This means that if the DS2405 is currently pulling the PIO pin to ground, it will respond to every timeslot following the Match ROM with a logic 0. If the PIO node is being pulled high, it will respond with a logic 1.
The DS2405 Search ROM command
As with the Match ROM command, the Search ROM command also has characteristics for the DS2405 that are a little different from what we saw earlier. The process proceeds as a standard Search ROM, but at the end of a 64-bit cycle in which a DS2405 1-Wire switch has been identified, any subsequent data time slots after this prompt the DS2405 to output its state to the bus. This means that if the PIO pin on the DS2405 is currently being pulled to ground, it will respond to every time slot following the match ROM with a logic 0. If the PIO node is being pulled high, it will respond with a logic 1. It will do this until it sees a reset. The Search ROM process does not affect the state of the switch. It will not toggle as the result of a Search ROM command.
The Active Only Search ROM command
The Active Only Search ROM command adds an additional level of selection to the standard Search ROM process. As we saw earlier, the Search ROM command is a method by which the bus master can iteratively identify all 1-Wire devices on the bus. All 1-Wire devices will respond to it. We also mentioned the concept of targeting the device family. That consists of performing a Search ROM command and automatically using a device’s family code as the first 8 bits the bus master writes to the bus during the process, independent of the bitn and Nbinn values being written by the 1-Wire devices. This eliminates identifying 1-Wire device ROM ID codes for devices that the bus master is not currently interested in. The Active Only Search ROM command adds an additional level of selection up front. When an Active Only Search ROM command is issued, the only devices that will respond to it are 1-Wire switch devices that presently have their internal switch control signals set to true, or logic 1, meaning the switch is actively trying to pull the PIO pin low. Additionally, after an Active Only Search ROM command is issued and the 64th bit cycle has been completed identifying one DS2405 ROM ID, that device will now output a logic 0 on the bus during every subsequent data time slot.
There’s a lot of significance in the differences between the Search ROM and the Active Only Search ROM for the DS2405. After bus master has completed a 64-bit Search ROM cycle, finding a DS2405, that DS2405 will output what it sees on the PIO pin. After the bus master has completed a 64-bit Active Only Search ROM command, finding a DS2405 with its internal switch control signal set to true, it will output a logic 0 to the bus during data time slots until reset. The significance is this: the Search ROM command can be used to determine the actual PIO pin voltage values for DS2405s on the bus, while the Active Only Search ROM can be used to identify the switches that have a switch control signal set to true, thereby thinking they are pulling the PIO pin low. But just because the internal switch control signal is set to true, this doesn’t necessarily mean the PIO pin is able to pull that node low. Or, the internal switch control signal could be set to false, thereby letting the PIO pin float to a logic 1, but something else could be pulling that node low outside the DS2405. The DS2405 PIO pin and the DS2405 internal switch control signal don’t necessarily have to agree, and by providing a difference in functionality between the Active Only Search ROM and the Search ROM, the bus master has a way of identifying not only how the switches are set, but how they are actually behaving.
Table 10-4: DS2405 review table
1-Wire Device Example: the DS1920 Thermometer iButton
The DS19203 is a selectable 1-Wire thermometer in a rugged iButton container. It has
0.5 °C accuracy and is useful from -55 °C to 100 °C.
The DS1920 provides an accurate temperature measurement, requires no complicated calibration, and only uses one signal and one ground. It uses a proprietary scheme involving the temperature dependence of oscillators to measure a temperature- related count and places that value into an internal memory that is referred to as scratch-pad memory. This memory also supports the storage of alarm values, which the DS1920 compares the current temperature against. All of this smart circuitry is powered parasitically from the 1-Wire bus.
Bytes zero and one correspond to the result of a temperature conversion performed on the raw measurement data in bytes six and seven. Bytes two and three are the only writable locations and can be used as temporary storage by the user. They also serve the purpose of being the registers in which you will load any alarm values that you want to enter. Scratchpad byte two is the value of the high temperature alarm point while scratchpad byte three is the value of the low temperature alarm point. Any temperature falling outside those bounds will result in the device being active during a Alarm Search Only ROM command, provided that another reading isn’t performed in the interim that clears the alarm condition. To ensure the alarm values remain active over time, you write them to the scratchpad and then copy them to the nonvolatile EEPROM memory. The purpose of the EEPROM is to provide a nonvolatile place for the alarm values to be stored during times when the device isn’t powered. During these times the scratchpad no longer retains its values. When the device is powered back up, the EEPROM locations automatically are placed back into the scratchpad memory. Scratchpad bytes four and five are labeled as reserved and are not used. Byte nine is a CRC byte, representing a cyclic redundancy check performed on the previous eight bytes.
The DS1920 draws as much as 1 mA during a temperature measurement, and this requires what Dallas Semiconductor refers to as a “strong pullup.” The normal pullup value for the 1-Wire bus is about 5k ohms and that won’t supply the necessary current for the DS1920. Normally, this won’t be a problem, because in order to interface to the DS1920 one normally uses a Dallas Semiconductor bus adapter that already takes this sort of thing into account. But you’ll need to be aware of this if you make your own interface circuitry to the DS1920.