www.vtiinstruments.com
EX1629 Onboard Memory
331
//here is the copy:
SendPkt[+] = CMD_ML_ACCESS;
// construct a block of communication to MicroLAN
SendPkt[+] = CMD_ML_DATA;
SendPkt[+] = 3; // block length
SendPkt[+] = 2; // data length
// send the copy scratchpad command
SendPkt[+] = COPY_SCRATCHPAD;
// send the validation key
SendPkt[+] = 0xA5;
// delay for 128ms
SendPkt[+] = CMD_DELAY;
SendPkt[+] = 1;
SendPkt[+] = DELAY_128 | DELAY_MS;
// request the result buffer as the last command
SendPkt[+] = CMD_GETBUF;
// set the length
SendPkt[0] = sendLen - 1;
// send and receive the frame
MLanHostPacketSend(SendPkt, channel);
recLen = MLanHostPacketReceive(RecPkt, channel, MLAN_PACKET_SIZE);
return recLen;
}
If one looks closely, it becomes obvious that the WRITE_AND_COPY command is simply a
WRITE and a COPY command combined. There are multiple block length and data length bytes,
multiple commands, and all operations are performed that each of these commands did
individually. However, since they are issued in a single MLAN buffer, the device will not be
powered down and will not have a chance to lose its volatile data.
The example output of the WRITE_AND_COPY command is fairly long, but, like the code that
generates it, is very similar to an amalgamation of the WRITE_SCRATCHPAD and
COPY_SCRATCHPAD commands.
sent packet without errors
Packet length: 49
30 82 0A 23 24 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
11 12 13 14
15 16 17 18 19 1A 1B 1C 1D 1F 20 21 82 0A 03 02 55 A5 0B 01 82 85
got a packet without errors on receive
Packet length: 47
2E 82 00 0A 24 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
11 12 13 14
15 16 17 18 19 1A 1B 1C 1D 1F 20 21 FF FF 82 00 0A 02 55 A5
DS2431
C
OMMANDS
WRITE_SCRATCHPAD_2431
The DS2431 has the same command set as the DS2430, but some of the commands are different,
and some give more arguments to the MLAN controller. Some examples of these difference can
be seen in the WRITE_SCRATCHPAD command.
int write_scratchpad_2431(const char* data, int channel, int address)
{
int sendLen, recLen = 0;
int i = 0;
char byte[3];
if(strlen(data) != ((DS2431_SCRATCHPAD_LEN * 2 ) +
(DS2431_SCRATCHPAD_LEN-1)))
Содержание EX1629
Страница 310: ...VTI Instruments Corp 310 EX1629 Command Set...
Страница 342: ...VTI Instruments Corp 342 EX1629 Onboard Memory...