function [inst_addr] = pb_inst_dds(freq, tx_phase, tx_enable, phase_reset, flags, inst, inst_data, length)
% FUNCTION NAME:
%   pb_inst_dds
%
% DESCRIPTION:
%   pb_inst_dds is an alias for pb_inst_radio with RX related parameters set to 
%   zero. This function is used for DDS boards.
%
% INPUTS:
%   freq - Selects which frequency register to use.
%
%   tx_phase - Selects which phase register to use for the TX channel.
%
%   tx_enable - When this is 1, the TX channel will be output on the Analog Out 
%               connector. When this is 0, Analog Out channel will be turned off.
%
%   phase_reset - When this is 1, the phase of all DDS channels will be reset to 
%                 their time=0 phase. They will stay in this state until the value 
%                 of this bit returns to 0.
%
%   flags - Controls the state of the user available digital out pins. Set every 
%           bit to one for each flag you want to set high
%
%   inst - Which instruction to use. See manual for details.
%
%   inst_data - Some instructions require additional data. This allows that data 
%               to be specified. See manual for details.
%
%   length - Time until the next instruction is executed in nanoseconds
%
% OUTPUTS:
%   inst_addr - The address of the instruction, can be used for branch 
%               instructions. Counts from 0.
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

if(isnumeric(flags))
    num_flags = flags;
else
    num_flags = hex2dec(flags);
end

if(isa(inst, 'char'))
    inst = upper(inst);
end

switch inst
	case {'CONTINUE', 0}
		op_code = 0;
	case {'STOP', 1}
		op_code = 1;
	case {'LOOP', 2}
		op_code = 2;
	case {'END_LOOP', 3}
		op_code = 3;
	case {'JSR', 4}
		op_code = 4;
	case {'RTS', 5}
		op_code = 5;
	case {'BRANCH', 6}
		op_code = 6;
	case {'LONG_DELAY', 7}
		op_code = 7;
	case {'WAIT', 8}
		op_code = 8;
end

inst_addr = calllib(SPINAPI_DLL_NAME, 'pb_inst_radio', freq, 0, 0, tx_phase, tx_enable, phase_reset, 0, num_flags, op_code, inst_data, length);

end