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"
[unchecked revision] | [unchecked revision] |
(→Registers 1-Wire driver) |
(→Registers 1-Wire driver) |
||
Line 53: | Line 53: | ||
|} | |} | ||
|- valign="top" | |- valign="top" | ||
− | | | + | |Dallas channel number 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;"| | + | |style="padding-left:0.5em;"|set the channel number used by the controller to work with 1-Wire bus . |
|} | |} | ||
|} | |} | ||
− | + | The channel configuration for operation 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 device type |
− | | | + | |DS18X20 temperature sensor, CP-Z reader in the DS1990A emulation mode, DS1990A reader |
|} | |} | ||
− | + | 1-Wire transmit registers. | |
− | + | With the help of 1-Wire driver transmission registers , the user can specify the address of the 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 start transmission 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" | ||
− | | | + | |The setup registers of Dallas 64-bit transmission destination ROM-code 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;"| | + | |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" | ||
− | | | + | |The setup registers of Dallas 64-bit transmission destination ROM-code 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;"| | + | |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" | ||
− | | | + | |The setup registers of Dallas 64-bit transmission destination ROM-code 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;"| | + | |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" | ||
− | | | + | |The setup registers of Dallas 64-bit transmission destination ROM-code 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;"| | + | |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;"|'' | + | |valign="top" style="padding-left:0.5em;"|''The setup registers of Dallas 64-bit transmission destination ROM-code is only used to select a device on the 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 it ROM- code unknown, set "0" value into all registers of Dallas transmission destination ROM-code.'' |
|} | |} | ||
− | + | 1-Wire driver receive registers . | |
− | + | In operation, upon receiption of responses from the slave devices to the controller requests, data, according to the 1-Wire driver configuration, stored in its corresponding receiving registers. | |
− | + | General reception 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" | ||
− | | | + | |Register the presence of the received data Dallas |
|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;"| | + | |style="padding-left:0.5em;"|successfully received data from the slave node and it is available in Dallas 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. |
|} | |} | ||
|} | |} | ||
− | + | Reception in CZP / DS1990A mode. | |
{|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 | |Регистр чтения 64-битного ROM-кода устройства Dallas SN0:FC |
Revision as of 05:02, 20 August 2016
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.
Registers 1-Wire driver
Below is a description of the 1-Wire driver operation control registers.
Registers 1-Wire driver configuration.
To activate the 1-Wire driver, need to select the controller channel number connected to 1-Wire bus, in the appropriate driver register.
Note: | 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. |
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 losing data 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 configuration to use with a temperature sensor DS18X20.
1-Wire driver configuration registers.
Адрес | Expected values | ||||||
---|---|---|---|---|---|---|---|
Dallas configuration register |
| ||||||
Dallas channel number register |
|
The channel configuration for operation in this mode is set by the following named constants:
Parameter | List of expected values |
---|---|
1-Wire device type | DS18X20 temperature sensor, CP-Z reader in the DS1990A emulation mode, DS1990A reader |
1-Wire transmit registers.
With the help of 1-Wire driver transmission registers , the user can specify the address of the respondent slave node and send a request for data transfer.
Address | Expected values | ||||||
---|---|---|---|---|---|---|---|
Dallas start transmission register |
| ||||||
The setup registers of Dallas 64-bit transmission destination ROM-code SN0:FC |
| ||||||
The setup registers of Dallas 64-bit transmission destination ROM-code SN2:SN1 |
| ||||||
The setup registers of Dallas 64-bit transmission destination ROM-code SN4:SN3 |
| ||||||
The setup registers of Dallas 64-bit transmission destination ROM-code CRC:SN5 |
|
Note: | The setup registers of Dallas 64-bit transmission destination ROM-code is only used to select a device on the 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 it ROM- code unknown, set "0" value into all registers of Dallas transmission destination ROM-code. |
1-Wire driver receive registers .
In operation, upon receiption of responses from the slave devices to the controller requests, data, according to the 1-Wire driver configuration, stored in its corresponding receiving registers.
General reception registers.
Address | Return values | ||||||
---|---|---|---|---|---|---|---|
Register the presence of the received data Dallas |
|
Reception in CZP / DS1990A mode.
Address | Return values | |||
---|---|---|---|---|
Регистр чтения 64-битного ROM-кода устройства Dallas SN0:FC |
| |||
Регистр чтения 64-битного ROM-кода устройства Dallas SN2:SN1 |
| |||
Регистр чтения 64-битного ROM-кода устройства Dallas SN4:SN3 |
| |||
Регистр чтения 64-битного ROM-кода устройства Dallas CRC:SN5 |
|
Прием в режиме DS18X20.
Адрес | Возвращаемые значения | ||||||
---|---|---|---|---|---|---|---|
Регистр чтения показаний температуры: целые градусы Цельсия |
| ||||||
Регистр чтения показаний температуры: десятитысячные доли градуса Цельсия |
| ||||||
Регистр чтения показаний температуры: знак (0 = выше нуля; 1 = ниже нуля) |
|
Примечание: | При приеме в режиме DS18X20 период опроса датчика температуры, т. е. отправки ему запросов с помощью регистра начала передачи Dallas, должен быть не менее 750мс. |
Пример функциональной диаграммы работы с термодатчиком DS18X20.
Опрос термодатчика, подключенного к каналу №5 контроллера, осуществляется 1 раз в секунду. При получении данных от DS18X20, в регистре наличия принятых данных драйвера Dallas появляется значение «1» и данные из регистров чтения показаний температуры, с помощью D-триггеров, сохраняются в соответствующие именованные сети для дальнейшей обработки.