function SerialPortCallBack(obj, event)
%This get's called when a 'CR/LF' terminator appears on the serialport
%line.

global CircBuff;
global update_graphs;
global BattCurrentDraw;
global S_idx;


[A,cnt,msg] = scanstr(obj,' ');
A = [A; BattCurrentDraw];

if(size(A,1) == length(fieldnames(S_idx)))

 % disp([num2str(A{S_idx.iTemp1}) '   ' num2str(A{S_idx.iTemp2}) '   ' num2str(A{S_idx.iTemp3}) '   ' num2str(A{S_idx.iTemp4}) '     ' num2str(A{S_idx.DbarMin}) '     ' num2str(A{S_idx.speed}) '     ' num2str(A{S_idx.P1DC1}) '     ' num2str(A{S_idx.lag})]);

  if(size(A,1) == size(CircBuff,2))
    A = cell2mat(A)';
    temp = CircBuff;
    CircBuff(2:end,:) = temp(1:end-1,:);
    CircBuff(1,:) = A;
  end
end
            
end

