Manual

Neuron C Reference Guide 147
touch_read_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_read_spu( ) function reads a specified number of bits of data on a 1-
Wire bus. This function ensures that the bus is not in the actively driven high
state prior to reading the data.
Syntax
extern void touch_read_spu(unsigned
pinmask
, unsigned *dp, unsigned
count
);
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).
dp
Specifies a pointer to the buffer into which the function
stores the read data.
count
Specifies the number of bits to read.
Example
#define 1WIREPIN 0x02;
unsigned sensorData;
void f(void)
{
...
touch_read_spu(1WIREPIN, *sensorData,
sizeof(sensorData));
}
touch_reset( ) Built-in Function
The touch_reset( ) function asserts the reset pulse and returns a one (1) value if a
presence pulse was detected, or a zero (0) if no presence pulse was detected, or a
minus-one (-1) value if the 1-Wire bus appears to be stuck low. The operation of
this function is controlled by several timing constants. The first is the reset pulse
period, which is 500 μs. Next, the Neuron Chip or Smart Transceiver releases
the 1-Wire bus and waits for the 1-Wire bus to return to the high state. This
period is limited to 275 μs, after which the touch_reset( ) function returns a (-1)
value with the assumption that the 1-Wire bus is stuck low. There also is a
minimum value for this period: for a Series 3100 device, it must be >4.8 μs @10
MHz, or >9.6 μs @5 MHz; for a Series 5000 device, it must be >0.3 μs @ 80 MHz,
or >4.8 μs @5 MHz.