TMTouchByte Code Example
long session_handle;
short result, i;
unsigned char ROM[8];
/* session_handle set from a call to TMExtendedStartSession */
...
/* read the ROM number of a single 1-Wire device on the 1-Wire network */
result = TMTouchReset(session_handle);
if (result == 1 || result == 2)
{
/* device reset now, send read ROM command */
TMTouchByte(session_handle, 0x33);
/* now loop to receive all 8 bytes of the ROM */
for (i = 0; i < 8; i++)
ROM[i] = (unsigned char)TMTouchByte(session_handle, 0xFF);
}
else
{
/* device not on the 1-Wire network to read ROM */
...
}
/* close the session with a call to TMEndSession */
...