function [] = BattControllerCanCallback(rxCh)

global Int1_0 Int2_0 Int3_0 Int4_0;
global Int1_1 Int2_1 Int3_1 Int4_1;
global Int1_2 Int2_2 Int3_2 Int4_2;


rxMsg = receive(rxCh, Inf);
[srcID, dataID, seq_num] = DecodeCanID(rxMsg);

idx = find((dataID == 0) & (srcID == 0));
if(~isempty(idx))
 Int1_0 = unpack(rxMsg(idx), 0, 16, 'LittleEndian', 'int16');
 Int2_0 = unpack(rxMsg(idx), 16, 16, 'LittleEndian', 'uint16');
 Int3_0 = unpack(rxMsg(idx), 32, 16, 'LittleEndian', 'uint16');
 Int4_0 = unpack(rxMsg(idx), 48, 16, 'LittleEndian', 'int16'); 
end


idx = find((dataID == 1) & (srcID == 0));
if(~isempty(idx))
 Int1_1 = unpack(rxMsg(idx), 0, 16, 'LittleEndian', 'uint16');
 Int2_1 = unpack(rxMsg(idx), 16, 16, 'LittleEndian', 'int16');  
 Int3_1 = unpack(rxMsg(idx), 32, 16, 'LittleEndian', 'uint16');
 Int4_1 = unpack(rxMsg(idx), 48, 16, 'LittleEndian', 'uint16'); 
end
% 
% idx = find((dataID == 2) & (srcID == 0));
% if(~isempty(idx))
%  Int1_2 = unpack(rxMsg(idx), 0, 16, 'LittleEndian', 'uint16');
%  Int2_2 = unpack(rxMsg(idx), 16, 16, 'LittleEndian', 'int16');  
%  Int3_2 = unpack(rxMsg(idx), 32, 16, 'LittleEndian', 'uint16');
%  Int4_2 = unpack(rxMsg(idx), 48, 16, 'LittleEndian', 'int16'); 
% end
%  

% disp([ num2str(seq_num(idx(1))) '         ' ...    
%       num2str(Int1_0) '  ' num2str(Int2_0) '  ' num2str(Int3_0) '  ' num2str(Int4_0) '          ' ...
%       num2str(Int1_1) '  ' num2str(Int2_1) '  ' num2str(Int3_1) '  ' num2str(Int4_1)]);
%   
 disp([num2str(cast(Int1_0,'single')/100,'%5.1f') ' V   ' ...
     num2str(cast(Int2_0,'single')/1,'%3.1f') ' mA    ' ...
     num2str(cast(Int3_0,'single')/1000,'%5.4f') ' Vbalance    ' ...
     num2str(cast(Int4_0,'single')/1000,'%5.3f') ' Vstopcharge     ' ...
     num2str(cast(Int1_1,'single')/1000,'%3.1f') ' mA    ' ...
     num2str(cast(Int2_1,'single')/1000,'%5.3f') ' V(spare)    ' ...
     num2str(bitand(Int3_1,31)) '   ' ...
     num2str(bitand(bitshift(Int3_1,-5),31)) '    ' ...
     num2str(bitand(bitshift(Int3_1,-10),1)) '    ' ...
     num2str(bitand(bitshift(Int3_1,-11),3)) '    ' ...
     num2str(bitand(bitshift(Int3_1,-13),3)) '    ' ...
     num2str(bitand(bitshift(Int3_1,-15),1)) '    ' ...
     '   ' num2str(bitshift(Int4_1,-4)) '.' num2str(bitand(Int4_1,15))]);
        
    
end
    


