Touch_byte( ) built-in function, Syntax, Example – Echelon Neuron C User Manual

Page 164: Touch_byte_spu( ) built-in function

Advertising
background image

144

Functions

touch_byte( )

Built-in Function

The touch_byte( ) function sequentially writes and reads eight bits of data on a 1-

Wire bus. It can be used for either reading or writing. For reading, the

write-data

argument should be all ones (0xFF), and the return value contains the

eight bits as read from the bus. For writing, the bits in the

write-data

argument

are placed on the 1-WIRE bus, and the return value normally contains those
same bits.

Syntax

unsigned touch_byte(

io-object-name

, unsigned

write-data

);

Example

void f(void)
{

unsigned dataIn, dataOut;

...

dataOut = 42;

dataIn = touch_byte(ioObj, dataOut);

}

touch_byte_spu( )

Built-in Function

This function applies to 1-Wire bus devices that require the bus to be actively

held high during certain device operations. These devices require more current
than a typical external pull-up resistor can provide for device operations. An

example of such a device is the Maxim Integrated Products DS18S20 High-

Precision 1-Wire Digital Thermometer. For other 1-Wire devices, use the
standard touch_byte( ) function.
The touch_byte_spu( ) function writes eight bits of data on a 1-Wire bus. Unlike
the standard touch_byte( ) function, this function cannot be used for reading

data. For writing, the bits in the

data

argument are placed on the 1-Wire bus,

and the bus is left in the actively driven high state.

Syntax

extern void touch_byte_spu(unsigned

pinmask

, unsigned

data

);

pinmask

Specifies a single-bit representation for which I/O pins

IO0..IO7 to drive high when idle. Valid values are 0x01
(for IO0) to 0x08 (for IO7).

data

Specifies the data to place on the 1-Wire bus.

Example

#define 1WIREPIN 0x02;

void f(void)
{
unsigned

dataOut;

Advertising