function [neg_on_err] = pb_scan_count(reset)
% FUNCTION NAME:
%   pb_scan_count
%
% DESCRIPTION:
%   Get the current value of the scan count register, or reset the register 
%   to 0. This function can be used to monitor the progress of an experiment 
%   if multiple scans are being performed.
% 
% INPUTS:
%   reset - If this parameter is set to 1, this function will reset the scan 
%           counter to 0. If reset is 0, this function will return the current  
%           value of the scan counter.
%
% OUTPUTS:
%   neg_on_err - The number of scans performed since the last reset is returned when  
%                reset=0. -1 is returned on error.
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_scan_count', reset);

end