beautypg.com

Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 59

background image

I/O Model Reference

49

the 1-Wire bus. The last_discrepancy variable is used internally and should not

be modified.

To start a new search:

1. Call touch_first( )
2. As long as the search_done flag is not set, call touch_next( ) as many

times as are required.

For a Series 3100 device, each call to touch_first( ) or touch_next( ) takes 41 ms to
execute at 10 MHz (63 ms at 5 MHz) when a device is being read. For a Series

5000 device, each call to touch_first( ) or touch_next( ) takes 14 ms to execute at

80 MHz (29 ms at 10 MHz) when a device is being read.

unsigned crc8(unsigned

crc

, unsigned

new-data

);

This function performs the Dallas 1-Wire 8-bit cyclic redundancy check (CRC)

function on the

crc

and

new-data

arguments, and returns the new 8-bit CRC

value. You must include in your program to use this function.

unsigned long crc16(unsigned long

crc

, unsigned

new-data

);

This function performs the Dallas 1-Wire 16-bit CRC function on the

crc

and

new-data

arguments, and returns the new 16-bit CRC value. You must include

in your program to use this function.
Certain 1-Wire devices, such as the Maxim Integrated Products DS18S20 High-
Precision 1-Wire Digital Thermometer, require that the 1-Wire bus be actively

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

functions (named touch_

xxx

_spu) drive the Neuron Chip or Smart Transceiver

output to an active high state when the pin is idle. These functions require
system firmware version 18 or later.

int touch_reset_spu(unsigned

pinmask

);

The touch_reset_spu( ) function asserts the reset pulse, just as the touch_reset( )
function does. The

pinmask

defines which pins are driven high when idle.

void touch_byte_spu(unsigned

pinmask

, unsigned

data

);

The touch_byte_spu( ) function sequentially writes eight bits of data on the 1-
Wire bus, just as the touch_byte( ) function does. The

pinmask

defines which

pins are driven high when idle. The

data

defines the read or write data.

void touch_read_spu(unsigned

pinmask

, unsigned

*dp

, unsigned

count

);

The touch_read_spu( ) function reads a specified number of bits of data on the 1-

Wire bus, similar to the touch_bit( ) function. The

pinmask

defines which pins

are driven high when idle. The

dp

pointer defines the buffer into which the

function stores the read data. The

count

defines how many bits to read.

void touch_write_spu(unsigned

pinmask

, const unsigned

*dp

,

unsigned

count

);

The touch_write_spu( ) function writes a specified number of bits of data on the

1-Wire bus, similar to the touch_bit( ) function. The

pinmask

defines which pins

are driven high when idle. The

dp

pointer defines the buffer from which the

function writes the data. The

count

defines how many bits to write.