VTI Instruments EX1629 User Manual page 332

48-channel strain gage instrument
Table of Contents

Advertisement

VTI Instruments Corp.
{
strlen(data));
}
sendLen = 1; // reserve first byte for length
// access the current device with address in DATA_ID
SendPkt[sendLen++] = CMD_ML_ACCESS;
// construct a block of communication to MicroLAN
SendPkt[sendLen++] = CMD_ML_DATA;
SendPkt[sendLen++] = 4+DS2431_SCRATCHPAD_LEN; // block length
SendPkt[sendLen++] = 5+DS2431_SCRATCHPAD_LEN; // data length
// send the write scratchpad command
SendPkt[sendLen++] = WRITE_SCRATCHPAD;
// send the address byte
if (address > (DS2431_MEMORY_LEN-DS2431_SCRATCHPAD_LEN) || address
< 0)
{
hex\n");
}
SendPkt[sendLen++] = address;
SendPkt[sendLen++] = 0;
// the 5 bytes of data to write
for (i = 0; i < ((2*DS2431_SCRATCHPAD_LEN) +
(DS2431_SCRATCHPAD_LEN-1)); i+=3)
{
to hex
}
// request the result buffer as the last command
SendPkt[sendLen++] = CMD_GETBUF;
// set the length
SendPkt[0] = sendLen - 1;
// send and receive the frame
MLanHostPacketSend(SendPkt, channel);
CRCcalc(SendPkt, 6, 11);
recLen = MLanHostPacketReceive(RecPkt, channel, MLAN_PACKET_SIZE);
return recLen;
}
Notice first that, in comparison to the DS2430 scratchpad write, the length of the data string that is
checked is much smaller, although it uses the same formula,. This is because the DS2431 has only
an 8-byte scratchpad, whereas the DS2430 has 32 bytes. The same format of data string is used to
submit data, however. Here is an example of a data string for the DS2431:
"01 02 03 04 05 06 07 08"
Even on a different device, however, the basic format remains unchanged. The first byte received
is for length and the next two are CMD_ML_ACCESS and CMD_ML_DATA, just like in the
DS2430's command.
The block size is our first indicator that the DS2430 and DS2431, although similar, have slightly
different programming requirements. This block size is one byte larger than the DS2430's block
size, and the reason is readily apparent three commands down: there are two address registers
instead of one. The first address register, T1, is the beginning offset, and T2 is the address. As can
be seen in the example, T1 is used to offset the data within the main memory, allowing users to
332
printf("Data was not the right length (wanted 23, got %i)\n",
return -1;
printf("Invalid scratchpad address, must be between 0 and 88
return -1;
strncpy(byte, &data[i],2);
byte[2]='\0';
SendPkt[sendLen++] = (uint8_t)strtoul(byte, NULL, 16); //convert
EX1629 Onboard Memory

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the EX1629 and is the answer not in the manual?

Table of Contents