

delete(gcf);

fclose('all');

clear all
close all

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;

Int1_0 = NaN; Int2_0 = NaN; Int3_0 = NaN; Int4_0 = NaN; 
Int1_1 = NaN; Int2_1 = NaN; Int3_1 = NaN; Int4_1 = NaN; 

canch1 = canChannel('PEAK-System', 'PCAN_USBBUS1');

configBusSpeed(canch1, 1000000);

start(canch1)


%canch1.MessageReceivedFcnCount = 1;
%canch1.MessageReceivedFcn = @BattControllerCanCallback;





EID = AssembleCanID(0, 01, 0)  

messageout = canMessage(EID, true, 8);

for i = 0:bitshift(1,10)-1
    
pack(messageout,0, 0, 16, 'LittleEndian');
pack(messageout,0, 16, 16, 'LittleEndian');
pack(messageout,i, 32, 16, 'LittleEndian');
pack(messageout,0, 48, 16, 'LittleEndian');

transmit(canch1, messageout);
%pause(.04)
%messageout
end