CANNY 5.3 Pico. Dallas 1-Wire Driver

General Description

CANNY 5.3 Pico controller can be used as a MASTER in a single-wire data network Dallas 1-Wire®. The controller is only capable of sending requests for data to slave devices.

All CANNY 5.3 Pico input-output channels Onley one input-output channel of CANNY 5.3 Pico (channel #9) 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 a 3-7k Ohm resistor. Depending on the specific mode (defined through the function diagram), the CANNY 5.3 Pico implementation makes it possible to communicate with a specific device through the 1-Wire bus by using the device address. This enables the controller to work with several SLAVE devices. It’s also possible to perform a serial connection of the controller to several 1-Wire buses. In operating modes when device handling by address is not available, therefore you will only be able to connect to one SLAVE node per channel.

Dallas 1-Wire driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for channel, for which the Dallas 1-Wire driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

The SLAVE device needs to have permanent, rather than parasitic, power.

Driver registers

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

Dallas 1-Wire® driver configuration registers.

To activate the Dallas 1-Wire® driver, you need to write the type of the using’s Dallas 1-Wire® device, into the driver configuration register.

Manage requests for information from SLAVE devices and control data received by addressing the appropriate registers, described below.

Note: To avoid data loss when working with several Dallas devices, switch between them only after receiving responses from the connected slaves and processing or saving the data.

Example of controller’s configuration to work with a DS18X20 temperature sensor.
Dallas 1-Wire® Setup Registers.
Register Expected values
Dallas 1-Wire® Mode Setup register 1…N = activates the driver and sets the connected device type (defined by a named constant from the named constants list)
0 = disconnects the channel from the 1-Wire driver, returns channel control to the the discrete IO driver

The following named constants define channel configuration.

Device type constants.
Constant Permitted values
Dallas 1-Wire® device type DS18X20 temperature sensor, DS1990A reader

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.

1-Wire driver transmit registers.
Register Expected values
Dallas 1-Wire® Request To Send Register ≥ 1 = sends a request for data to the slave
0 = does not send a request for data to the slave
Dallas 1-Wire® Requested Device ID RAW Data Register SN0:FC 0…0xFFFF = register value: the lower part represents 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…0xFFFF = 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…0xFFFF = 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 0…0xFFFF = 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 64-bit transmission destination ROM-code setup registers are only used to select a device on the Dallas 1-Wire® bus by its unique number (ROM-code), when multiple devices connected to one bus. If you are working with a single device on the bus and do not know its’ ROM-code, write “0” into all “Requested Device ID” registers.

When you receive data over the 1-Wire bus, the data is placed into the appropriate receive register, and a control bit is set in the Data Set Ready register.

General receive registers.
Register Return values
Dallas 1-Wire® Data Set Ready Register 1 = denotes that data was successfully received from a slave node and is available in Dallas 1-Wire® driver read registers
0 = denotes that there is no new data in the driver receive registers
Dallas 1-Wire® Error Register 1 = during Dallas 1-Wire® data reception an error occurred, received corrupt data
0 = during Dallas 1-Wire® data reception errors no was occurred
DS1990A reader receive registers.
Register Return values
Dallas 1-Wire® Received Raw Data Register SN0:FC 0…0xFFFF = register value: lower part contains family key identifier (FC), upper part contains the first byte of unique key address (SN0).
Dallas 1-Wire® Received Raw Data Register SN2:SN1 0…0xFFFF = register value: lower part contains the second byte of unique key address (SN1), upper part contains the third byte of unique key address (SN2).
Dallas 1-Wire® Received Raw Data Register SN4:SN3 0…0xFFFF = register value: lower part contains the forth byte of unique key address (SN3), upper part contains the fifth byte of unique key address (SN4).
Dallas 1-Wire® Received Raw Data Register CRC:SN 0…0xFFFF = register value: lower part contains the sixth byte of unique key address (SN5), upper part contains key checksum ROM-code (CRC).
DS18X20 mode receive registers.
Register Return values
DS18X20 Received Temperature Data Register: Integer Part 0…125 = defines the modulo of the integer part of the temperature value measured by the sensor
DS18X20 Received Temperature Data Register: Fractional Part ( x 0.0001) 0…9999 = defines the modulo of the decimal part of the temperature value measured by the sensor
DS18X20 Received Temperature Data Register: Sign (0 = above zero; 1 = below zero) 0 = denotes that the temperature measured by the sensor is above zero 1 = denotes that the temperature measured by the sensor is below zero

Note: When receiving in DS18X20 mode the temperature sensor poll rate (period between sending requests through the “Request to send” register) should be no shorter than 750ms.

Examples

Example of a function diagram working with a DS18X20 temperature sensor.

The temperature sensor connected to channel #9 is polled 1 time per second. When the controller receives data from DS18X20, the Dallas 1-Wire® Data Set Ready Register is set to “1” and data from the temperature reading registers is stored in respective named networks with the help of D Flip-Flops, converted to ASCII and sended to CAN.

Example of a function diagram working with a DS18X20 temperature sensor.

The temperature sensor connected to channel #9 is polled 1 time per second. When the controller receives data from DS18X20, the Dallas 1-Wire® Data Set Ready Register is set to “1” and data from the temperature reading registers is stored in respective named networks with the help of D Flip-Flops, converted to ASCII and sended to UART2.

SEE ALSO