Programmer's Guide

RaDeKL Radar API Programmer’s Guide 37
© Multispectral Solutions, Inc. 2006
Example 1:
Read the value of the register at address 7 (REGISTER_DAC1).
ULONG status;
DWORD bytes_received;
RaDeKL_HANDLE handle;
BYTE cmd[5] = {CMD_READ, 0, REGISTER_DAC1, 1, CMD_TERM};
BYTE response [1024]; // Make this sufficiently large
// Assume we have an open radar with a valid handle
status = RaDeKL_SendCommand (handle, cmd, 5);
// Check status . . .
status = RaDeKL_ReceiveResponse (handle, response, 4, &bytes_received);
// Check status . . . and ensure that bytes_received == 4
printf (“The value at register DAC 1 is %d\n”, response[2]);
Example 2:
Issue a single detection request and read the range bins returned.
ULONG status;
DWORD bytes_received;
RaDeKL_HANDLE handle;
BYTE cmd[5] = {CMD_WRITE, 0, REGISTER_DETECT, DETECT_SINGLE, CMD_TERM};
BYTE response [1024]; // Make this sufficiently large
// Assume we have an open radar with a valid handle
status = RaDeKL_SendCommand (handle, cmd, 5);
// Check status . . .
status = RaDeKL_ReceiveResponse (handle, response, 260, &bytes_received);
// Check status . . . and ensure that cnt == 260 (number of range bins + 4)
// The range bin data is now in response[3] thru response [258].
// response [0], [1] and [2] contain 0xEA and response[259] 0xFF (terminator).