This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Difference between revisions of "CANNY 7, Dallas 1-Wire Driver"

From CANNY Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Dallas 1-Wire® driver)
 
(10 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
The slave must have a permanent, rather than parasitic power.
 
The slave must have a permanent, rather than parasitic power.
  
=== Registers 1-Wire driver ===
+
=== Dallas 1-Wire® driver ===
  
Below is a description of the 1-Wire driver operation control registers.
+
Below is a description of the Dallas 1-Wire® driver registers.
  
Registers 1-Wire driver configuration.
+
Dallas 1-Wire® driver configuration registers.
  
To activate the 1-Wire driver, need to select the controller channel number connected to 1-Wire bus, in the appropriate driver register.
+
To activate Dallas 1-Wire® driver, you need to select the controller channel number connected to Dallas 1-Wire® bus, in the appropriate driver register.
  
 
{|
 
{|
 
|valign="top" style="padding-left:0.5em;"|''Note:''
 
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''At any given time, the driver can work with only one of the connected 1-Wire bus, when it is allowed to dynamically switch between buses in the implementation of the functional diagram.''
+
|valign="top" style="padding-left:0.5em;"|''At any given time, the driver can work with only one of the connected Dallas 1-Wire® bus, when it is allowed to dynamically switch between buses in the implementation of the functional diagram.''
 
|}
 
|}
  
Управление отправкой запросов на получение данных от ведомых устройств и контроль получения их ответов (опросов датчиков) выполняется с помощью соответствующих регистров драйвера 1-Wire.
+
Sent requests management to get information from the slaves and control receiving of their responses (sensors poll) is performed by appropriate registers of 1-Wire driver.
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''Во избежание потери данных при работе с несколькими шинами Dallas, выполняйте переключение между ними только после получения от ведомых устройств ответов на запрос контроллера и обработки или сохранения полученных данных.''
+
|valign="top" style="padding-left:0.5em;"|''To avoid data loss, when working with several Dallas buses, perform switching between them only after receiving responses from the slaves requested by the controller and processing or saving the data.''
 
|}
 
|}
  
Пример конфигурации канала №5 для работы с датчиком температуры DS18X20.
+
Example of channel #5 configured to work with a temperature sensor DS18X20.
  
 
[[File:6_12_2_1.png|center|300px]]
 
[[File:6_12_2_1.png|center|300px]]
  
Регистры конфигурации драйвера 1-Wire.
+
Dallas 1-Wire® Setup Registers.
  
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Ожидаемые значения
+
!Expected values
 
|- valign="top"
 
|- valign="top"
|Регистр конфигурации Dallas
+
|Dallas 1-Wire® Mode Setup register
 
|valign="top"|
 
|valign="top"|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 46: Line 46:
 
|width="70px" style="padding-left:0.5em;"|1...65535
 
|width="70px" style="padding-left:0.5em;"|1...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|активизация драйвера и установка типа подключаемого устройства (задается специальной константой из справочника констант);
+
|style="padding-left:0.5em;"|driver activation and setting the device type (defined by a special constant of the constants directory);
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|отключить канал от драйвера UART, вернуть управление каналом драйверу каналов ввода-вывода и разрешить изменения его состояния из функциональной диаграммы.
+
|style="padding-left:0.5em;"|disconnect the channel from 1-Wire driver, return channel control to IO channels driver and allow status changing from the functional diagram.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр номера канала Dallas
+
|Dallas 1-Wire® IO Channel Select Register
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 59: Line 59:
 
|width="70px" style="padding-left:0.5em;"|0...10
 
|width="70px" style="padding-left:0.5em;"|0...10
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|установить номер канала контроллера используемого для работы с шиной 1-Wire.
+
|style="padding-left:0.5em;"|set the channel number used by the controller to work with Dallas 1-Wire® bus .
 
|}
 
|}
 
|}
 
|}
  
  
Конфигурация канала для работы в данном режиме задается следующим именованными константами:
+
Channel configuration to operate in this mode is set by the following named constants:
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Параметр
+
!width="250px"|Parameter
!Перечень допустимых значений
+
!List of expected values
 
|- valign="top"
 
|- valign="top"
|Тип устройства 1-Wire
+
|Dallas 1-Wire® device type
|Датчик температуры DS18X20, Считыватель CP-Z в режиме эмуляции DS1990A, Считыватель DS1990A
+
|DS18X20 temperature sensor, CP-Z reader in the DS1990A emulation mode, DS1990A reader
 
|}
 
|}
  
  
Регистры передачи драйвера 1-Wire.
+
Dallas 1-Wire® Request Registers.
  
С помощью регистров передачи драйвера 1-Wire пользователь может задать адрес опрашиваемого ведомого устройства и отправить запрос на получение данных.  
+
With the help of Dallas 1-Wire® driver request registers , the user can specify the address of respondent slave node and send a request for data transfer.  
  
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Ожидаемые значения
+
!Expected values
 
|- valign="top"
 
|- valign="top"
|Регистр начала передачи Dallas
+
|Dallas 1-Wire® Request To Send Register
 
|valign="top"|
 
|valign="top"|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 90: Line 90:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|отправить ведомому устройству запрос на получение данных;
+
|style="padding-left:0.5em;"|send a request for data to the slave;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|не отправлять ведомому устройству запрос на получение данных.
+
|style="padding-left:0.5em;"|do not send a request for data to the slave.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр установки 64-битного ROM-кода адресата передачи Dallas SN0:FC
+
|Dallas 1-Wire® Requested Device ID RAW Data Register SN0:FC
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 103: Line 103:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит идентификатор семейства устройства (FC), старшая часть содержит первый байт уникального адреса устройства (SN0).
+
|style="padding-left:0.5em;"|register value: the lower part represent a device family identifier (FC), the upper part contains the first byte of the unique device address (SN0).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр установки 64-битного ROM-кода адресата передачи Dallas SN2:SN1
+
|Dallas 1-Wire® Requested Device ID RAW Data Register SN2:SN1
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 112: Line 112:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит второй байт уникального адреса устройства (SN1), старшая часть содержит третий байт уникального адреса устройства (SN2).
+
|style="padding-left:0.5em;"|register value: the lower part contains the 2nd byte of the unique device address (SN1), the upper part contains the 3rd byte of the unique device address (SN2).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр установки 64-битного ROM-кода адресата передачи Dallas SN4:SN3
+
|Dallas 1-Wire® Requested Device ID RAW Data Register SN4:SN3
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 121: Line 121:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит четвертый байт уникального адреса устройства (SN3), старшая часть содержит пятый байт уникального адреса устройства (SN4).
+
|style="padding-left:0.5em;"|register value: the lower part contains the 4th byte of the unique device address (SN3), the upper part contains the 5th byte of the unique device address (SN4).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр установки 64-битного ROM-кода адресата передачи Dallas CRC:SN5
+
|Dallas 1-Wire® Requested Device ID RAW Data Register CRC:SN5
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 130: Line 130:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит шестой байт уникального адреса устройства (SN5), старшая часть содержит контрольную сумму ROM-кода адресата (CRC).
+
|style="padding-left:0.5em;"|register value: the lower part contains the 6th byte of the unique device address (SN5), the upper part contains ROM-code addressee checksum (CRC).
 
|}
 
|}
 
|}
 
|}
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''Регистры установки 64-битного ROM-кода адресата передачи Dallas используются только для выбора устройства на шине 1-Wire по его уникальному номеру (ROM-коду), в случае подключения к одной шине нескольких устройств. При работе с единственным устройством на шине, в случае если его ROM-код неизвестен, установите значение «0» во все регистры ROM-кода адресата передачи Dallas.''
+
|valign="top" style="padding-left:0.5em;"|''The setup registers of Dallas 1-Wire® 64-bit transmission destination ROM-code is only used to select a device on the Dallas 1-Wire® bus by its unique number (ROM-code), in case of multiple devices connected to the same bus. During operation with a single device on the bus, when its ROM- code unknown, set "0" value into all registers of Dallas transmission destination ROM-code.''
 
|}
 
|}
  
  
Регистры приема драйвера 1-Wire.
+
Dallas 1-Wire® Receive Registers.
  
В процессе работы, при получении от ведомых устройств ответов на запросы контроллера, данные, в зависимости от конфигурации драйвера 1-Wire, размещаются в его соответствующие регистры приема.
+
During its operation, upon reception of responses from the slave devices to the controller data requests, according to Dallas 1-Wire® driver configuration, stored in its corresponding receiving registers.
  
Общие регистры приема.
+
General receive registers.
  
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Возвращаемые значения
+
!Return values
 
|- valign="top"
 
|- valign="top"
|Регистр наличия принятых данных  Dallas
+
|Dallas 1-Wire® Data Set Ready Register
 
|valign="top"|
 
|valign="top"|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 157: Line 157:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|данные от ведомого устройства успешно получены и доступно в регистрах чтения драйвера Dallas;
+
|style="padding-left:0.5em;"|successfully received data from the slave node and it is available in Dallas 1-Wire® driver read registers;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|в буфере приема драйвера отсутствуют актуальные данные.
+
|style="padding-left:0.5em;"|there is no actual data in the driver receive buffer.
 
|}
 
|}
 
|}
 
|}
  
  
Прием в режиме CZP / DS1990A.
+
iButton® DS1990A Receive Mode Registers.
  
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Возвращаемые значения
+
!Return values
 
|- valign="top"
 
|- valign="top"
|Регистр чтения 64-битного ROM-кода устройства Dallas SN0:FC
+
|Dallas 1-Wire® Received Raw Data Register D0:FC
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 179: Line 179:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит идентификатор семейства ключа (FC), старшая часть содержит первый байт уникального адреса ключа (SN0).
+
|style="padding-left:0.5em;"|register value: lower part contains family key identifier (FC), higher part contains the first byte of unique key address (SN0).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр чтения 64-битного ROM-кода устройства Dallas SN2:SN1
+
|Dallas 1-Wire® Received Raw Data Register D2:D1
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 188: Line 188:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит второй байт уникального адреса ключа (SN1), старшая часть содержит третий байт уникального адреса ключа (SN2).
+
|style="padding-left:0.5em;"|register value: lower part contains the second byte of unique key address (SN1), higher part contains the third byte of unique key address (SN2).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр чтения 64-битного ROM-кода устройства Dallas SN4:SN3
+
|Dallas 1-Wire® Received Raw Data Register D4:D3
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 197: Line 197:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит четвертый байт уникального адреса ключа (SN3), старшая часть содержит пятый байт уникального адреса ключа (SN4).
+
|style="padding-left:0.5em;"|register value: lower part contains the forth byte of unique key address (SN3), higher part contains the fifth byte of unique key address (SN4).
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр чтения 64-битного ROM-кода устройства Dallas CRC:SN5
+
|Dallas 1-Wire® Received Raw Data Register CRC:D5
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 206: Line 206:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значение регистра: младшая часть содержит шестой байт уникального адреса ключа (SN5), старшая часть содержит контрольную сумму ROM-кода ключа (CRC).
+
|style="padding-left:0.5em;"|register value: lower part contains the sixth byte of unique key address (SN5), higher part contains key checksum ROM-code (CRC).
 
|}
 
|}
 
|}
 
|}
  
  
Прием в режиме DS18X20.
+
DS18X20 Receive Mode Registers.
  
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Возвращаемые значения
+
!Returning values
 
|- valign="top"
 
|- valign="top"
|Регистр чтения показаний температуры: целые градусы Цельсия
+
|DS18X20 Received Temperature Data Register: Integer Part
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 224: Line 224:
 
|width="70px" style="padding-left:0.5em;"|0...125
 
|width="70px" style="padding-left:0.5em;"|0...125
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|модуль целой части значения измеренной датчиком температуры.
+
|style="padding-left:0.5em;"|modulo of integer part of temperature value measured by the sensor.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр чтения показаний температуры: десятитысячные доли градуса Цельсия
+
|DS18X20 Received Temperature Data Register: Fractional Part ( x 0.0001)
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 233: Line 233:
 
|width="70px" style="padding-left:0.5em;"|0...9999
 
|width="70px" style="padding-left:0.5em;"|0...9999
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|модуль десятичной части значения измеренной датчиком температуры.
+
|style="padding-left:0.5em;"|modulo of decimal part of temperature value measured by the sensor.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
|Регистр чтения показаний температуры: знак (0 = выше нуля; 1 = ниже нуля)
+
|DS18X20 Received Temperature Data Register: Sign (0 = above zero; 1 = below zero)
 
|valign="top"|
 
|valign="top"|
 
{|border="0" align="left"
 
{|border="0" align="left"
Line 242: Line 242:
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|измеренная датчиком температура не ниже нуля;
+
|style="padding-left:0.5em;"|the temperature measured by the sensor is above zero;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|измеренная датчиком температура ниже нуля.
+
|style="padding-left:0.5em;"|the temperature measured by the sensor is below zero.
 
|}
 
|}
 
|}
 
|}
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''При приеме в режиме DS18X20 период опроса датчика температуры, т. е. отправки ему запросов с помощью регистра начала передачи Dallas, должен быть не менее 750мс.''
+
|valign="top" style="padding-left:0.5em;"|''When receiving in DS18X20 mode, temperature sensor duty cycle, those send requests via Dallas transmission start register, should not be less than 750ms.''
 
|}
 
|}
  
Пример функциональной диаграммы работы с термодатчиком DS18X20.
+
Example of a functional diagram working with DS18X20 temperature sensor.
  
 
[[File:6_12_2_2.png|center]]
 
[[File:6_12_2_2.png|center]]
  
Опрос термодатчика, подключенного к каналу №5 контроллера, осуществляется 1 раз в секунду. При получении данных от DS18X20, в регистре наличия принятых данных драйвера Dallas появляется значение «1» и данные из регистров чтения показаний температуры, с помощью D-триггеров, сохраняются в соответствующие именованные сети для дальнейшей обработки.
+
temperature sensor poll, connected to the channel #5, carried out 1 time per second. When receiving data from DS18X20, in Dallas 1-Wire® Data Set Ready Register appears value "1" and data from the temperature reading registers, with help of D flip-flops, is stored in respective named networks for further processing.
 +
 
 +
Sensor connection circuit.
 +
 
 +
[[File:6_12_2_3.png|800px|center]]
  
== Смотри также ==
+
== See also ==
 
[[CANNY 7]]
 
[[CANNY 7]]
  
 
[[CANNY 7, I²C Driver]]
 
[[CANNY 7, I²C Driver]]

Latest revision as of 13:15, 5 February 2018

General Description

Controller CANNY 7 can be used as a master node in a single-wire data network Dallas® 1-Wire®, while it has the ability to only send requests for data from slave devices.

Any of CANNY 7 input-output channels can be used to connect the controller to 1-Wire bus. At the same time, that channel must be externally pulled-up to 5V with resistor 3-7k Ohm. Consistently reassigning driver channels, it's possible to arrange up to 11 independent connections 1-Wire. Wherein device addressing and device handling by address is not available, therefore, in 1-Wire mode it is possible to connect only one SLAVE node at a time to controllers' channel.

Driver Dallas 1-Wire in its operation uses controller channels' resources, but has a higher priority than discrete input-output driver.Thus, upon activation Dallas 1-Wire driver, for channels involved in to its operation, change values in associated registers of discrete input-output driver will be ignored.

The slave must have a permanent, rather than parasitic power.

Dallas 1-Wire® driver

Below is a description of the Dallas 1-Wire® driver registers.

Dallas 1-Wire® driver configuration registers.

To activate Dallas 1-Wire® driver, you need to select the controller channel number connected to Dallas 1-Wire® bus, in the appropriate driver register.

Note: At any given time, the driver can work with only one of the connected Dallas 1-Wire® bus, when it is allowed to dynamically switch between buses in the implementation of the functional diagram.

Sent requests management to get information from the slaves and control receiving of their responses (sensors poll) is performed by appropriate registers of 1-Wire driver.

Note: To avoid data loss, when working with several Dallas buses, perform switching between them only after receiving responses from the slaves requested by the controller and processing or saving the data.

Example of channel #5 configured to work with a temperature sensor DS18X20.

6 12 2 1.png

Dallas 1-Wire® Setup Registers.

Address Expected values
Dallas 1-Wire® Mode Setup register
1...65535 = driver activation and setting the device type (defined by a special constant of the constants directory);
0 = disconnect the channel from 1-Wire driver, return channel control to IO channels driver and allow status changing from the functional diagram.
Dallas 1-Wire® IO Channel Select Register
0...10 = set the channel number used by the controller to work with Dallas 1-Wire® bus .


Channel configuration to operate in this mode is set by the following named constants:

Parameter List of expected values
Dallas 1-Wire® device type DS18X20 temperature sensor, CP-Z reader in the DS1990A emulation mode, DS1990A reader


Dallas 1-Wire® Request Registers.

With the help of Dallas 1-Wire® driver request registers , the user can specify the address of respondent slave node and send a request for data transfer.

Address Expected values
Dallas 1-Wire® Request To Send Register
1 = send a request for data to the slave;
0 = do not send a request for data to the slave.
Dallas 1-Wire® Requested Device ID RAW Data Register SN0:FC
0...65535 = register value: the lower part represent a device family identifier (FC), the upper part contains the first byte of the unique device address (SN0).
Dallas 1-Wire® Requested Device ID RAW Data Register SN2:SN1
0...65535 = register value: the lower part contains the 2nd byte of the unique device address (SN1), the upper part contains the 3rd byte of the unique device address (SN2).
Dallas 1-Wire® Requested Device ID RAW Data Register SN4:SN3
0...65535 = register value: the lower part contains the 4th byte of the unique device address (SN3), the upper part contains the 5th byte of the unique device address (SN4).
Dallas 1-Wire® Requested Device ID RAW Data Register CRC:SN5
0...65535 = register value: the lower part contains the 6th byte of the unique device address (SN5), the upper part contains ROM-code addressee checksum (CRC).
Note: The setup registers of Dallas 1-Wire® 64-bit transmission destination ROM-code is only used to select a device on the Dallas 1-Wire® bus by its unique number (ROM-code), in case of multiple devices connected to the same bus. During operation with a single device on the bus, when its ROM- code unknown, set "0" value into all registers of Dallas transmission destination ROM-code.


Dallas 1-Wire® Receive Registers.

During its operation, upon reception of responses from the slave devices to the controller data requests, according to Dallas 1-Wire® driver configuration, stored in its corresponding receiving registers.

General receive registers.

Address Return values
Dallas 1-Wire® Data Set Ready Register
1 = successfully received data from the slave node and it is available in Dallas 1-Wire® driver read registers;
0 = there is no actual data in the driver receive buffer.


iButton® DS1990A Receive Mode Registers.

Address Return values
Dallas 1-Wire® Received Raw Data Register D0:FC
0...65535 = register value: lower part contains family key identifier (FC), higher part contains the first byte of unique key address (SN0).
Dallas 1-Wire® Received Raw Data Register D2:D1
0...65535 = register value: lower part contains the second byte of unique key address (SN1), higher part contains the third byte of unique key address (SN2).
Dallas 1-Wire® Received Raw Data Register D4:D3
0...65535 = register value: lower part contains the forth byte of unique key address (SN3), higher part contains the fifth byte of unique key address (SN4).
Dallas 1-Wire® Received Raw Data Register CRC:D5
0...65535 = register value: lower part contains the sixth byte of unique key address (SN5), higher part contains key checksum ROM-code (CRC).


DS18X20 Receive Mode Registers.

Address Returning values
DS18X20 Received Temperature Data Register: Integer Part
0...125 = modulo of integer part of temperature value measured by the sensor.
DS18X20 Received Temperature Data Register: Fractional Part ( x 0.0001)
0...9999 = modulo of decimal part of temperature value measured by the sensor.
DS18X20 Received Temperature Data Register: Sign (0 = above zero; 1 = below zero)
0 = the temperature measured by the sensor is above zero;
1 = the temperature measured by the sensor is below zero.
Note: When receiving in DS18X20 mode, temperature sensor duty cycle, those send requests via Dallas transmission start register, should not be less than 750ms.

Example of a functional diagram working with DS18X20 temperature sensor.

6 12 2 2.png

temperature sensor poll, connected to the channel #5, carried out 1 time per second. When receiving data from DS18X20, in Dallas 1-Wire® Data Set Ready Register appears value "1" and data from the temperature reading registers, with help of D flip-flops, is stored in respective named networks for further processing.

Sensor connection circuit.

6 12 2 3.png

See also

CANNY 7

CANNY 7, I²C Driver