Programmer's Guide

RaDeKL Radar API Programmer’s Guide 35
© Multispectral Solutions, Inc. 2006
Part VII: Low-Level Data I/O Functions
RaDeKL_SendCommand
Note: This is a low-level function and should only be used if you are familiar with the RaDeKL
Radar I/O features. Normal operation of the RaDeKL Radar should require only the use of the high-
level functions described above.
Send a command to the RaDeKL Radar. The command must be a read register or a write register
command in the following form:
Read Register (always 5 bytes): <0x72><addr-hi><addr-lo><qty><0xFF>
Write Register (always 5 bytes): <0x77><addr-hi><addr-lo><val><0xFF>
Where: <addr-hi> is the high byte of the 16-bit register address.
<addr-lo> is the low byte of the 16-bit register address.
(See the appendix for register definitions)
<qty> is an 8-bit count of registers to read (read command only).
<val> is an 8-bit value to write to the register (write command only).
Format:
ULONG RaDeKL_SendCommand (RaDeKL_HANDLE handle, BYTE *cmd,
DWORD bytes_to_send);
Parameters:
handle RaDeKL_HANDLE as returned by a call to RaDeKL_OpenRadar.
cmd Pointer to the 5-byte command.
bytes_to_send Number of bytes to write (should always be 5, unless a future version
extends the I/O interface).
Return Value:
RADEKL_OK (0) if successful, a non-zero status otherwise. See RaDeKL_GetStatusText for codes.
Example:
Write a value of 50 into register at address 8 (REGISTER_DAC1).
ULONG status;
RaDeKL_HANDLE handle;
BYTE cmd[5] = {CMD_WRITE, 0, REGISTER_DAC1, 50, CMD_TERM};
// Assume we have an open radar with a valid handle
status = RaDeKL_SendCommand (handle, cmd, 5);
// Check status . . .