Плёвое дело
Add(MainForm,2953706,56,98)
{
link(onCreate,2284618:doEvent1,[])
}
Add(InlineCode,7214762,280,168)
{
@Hint=#16:Вычисление CRC-8|
WorkPoints=#5:doCRC|
EventPoints=#5:onCRC|
DataPoints=#7:DataStr|3:Pol|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|29:uses kol,Share,Windows,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|4: |9: public|25: _data_Data:THI_Event;|18: Pol:THI_Event;|22: DataStr:THI_Event;|20: onCRC:THI_Event;|0:|49: procedure doCRC(var _Data:TData; Index:word);|5: end;|0:|14:implementation|0:|28:procedure THiAsmClass.doCRC;|23:var _Str:string; // Код|29: i,j,_Pol,CRC,_Len: dword;|5:begin|36: _Str := ReadString(_Data,DataStr);|23: _Len := Length(_Str);|62://-------Author Galkov-------------------------------------- |39: _Pol := ReadInteger(_Data,Pol) shl 8;|12: CRC := 0;|31: for i := 1 to _Len+1 do begin|31: CRC := CRC + byte(_Str[i]);|28: for j := 1 to 8 do begin|23: CRC := CRC shl 1;|55: if (CRC and $10000) > 0 then CRC := CRC xor _Pol;|8: end;|6: end;|32: _hi_onEvent(onCRC, CRC shr 8);|4:end;|0:|4:end.|
link(onCRC,16658992:doText,[])
link(Pol,16305827:Text,[])
}
Add(Edit,12744232,147,56)
{
Left=5
Top=20
Width=185
Text="e5 a7 cd 00 07 04 59 31 30 40"
ClearAfterEnter=1
link(onEnter,13826440:doWork1,[(186,69)(186,97)(130,97)])
}
Add(Button,3945190,56,168)
{
Left=40
Top=85
Caption=">>"
link(onClick,16574716:doWork2,[])
}
Add(Label,8350770,196,119)
{
Left=5
Top=45
Width=185
Color=12639424
}
Add(Replace,4200945,147,119)
{
SubStr=" "
link(onReplace,8350770:doText,[])
link(Str,12744232:Text,[])
link(Dest,3423710:Value,[(167,103)(202,103)])
}
Add(Memory,3423710,196,56)
{
Default=String()
}
Add(Hub,2284618,98,112)
{
link(onEvent1,10047154:doWork3,[(137,118)(137,111)(277,111)])
link(onEvent2,13826440:doWork2,[])
}
Add(StreamConvertor,16203537,196,168)
{
Mode=3
Point(Data)
link(onResult,7214762:doCRC,[])
link(Data,8350770:Caption,[])
}
Add(Edit,16305827,287,119)
{
Left=110
Top=85
Text="305"
DataType=2
}
Add(Edit,16658992,336,168)
{
Left=180
Top=85
Width=70
link(onChange,6452593:doCompare,[])
}
Add(Label,14540917,336,119)
{
Left=110
Top=65
Width=120
Caption="Полином CRC-8"
AutoSize=1
}
Add(Edit,6817378,287,21)
{
Left=260
Top=25
Text="05 01"
link(onChange,10047154:doWork1,[(326,27)(326,62)(277,62)])
}
Add(Label,14273767,448,77)
{
Left=260
Top=50
}
Add(HubEx,13826440,126,119)
{
link(onEvent,4200945:doReplace,[])
}
Add(HubEx,10047154,273,70)
{
link(onEvent,6317759:doSplit,[])
}
Add(Convertor,16444712,350,28)
{
Mode=5
link(onResult,11713452:doValue,[])
}
Add(MultiStrData,6317759,287,70)
{
Char=" "
link(Str,6817378:Text,[])
link(onPart1,16444712:doConvert,[(333,76)(333,34)])
link(onPart2,427926:doConvert,[])
}
Add(Convertor,427926,350,77)
{
Mode=5
link(onResult,8724367:doCalc,[])
}
Add(Memory,11713452,399,28)
{
}
Add(MathParse,8724367,399,77)
{
MathStr="%1*16 + %2"
ResultType=0
link(onResult,14273767:doText,[])
link(X1,11713452:Value,[])
}
Add(Label,12828739,448,28)
{
Left=260
Top=5
Width=35
Height=17
Caption="CRC-8"
}
Add(For,2184731,105,224)
{
Start=256
End=512
link(onEvent,13170906:doEvent1,[])
}
Add(Button,4116214,56,224)
{
Left=20
Top=130
Width=75
Caption="Перебрать"
link(onClick,2184731:doFor,[])
}
Add(If_else,6452593,399,168)
{
link(onTrue,2184731:doStop,[(443,174)(443,269)(97,269)(97,237)])
link(Op1,8724367:Result,[])
}
Add(Hub,13170906,154,224)
{
link(onEvent1,16305827:doText,[(244,230)(244,125)])
link(onEvent2,16574716:doWork3,[(186,237)])
}
Add(HubEx,16574716,182,168)
{
link(onEvent,16203537:doConvert,[])
}