function [neg_on_err] = pb_set_phase(phase)
% FUNCTION NAME:
%   pb_set_phase
%
% DESCRIPTION:
%   Write the given phase to a phase register on DDS enabled boards. To do
%   this, first call pb_start_programming(), and specify the appropriate bank
%   of phase registers (such as TX_PHASE, RX_PHASE, etc) as the argument. The 
%   first call pb_set_phase() will then program phase register 0, the second 
%   call will program phase register 1, etc. When you have programmed all the
%   registers you intend to, call pb_stop_programming()
%   The given phase value may be rounded to fit the precision of the board.
%
% INPUT:
%   phase - The phase in degrees to be programmed to the register.
%
% OUTPUT:
%   neg_on_err - A negative number is returned on failure, and spinerr is set
%                to a description of the error. 0 is returned on success. 
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_set_phase', phase);

end