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

Page 169: Tst_bit( ) function

Advertising
background image

Neuron C Reference Guide

149

{
...
int rc;
rc = touch_reset_spu(1WIREPIN);
}

touch_write_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_write_spu( ) function writes a specified number of bits of data on a 1-

Wire bus. This function ensures that the bus is in the actively driven high state
after writing the data.

Syntax

extern void touch_write_spu(unsigned

pinmask

, const 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 write.

Example

#define 1WIREPIN 0x01;

const unsigned actuatorData;

void f(void)
{
...

actuatorData = 168;
touch_write_spu(1WIREPIN, &actuatorData,
sizeof(actuatorData));
}

tst_bit( )

Function

The tst_bit( ) function tests a bit in a bit array pointed to by

array

. Bits are

numbered from left to right in each byte, so that the first bit in the array is the

most significant bit of the first byte in the array. Like all arrays in C, this first
element corresponds to index 0 (

bitnum

0). The function returns a boolean value,

TRUE if bit was set, FALSE if bit was not set. When managing a number of bits

Advertising