TMExtendedReadPage Overview Group

The TMExtendedReadPage API call reads a self generated CRC8 or CRC16 verified status or data page from a 1-Wire device with EPROM memory. For the current devices the page length of a status page is always 8 bytes and the length of a data page is always 32 bytes for the current devices. Some 1-Wire devices have a self generated CRC so that just a single bit can be changed in a page and still be read with CRC verification. This function reads the specified status or data page and puts it in the supplied buffer without the CRC bytes. When reading a data page from a DS1985, D1986, DS1982 or DS2407 the 33rd byte of the provided buffer will be a redirection byte; a zero there indicates that the page is not redirected. Note that the ROM pattern for the desired 1-Wire device must already be in the internal eight-byte buffer before this function is called. This can be accomplished by directly writing to the internal buffer using the TMRom API call or by use of the network functions TMFirst, TMNext, TMFirstAlarm or TMNextAlarm. This constraint enables this function to be multi-drop compatible. The page type 'page_type' is as follows:

0 : regular memory page

1 : status memory page

The current devices that have an extended read memory command are DS1982, DS1985, DS1986, and DS2407.


short far pascal TMExtendedReadPage(

long session_handle, // session handle for the desired 1-Wire network
void far *state_buffer, // state buffer provided for the 1-Wire network session
short page, // page number read (status or regular)
unsigned char far *read_buffer, // buffer to hold the read data
short page_type // indicates status or regular page space
);

For a description of the above types, see the TMEX Type Descriptions.

Parameters

session_handle

Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.

state_buffer

Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.

page

Specifies the page to read. This page could be in the regular or status memory area of the 1-Wire device. The parameter page_type indicates which data area.

read_buffer

Specifies a pointer to a memory location that will contain the data that is read. The size of the buffer must be at least one byte larger than the largest page length. Currently the largest page is 32 bytes long so the read_buffer must be at least 33 bytes long.

page_type

Specifies the page type. 0 indicates regular data space and 1 indicates status data space. Note that not all 1-Wire devices have status memory.

Return Value

>=0 => length of valid data read

<0 => TMEX Transport Error Return Code

Code Example

See Also

TMReadPacket,