Модуль "P2KApi" (часть 56) - TP2KAPI.SendJump

Рубрика: Исходники
Среда, 21 апреля 2010 г.
Просмотров: 115
последняя версия: 3.0.9 build 961 beta
от 07 декабря 2007 г.
function TP2KAPI.SendJump(Addr:Dword):boolean;
var Cmd_temp:array[0..16] of char;
    i:byte;
    chk:byte;
    Cmd_Ans:array[0..1023] of char;
    tmpstr:shortstring;
    xx: dword;

begin
  result:= false;
  if not TelStatus then exit;
  chk:=0;
  cmd_temp[0]:=#02;
  cmd_temp[1]:='J';
  cmd_temp[2]:='U';
  cmd_temp[3]:='M';
  cmd_temp[4]:='P';
  cmd_temp[5]:=#$1E;
  cmd_temp[6]:=IntToHex(Addr,8)[1];
  cmd_temp[7]:=IntToHex(Addr,8)[2];
  cmd_temp[8]:=IntToHex(Addr,8)[3];
  cmd_temp[9]:=IntToHex(Addr,8)[4];
  cmd_temp[10]:=IntToHex(Addr,8)[5];
  cmd_temp[11]:=IntToHex(Addr,8)[6];
  cmd_temp[12]:=IntToHex(Addr,8)[7];
  cmd_temp[13]:=IntToHex(Addr,8)[8];
  for i:= 6 to 13 do
  chk:=chk+ord(cmd_temp[i]);
  cmd_temp[14]:=IntToHex(Chk,2)[1];
  cmd_temp[15]:=IntToHex(Chk,2)[2];
  cmd_temp[16]:=#03;
  USB_WriteDataEx(@Cmd_temp, 17,2,xFlashTimeOut);
  xx:= 1024;
  USB_ReadDataEx(@Cmd_ans, xx,2,xFlashTimeOut);
  result:=true;
  tmpstr:=trim(cmd_ans);tmpstr:=copy(tmpstr,1,3);
  if tmpstr = 'ERR' then result:=false
end;
Rambler's Top100