VTI Instruments Corp.
APPENDIX C
104
int
recLen = 0;
CComSafeArray<
short
> WriteBuf;
WriteBuf.Create();
if
(strlen(data) != ((DS2430_SCRATCHPAD_LEN * 2) +
(DS2430_SCRATCHPAD_LEN-1)))
{
printf(
"Data was not the right length (wanted 95, got
%i)\n"
, (
int
)strlen(data));
return
-1;
}
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+DS2430_SCRATCHPAD_LEN);
// block length
WriteBuf.Add(4+DS2430_SCRATCHPAD_LEN);
// data length
// send the write scratchpad command
WriteBuf.Add(WRITE_SCRATCHPAD);
// send the address byte
WriteBuf.Add((
short
)0);
// the 5 bytes of data to write
char
byte[3];
for
(
int
i = 0; i < ((2*DS2430_SCRATCHPAD_LEN) +
(DS2430_SCRATCHPAD_LEN-1)); i+=3)
{
strncpy_s(byte, 3, &data[i], 2);
byte[2]=
'\0'
;
WriteBuf.Add((
unsigned
char
)strtoul(byte, NULL, 16));
//convert to hex
}
// the copy command
// 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);
// data length
// send the copy scratchpad command
WriteBuf.Add(COPY_SCRATCHPAD);
// send the validation key
WriteBuf.Add(0xA5);
// delay for 128ms
WriteBuf.Add(CMD_DELAY);
WriteBuf.Add((
short
)0);
WriteBuf.Add(DELAY_128 | DELAY_MS);
// set the length
WriteBuf[0] = (
short
)WriteBuf.GetCount() - 1;
// send the commands
digitizer->Channels->Item[name]->TEDS-
>WriteTEDS(WriteBuf.GetSafeArrayPtr());
std::cout <<
"DS2430 Write & Copy Scratchpad (WriteData)"
<<
std::endl;
PrintPacket(WriteBuf);
Содержание 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: ......