DS1920 ROM commands

9 May

DS1920 ROM commands: The DS1920 has the standard four ROM commands that we know about: Read ROM, Search ROM, Match ROM and Skip ROM. These function exactly as described for the DS2401. There is one additional ROM command known as the Alarm Search Command.

The DS1920 Alarm Search command
The Alarm Search command is exactly like the Search ROM command, except that it only applies to thermometer devices, meaning only devices with the thermometer family code, and only those thermometers that experienced an alarm at their last temperature measurement, will respond. When the bus master tells the thermometer iButton to measure temperature, the iButton also compares the result to any alarm values that it has stored away in memory. If it experiences an alarm, it remembers this and knows to participate in any subsequent Alarm Search command.

Table 10-6: DS1920 iButton ROM command table

The other DS1920 commands: memory and temperature conversion

The DS1920 has additional commands, four of which are referred to as memory functions, while one is called a temperature conversion function. Whereas ROM functions all tend to be aimed at selecting a device, or identifying a device, these other commands have to do with making the device do something once selected. We’re not going to go into them in tremendous detail here, because the best way to learn about them is from the Dallas Semiconductor data sheets, but we’ll briefly review them. These commands are: Write Scratchpad, Read Scratchpad, Copy Scratchpad, Convert Temperature, and Recall EEPROM.

Table 10-7: DS1920 iButton additional command table

DS1920 Write Scratchpad command
The Write Scratchpad command is issued by the bus master before writing two bytes of data into the scratchpad memory. It tells the DS1920 to read the next 16 data time slots. This memory gets put into scratchpad bytes two and three. The bus master can issue a reset during this write process, which terminates it and leaves the contents of the scratchpad in an unknown state.

DS1920 Read Scratchpad command
The Read Scratchpad command is issued by the bus master when it wants to read the nine bytes of data in the DS1920 scratchpad memory. The master can stop the read process at any time by issuing a reset.

DS1920 Copy Scratchpad command
The Copy Scratchpad command moves the values in scratchpad bytes two and three into nonvolatile EEPROM. These two locations can be thought of as storage for the alarm values. The alarm registers are scratchpad bytes two and three. The EEPROM memory programming requires the use of the strong pullup, which the bus master must enable immediately after this command is issued and hold for 10 ms.

DS1920 Convert Temperature command
The Convert Temperature command causes a temperature measurement to be performed. This command also requires that the strong pullup be enabled immediately after the command is issued by the bus master and held for 0.5 sec. The raw result of the process is stored in scratchpad locations seven and eight, while the value of the temperature computed from it is stored in bytes zero and one. The conversion between the 16-bit temperature value and an actual Celsius number is shown in Table 10-8.

Table 10-8: DS1920 iButton hex to temperature table

DS1920 Recall EEPROM command
This command places the two bytes of data stored in the EEPROM into bytes two and three in scratchpad memory. This happens automatically every time the device is powered up, but also on demand through the use of this command.

There are a number of temperature-related 1-Wire devices, such as the DS1820
1-Wire thermometer. It makes use of the same commands as the DS1920 with the addition of some features related to how the device is powered up.

Table 10-9 lists the names and family codes of a variety of common 1-Wire devices.

Table 10-9: 1-Wire devices and their family codes

Connecting a PC to the 1-Wire Bus
We’ve discussed some of the 1-Wire devices that are interesting for web-enabled devices, but our overall goal is to be able to access these devices with a computer and, ultimately, the Internet. In this section, we look at the process of accessing 1-Wire devices with a personal computer. Dallas Semiconductor offers a host of products that make the PC-to-1-Wire interface easy to accomplish. But the sheer variety of products they offer can obscure how easy it really is. Let’s take a high-level look at what we’re trying to do, then examine the details.

Figure 10-15: Bridging the gap between computer and devices
We have a PC, and we’re trying to connect it up to 1-Wire devices which may be iButtons, surface mount or through-hole packaged devices. To bridge the gap, we’re going to need the following: software to drive the bus, I/O ports on the computer for communication to the bus, a method of adapting the I/O port to the bus, cables, and a method of connecting cables to our devices. This is how we’ll accomplish this:

Software to control the PC I/O ports
Java API supplied by Dallas Semiconductor
TMEX Touch Memory Exchange Software supplied by Dallas

PC I/O ports
RS232 COM ports

The parallel or printer port
The Universal Serial Bus, or USB, port

Adapters to go from the PC I/O ports to the 1-Wire bus
DS1411, DS1413 COM port to iButton adapters
DS1410E Parallel Port to iButton adapter
DS9097U-09 COM port to RJ11 adapter
DS2480B 1-Wire line driver
DS2490 USB to 1-Wire bridge chip

Cables between the adapters and the 1-Wire devices
Category 5 telephone cable, with RJ11 modular connectors
DS1420X pre-made cables

Connectors to attach the cables to printed circuit boards with 1-Wire electronics
RJ11 modular plugs
DS9094 iButton clip, DS9098 iButton retainer
DS9092R iButton port
DS1401 front panel iButton holder

We’ll start by examining the physical and electrical interfaces, and then end with a discussion of the Java 1-Wire API and some examples.

Communication ports on the PC
There are three ports on the PC that we can use to connect to a 1-Wire bus: RS232 COM ports, the parallel port, and the Universal Serial Bus or USB port. Dallas Semiconductor makes a variety of products that can be used as translators/adapters. These products provide mechanical connections to the bus, and contain electronics that help translate your computer’s output into the 1-Wire protocol. Let’s take a look at them all, starting with the serial, or RS232, port.

The RS232 or serial (COM) ports
Most, if not all, PCs have traditional RS232 serial ports often referred to as COM
ports. They usually have a male DB-9 connector as shown in Figure 10-17.

Figure 10-17: Male, female DB-9, pinout

To connect the 1-Wire bus to this, you need a female DB-9 connector. Dallas Semiconductor makes several adapters that connect to a male DB-9 connector and provide a connection to either an iButton directly, an iButton cable, or an RJ11 (telephone modular plug) and category 5 1-Wire cable.

The DS1413 Passive Serial iButton holder

Figure 10-18: DS1413 images and schematic This port adapter, the most basic and least expensive, has a metal retaining clip for holding an iButton device. You plug the iButton device into the retaining clip and plug the adapter into your COM port and run software that communicates in the 1- Wire protocol. There are cables that can plug into the iButton retaining clip that allow you to use this as a generic 1-Wire adapter. But that basic design of the DS1413 has limitations.

What it does
1. It performs the mechanical adaptation between the male DB-9 COM port and either an iButton or an iButton cable.
2. It performs voltage level conversions between the 12V RS232 provided by the COM port and the 5V needed by the 1-Wire bus.

What it does not do
1. It has no active electronics inside it, so it doesn’t actually format data coming from the COM port into the 1-Wire protocol for you. The data coming from the COM port into the DS1413 must already have the correct timing. This makes the controlling software somewhat more complicated.

2. The Dallas Semiconductor Java 1-Wire API doesn’t support it directly— rather, it supports it indirectly, by using a driver supplied in the Dallas Semiconductor TMEX software.

3. The datasheet makes note of the fact that it does not support what is called a strong 5V pull-up. Certain devices need a pull-up on the bus beyond what is normally supplied by the 5K resistor. The DS1411 has no provision to supply that. Having said that, We’ve found that it seems to work with thermometer iButtons in terms of making a temperature measurement, but not for writing to the EEPROMS, even though they both require the strong pull-up.

4. It doesn’t have a provision for supplying the 12V signals required for programming EPROM devices.

The limitations of the DS1413 are significant for our applications, so we won’t really be discussing it further in this book. It’s designed for use in special-purpose applications where cost is an issue. We’re mentioning it here because you need to understand the differences between it and the DS1411, which is basically the same device without the limitations described above. Be aware that it looks exactly like a DS1411, with the exception of a tiny little sticker label. If you have both, it’s best to keep them separate.

Random Posts

Comments are closed.