VTI Instruments Corp.
APPENDIX C
102
ReadBuf.Attach(psaReadBuf);
PrintPacket(ReadBuf);
recLen = (
int
)ReadBuf.GetCount();
return
recLen;
}
Once again, the first three bytes are the same as WRITE_SCRATCHPAD and
READ_SCRATCHPAD. Our block length is 3, as the expected response length, the
COPY_SCRATCHPAD command, and the “validation key” that ensures we are not writing to the
wrong device are sent. Each “family” of MLAN device has a different validation key. This will be
seen with the DS2431. Note that the expected response length is the minimum 2 bytes. Since the
COPY_SCRATCHPAD command does not actually return data to us, space does not have to be
allocated in the return buffer.
Once the copy command is sent, a delay is sent to the MLAN controller to allow time for the copy
to finish. The “1” sent after CMD_DATA is the length, in bytes, of the delay command which is on
the next line. A ‘bitwise or’ function is used to combine the units of delay with the delay length – if
a shorter or longer delay time is required, the 1-wire specification defines several delay lengths and
several different time units which can be used.
Here is an example output from the COPY_SCRATCHPAD command using the example code:
sent packet without errors
Packet length: 11
0A 82 0A 03 02 55 A5 0B 01 82 85
got a packet without errors on receive
Packet length: 7
06 82 00 0A 02 55 A5
As there is no user data returned, the reply to this command is short.
READ_MEMORY_2430
Although the READ_MEMORY command is probably the most useful of the MLAN command, it
is discussed here as this is where the commands would logically appear in code.
int
read_memory_2430(IVTEXDigitizerPtr digitizer)
{
int
recLen = 0;
CComSafeArray<
short
> WriteBuf;
WriteBuf.Create();
WriteBuf.Add((
short
)0);
// reserve first byte for length
// access the current device with address in DATA_ID
WriteBuf.Add(CMD_ML_ACCESS);
// construct a block of communication to MicroLAN
WriteBuf.Add(CMD_ML_DATA);
WriteBuf.Add(3);
// block length
WriteBuf.Add(2+DS2430_MEMORY_LEN);
// data length with 32
bytes of reads
// send the read memory command
WriteBuf.Add(READ_MEMORY);
// send the address byte
WriteBuf.Add((
short
)0);
// request the result buffer as the last command
WriteBuf.Add(CMD_GETBUF);
// set the length
WriteBuf[0] = (
short
)WriteBuf.GetCount() - 1;
Содержание EMX-4016B
Страница 6: ......
Страница 7: ...www vtiinstruments com Introduction 7 ...
Страница 83: ...www vtiinstruments com APPENDIX B 83 Figure 4 429 EMX 4016B Break Out Box Figure 4 30 EMX 4016M Break Out Box ...
Страница 84: ...VTI Instruments Corp APPENDIX B 84 Figure 4 31 EMX4016B Outline Drawing Figure 4 32 Drawing Represent ...
Страница 116: ......