1-Wire Bus Technology and Its Application Abstract: This paper introduces the principle and signal transmission mode of the single bus technology introduced by Dallas, and describes the single bus communication protocol, finally, the single-bus data transmission method is presented based on the application of the single bus device iButton in the security system. keywords: Single-bus single-bus protocol iButton 1 Introduction at present, the commonly used serial bus for data transmission between microcomputer and peripherals mainly include I2C bus, SPI bus and Sci Bus. The I2C bus communicates with each other in Synchronous Serial 2-wire mode (one clock line and one data line), while the SPI bus communicates with each other in synchronous serial 3-wire mode (one clock line and one data input line, one data output line), while the SCI bus communicates asynchronously (one data input line and one data output line. These buses must have at least two or more signal lines. In recent years, Dallas semicondu, a US-Specific Single-bus technology, has been launched. This technology is different from the above bus, it uses a single signal line, which can transmit clock, data, and data transmission is bidirectional, so this single bus technology has a simple line, low hardware overhead and low cost, facilitating Bus Expansion and maintenance. A single bus is applicable to a single host system and can control one or more slave devices. The host can be a microcontroller, And the slave can be a single-bus device. The data exchange between them only uses one signal line. If there is only one slave device, the system can operate on a single node. If there are multiple slave devices, the system operates on multiple nodes. Figure 1 shows a single-bus multi-node system. 2. How a single bus Works as the name suggests, a single bus only has one data line, and data exchange and control in the system are all completed by this line. A device (host or slave) connects to the data line through an open or tri-state port to allow the device to release the bus when it does not send data, and allow other devices to use the bus, its internal equivalent circuit 2 is shown. A single bus usually requires an external pull-up resistor of about 4.7kb. In this way, when the bus is idle, its status is high. Communication between the host and the slave can be completed in three steps: Initialize the 1-wire device, identify the 1-wire device, and exchange data. Because they are in a master-slave structure, the slave server can only respond when the host calls the slave server. Therefore, the host must strictly follow the single-bus command sequence to access the 1-wire device, that is, initialization, Rom, command function commands. If the sequence is disordered, the 1-wire device does not respond to the host (except for ROM search commands and alarm search commands ). Table 1 lists the description of the △mongoΩ command, and the functional commands are determined based on the features supported by the specific 1-wire device. Table 1 Rom commands
Rom command |
Description |
Search Rom (f0h) |
Recognizes Rom encoding for all 1-wire devices on a single bus |
Read Rom (33 H) (applicable only to a single node) |
Directly read the serial number of the 1-wire device |
Match Rom (55 H) |
Find the 1-wire device that matches the specified serial number |
Skip Rom (CCH) (applicable only to a single node) |
Use this command to directly access the slave device on the bus |
Alarm search Rom (ECH) (supported by only a few devices) |
Search for slave devices with alarms |
3. Signal Mode All single-bus devices must follow strict communication protocols to ensure data integrity. The 1-wire protocol defines several signal types, such as reset pulse, response pulse, write 0, read 0, and read 1 time series. All single-bus command sequences (initialization, Rom commands, and functional commands) are composed of these basic signal types. Among these signals, except for the response pulse, the host sends the synchronous signal, and all the commands and data sent are in front of the Byte Low. Figure 3 shows the sequence of these signals. Figure 3 (a) shows the initialization sequence, which includes the reset pulse sent by the host and the response pulse sent from the slave. The host generates a TX reset pulse by reducing the single bus by at least 480 μs; then the host releases the bus and enters the RX receiving mode. When the host releases the bus, a rising edge is generated from low-level hops to high-level hops. After a single bus device detects the rising edge, the delay is 15 ~ 60 μs, and then a single bus device pulls down the bus 60 ~ 240 μs to generate a response pulse. After the host receives a response pulse from the slave, it indicates that a single bus device is online. Then, the host can start to Execute Rom commands and function commands on the slave. In Figure 3, (B), (c), and (d) are respectively write 1, write 0, and read time series. In each time series, the bus can transmit only one bit of data. All read and write time sequences must be at least 60 μs, and each two independent time sequences must be restored at least 1 μs. In the figure, the read and write time sequence starts when the host pulls down the bus. In the write sequence, the host will release the bus within 15 μs of the bus, and write 1 to the single bus device; if the host can maintain a low level of at least 60 μs after pulling down the bus, write 0 to the single bus device. A single bus device transmits data to the host only when the host sends a read sequence. Therefore, when the host sends a READ command to the single bus device, the read sequence must be generated immediately, this allows a single bus device to transmit data. After the host sends a read sequence, a single bus device starts to send 0 or 1 messages on the bus. If a single bus device sends 1, the bus remains high. If 0 is sent, the bus is lowered. Because a single bus device can maintain a valid time of 15 μs after sending data, the host must release the bus during the reading time series and be in the sampling bus status of 15 μs, to receive data sent from the slave. Figure 3 signal timing of a Single Bus 4 single-bus devicesGenerally, devices mounted on a single bus are called single bus devices, which generally have control, receiving, sending, and storage circuits. To distinguish different single-bus devices, manufacturers need to burn a 64-bit binary ROM when producing single-bus devices.CodeTo mark its ID. Currently, single-bus devices mainly include digital temperature sensors (such as DS18B20), A/D converters (such as ds2450), door labels, identifiers (such as ds1990a), and single-bus controllers (such as ds1wm. Here we introduce a single-bus device in the iButton form, which uses instant contact for digital communication. The application of these devices has penetrated into currency transactions and highly secure authentication systems. IButton is a computerized chip encapsulated in a button-like stainless steel housing. It has the following features: anti-impact, waterproof stains, corrosion resistance, anti-magnetic disturbance, anti-folding, and low price, it can effectively solve the shortcomings of traditional identifiers and meet the reliability and stability requirements of the system. IButton has three types: Memory iButton (memory), Java-powered cryptographic iButton (encryption type), and thermochron iButton (temperature type ). The storage iButton can store up to 64 KB of text or digital photos. The encrypted iButton is a type of microprocessor and high-speedAlgorithmAccelerator can generate a large amount of data information that requires encryption and decryption. It runs very fast and can be combined with Internet applications and can be used for remote identification and identification. The temperature iButton can measure temperature changes, including thermometers, clocks, heat records, and storage units. Figure 4 security system hardware schematic 5 Application of Single Bus Devices The application of the single bus device iButton in the security system is used as an example to describe that the security system uses iButton for access control identification. The hardware schematic 4 of the access control module is shown in Figure 4. It consists of the host microcontroller, slave (including the iButton information reading header and iButton) the host uses RS485 for remote communication (or connects to the Internet through microweb. The microcontroller uses the pic16f873 chip of microchip, while the api8108a voice chip is used to tell the user system information. iButton uses ds1990a, and the information reading header is read and sent to the host microcontroller at the same time, then, the host compares the received ID code with the previously stored iButton ID code. If they match, the system will follow the settings. Program Work. Otherwise, the system provides a voice prompt. The Communication Software Design flowchart 5 shows the communication between ds1990a and the host microcontroller. Generally, the communication between a host and a single bus device is completed by initializing, writing 0, writing 1, reading 0, and reading 1 time series. Below is a subroutine written in assembly language, although these procedures are for iButton, they are applicable to all single-bus devices and are easy to understand. They are provided for your reference. Reset BSF Rb2; The host pulls down the bus call delay_500us; returns the 500 μs reset pulse BCF Rb2; releases the bus call delay_200usbtfsc br1; checks whether iButton returns the response pulse no goto reset; no, reset the pulse call delay_500us; yes, return returnwrite_0 BSF Rb2; write the 0 time series subroutine call delay_10uscall delay_60usbcf rb2call delay_10usreturnwrite_1 BSF Rb2 for iButton; write 1 time series subroutine call delay_10usbcf rb2call delay_60usreturnread_time BSF Rb2 for iButton; nopnopnopbcf rb2call delay_10usreturn 6. Conclusion The single bus technology has unparalleled application prospects with its advantages of simple line, low hardware overhead, low cost, and simple software design. The single-bus-based iButton technology can effectively solve the problems of traditional identifiers, such as inconvenient carrying, damage, corruption, and electromagnetic interference, it can be used in highly secure access control, identity recognition, and other fields. Its communication is reliable, simple, and easy to implement. Therefore, the single-bus technology has broad application prospects and is a development field worth noting. (Comprehensive e-forum) |