TMBlockStream Code Example
long session_handle;
unsigned char tran_buffer[100];
short result,flag;
/* session_handle set from a call to TMExtendedStartSession */
...
/* construct a buffer to read the scratchpad of a DS199X */
tran_buf[0] = 0xCC; /* skip ROM */
tran_buf[1] = 0xAA; /* read scratchpad */
for (i = 0; i < 35; i++)
tran_buf[2+i] = 0xFF; /* area to read address, data */
flag = TMTouchReset(session_handle);
if ( flag == 1) or ( flag == 2 )
{
result = TMBlockStream(session_handle, tran_buffer, 37);
if (result == 37)
{
/* the contents of the scratchpad are in the buffer
in location tran_buf[2] to tran_buf[36] */
...
}
else
/* TRANSPORT error */
};
/* close the session with a call to TMEndSession */
...