meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
com:basic_1wire [2023/05/18 23:23] – created - external edit 127.0.0.1com:basic_1wire [2024/11/16 20:47] (current) – [1-wire topics on lamaPLC] vamsan
Line 5: Line 5:
 \\ \\
 One distinctive feature of the bus is the possibility of using only two wires — data and ground. To accomplish this, 1-Wire devices include an 800 pF capacitor to store charge and power the device during periods when the data line is active.\\ One distinctive feature of the bus is the possibility of using only two wires — data and ground. To accomplish this, 1-Wire devices include an 800 pF capacitor to store charge and power the device during periods when the data line is active.\\
 +
 +The 1-Wire devices are specifically designed and optimized to read and write efficiently to 1-Wire devices and networks. Similar to UART/USART controller, they handle clocked operations natively with the use of a buffer, offloading the processing load from the host processor (e.g., sensor gateway or microcontroller) thereby increasing accuracy . External pull-up resistors are also often not required.
  
 ===== Features of the 1-wire bus ===== ===== Features of the 1-wire bus =====
Line 13: Line 15:
   * A cable with a cross-section of at least 0.6 mm must be used. A shielded, twisted-pair cable is required for longer distances. The maximum length of the cable is 6 meters.   * A cable with a cross-section of at least 0.6 mm must be used. A shielded, twisted-pair cable is required for longer distances. The maximum length of the cable is 6 meters.
   * Each 1-Wire chip has a unique identifier code.   * Each 1-Wire chip has a unique identifier code.
-  * A 1-Wire network is a single open drain wire with a single pull-up resistor. The pull-up resistor pulls the wire up to 3 or 5 volts. +  * A 1-Wire network is a single open drain wire with a single pull-up resistor. The pull-up resistor pulls the wire up to 3 or 5 volts. 
 +  * Most UART/USARTs are perfectly capable of sustained speeds well in excess of the 15.4kbps required of the 1-Wire bus in standard mode 
  
 ===== Parasitic / normal mode by 1-wire bus ===== ===== Parasitic / normal mode by 1-wire bus =====
Line 19: Line 22:
 ^Normal mode^Parasitic mode| ^Normal mode^Parasitic mode|
 |{{:com:ds18b20_normal_mode.png|Normal mode by 1-wire bus}}|{{:com:ds18b20_parasite_mode.png|Parasitic mode by 1-wire bus}}| |{{:com:ds18b20_normal_mode.png|Normal mode by 1-wire bus}}|{{:com:ds18b20_parasite_mode.png|Parasitic mode by 1-wire bus}}|
-|In normal 3-wire mode, power is supplied from Vdd to the Vdd pins of the ICs|In parasitic2-wire mode, the Vdd pins of the ICs must be connected to GND, the power supply is implemented on the Data wire.|+|With an external supply, three wires are required: the bus wire, ground, and power. The 4.7k pull-up resistor is still required on the bus wire. As the bus is free for data transfer, the microcontroller can continually poll the state of a device doing a conversion. This way, a conversion request can finish as soon as the device reports being done, as opposed to having to wait for conversion time (dependent on device function and resolution) in "parasite" power mode.|When operating in parasite power modeonly two wires are required: one data wire, and one ground. In this mode, the power line must be connected to groundper the datasheet. At the controller, a 4.7k pull-up resistor must be connected to the 1-wire bus. When the line is in a "high" state, the device pulls current to charge an internal capacitor.|
  
 The example above shows the application of the DS18B20 digital temperature sensor in parasitic / normal mode. The example above shows the application of the DS18B20 digital temperature sensor in parasitic / normal mode.
  
-===== Sources =====+===== Addressing a 1-Wire device ===== 
 +Each 1-Wire device contains a unique 64-bit 'ROM' address, consisting of an 8-bit family code, a 48-bit serial number, and an 8-bit CRC. The CRC is used to verify the integrity of the data. 
  
 +For example, the sample code, below, checks if the device being addressed is a DS18S20 temperature sensor by checking for its family code, 0x10. To use the sample code with the newer DS18B20 sensor, you would check for a family code of 0x28, instead, and for the DS1822 you would check for 0x22.
 +
 +===== Single-device commands =====
 +Before sending a command to a single peripheral device, the controller must first select that device using its unique ROM. Subsequent commands will be responded to by the selected device, if found.
 +
 +===== Multiple-device commands =====
 +Alternatively, you can address a command to all peripheral devices by issuing a 'Skip ROM' command (0xCC), instead. It is important to consider the effects of issuing a command to multiple devices. 
 +
 +Sometimes, this may be intended and beneficial. For example, issuing a Skip ROM followed by a convert T (0x44) would instruct all networked devices that have a Convert T command to perform a temperature conversion. 
 +
 +This can be a time-saving and efficient way of performing the operations. On the other hand, issuing a Read Scratchpad (0xBE) command would cause all devices to report Scratchpad data simultaneously. Power consumption of all devices (for example, during a temperature conversion) is also important when using a Skip ROM command sequence.
 +
 +===== Sources =====
 Wikipedia ([[https://en.wikipedia.org/wiki/1-Wire|here]]) \\ Wikipedia ([[https://en.wikipedia.org/wiki/1-Wire|here]]) \\
 +[[https://docs.arduino.cc/learn/communication/one-wire/|Arduino: 1-Wire Protocol]] \\
 +
 +===== 1-wire topics on lamaPLC =====
 +{{topic>1-wire}}
  
 \\ \\
 \\ \\
-\\ +{{tag>1-wire communication bus MicroLAN I2C UART USART DS18B20}}
-{{tag>1-wire communication bus MicroLAN}}+
 \\ \\
 This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}