function [err] = BK_SetCurrent(sp,I)

PACKET_LENGTH = 26;
I = uint32(I*10000);  %Convert to milliamps units

LoadCmdPacket = zeros(1,PACKET_LENGTH);
LoadCmdPacket(1:3)  = [ hex2dec('aa') 00 hex2dec('2a')];
LoadCmdPacket(4) = uint8(bitand(I,255,'uint32'));
LoadCmdPacket(5) = uint8(bitand(bitshift(I,-8),255,'uint32'));
LoadCmdPacket(6) = uint8(bitand(bitshift(I,-16),255,'uint32'));
LoadCmdPacket(7) = uint8(bitand(bitshift(I,-24),255,'uint32'));

LoadCmdPacket(end) = rem(sum(LoadCmdPacket(1:end-1)),256);  %Compute checksum
fwrite(sp,LoadCmdPacket);
 A = fread(sp,PACKET_LENGTH);
 
 if(length(A) == PACKET_LENGTH)
   if(A(4) == hex2dec('80'))
     err = 0;
   else
     err = 1;
   end
 else
     err = 1;
 end
end
