Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page   Data Structures   File List   Data Fields   Globals  

rom400_ow.h File Reference


Detailed Description

Raw 1-Wire functions in the DS80C400 ROM.

This library contains functions for finding and communicating with devices on the internal 1-Wire. These functions use the DS80C400's 1-Wire master, applications do not need to worry about protecting the ROM 1-Wire routines from interruption.

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

These functions are all safe to be called from multiple processes simultaneously. That is, if two processes call one of these functions at the same time, the function parameters will not be destroyed. However, two processes attempting 1-Wire communications at the same time will surely cause communications problems. In addition, the memory space that ROM ID's are stored in is global for the system. Therefore, processes should synchronize around all 1-Wire communication sessions.

Go to the source code of this file.

Defines

#define ROM400_OW_VERSION   4
#define OW_RESET_SHORT   0
#define OW_RESET_PRESENCE   1
#define OW_RESET_ALARM   2
#define OW_RESET_NO_PRESENCE   3

Functions

unsigned char ow_first (void)
 Searches for the first device on the 1-Wire bus.

unsigned char ow_next (void)
 Searches the 1-Wire for subsequent devices.

unsigned char ow_reset (void)
 Sends a reset signal to the 1-Wire bus.

unsigned char ow_byte (unsigned char x)
 Sends/receives a byte to/from the 1-Wire bus.

unsigned char * ow_getcurrentid (void)
 Returns a pointer to the address of the current device in a 1-Wire bus search.

unsigned int ow_version (void)
 Returns the version number of this 1-Wire library.


Define Documentation

#define OW_RESET_ALARM   2
 

Result of a ow_reset operation. There is an alarming device on the 1-Wire bus.

See also:
ow_reset

#define OW_RESET_NO_PRESENCE   3
 

Result of a ow_reset operation. There is no device on the 1-Wire bus.

See also:
ow_reset

#define OW_RESET_PRESENCE   1
 

Result of a ow_reset operation. There is a device on the 1-Wire bus.

See also:
ow_reset

#define OW_RESET_SHORT   0
 

Result of a ow_reset operation. The 1-Wire bus is shorted.

See also:
ow_reset

#define ROM400_OW_VERSION   4
 

Version number associated with this header file. Should be the same as the version number returned by the ow_version function.

See also:
ow_version


Function Documentation

unsigned char ow_byte unsigned char    x
 

Sends/receives a byte to/from the 1-Wire bus.

Sends the input byte to the 1-Wire bus, and returns any byte transmitted from the 1-Wire bus. Send the byte 0xFF to return the result of a transmission by the slave (the device or iButton).

Parameters:
x byte to write to the 1-Wire bus
Returns:
Byte read from the 1-Wire bus

unsigned char ow_first void   
 

Searches for the first device on the 1-Wire bus.

Tries to access the first device on the 1-Wire bus. After a call to ow_first, use the address returned by ow_getcurrentid to read the 8 byte Address of the device. To read all the devices present, call this method only once, and then call ow_next to read all subsequent devices.

Returns:
Non-zero if a device is found, 0 if no devices are found.
See also:
ow_next

ow_getcurrentid

unsigned char* ow_getcurrentid void   
 

Returns a pointer to the address of the current device in a 1-Wire bus search.

Use the pointer returned by this method after every call to ow_first and ow_next. Note that calls to these functions destroy what was previously held at this address. Programs that need to remember all the devices found should copy the addresses one at a time as the 1-Wire bus is searched.

Returns:
Pointer to the 8-byte device address.
See also:
ow_first

ow_next

unsigned char ow_next void   
 

Searches the 1-Wire for subsequent devices.

Call ow_first once before making subsequent calls to ow_next to find the second, third, and so on devices. After a successful call to ow_next, call the function ow_getcurrentid to get the unique 64-bit address of the device found.

Returns:
Non-zero if a device is found, 0 if no more devices are found.
See also:
ow_first

ow_getcurrentid

unsigned char ow_reset void   
 

Sends a reset signal to the 1-Wire bus.

The result of a reset tells you if the bus is shorted, if a device is present, if an alarming device is present, or if no device is present.

Returns:
Result of reset (i.e. OW_RESET_SHORT)
See also:
OW_RESET_SHORT

OW_RESET_PRESENCE

OW_RESET_ALARM

OW_RESET_NO_PRESENCE

unsigned int ow_version void   
 

Returns the version number of this 1-Wire library.

Returns:
Version number of this 1-Wire library.


Copyright 2004 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.