www.vtiinstruments.com
EX1629 Onboard Memory
329
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(int channel)
{
int sendLen, recLen = 0;
sendLen = 1; // reserve first byte for length
// access the current device with address in DATA_ID
SendPkt[+] = CMD_ML_ACCESS;
// construct a block of communication to MicroLAN
SendPkt[+] = CMD_ML_DATA;
SendPkt[+] = 3; // block length
SendPkt[+] = (2+DS2430_MEMORY_LEN); // data length with 32
bytes of reads
// send the read memory command
SendPkt[+] = READ_MEMORY;
// send the address byte
SendPkt[+] = 0;
// 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;
}
Again, the first three are the same as those seen in previous examples. The block length is the
return buffer size, the READ_MEMORY command, and the address offset. Since the whole
address space can be read at once on the DS2430, the address offset is always zero. This in not
always the case for the DS2431’s, as the DS2431 has a much larger memory space. See the
READ_MEMORY_2431command for an example of this.
Note that the return buffer size does have to be big enough to hold the whole address space, so the
standard two bytes of MLAN data are added to the DS2430’s address space size.
Содержание EX1629
Страница 310: ...VTI Instruments Corp 310 EX1629 Command Set...
Страница 342: ...VTI Instruments Corp 342 EX1629 Onboard Memory...