View Single Post
Old 02-11-2006, 04:51 PM   #46
Putput
Constant Bitrate
 
Putput's Avatar
 
Join Date: Sep 2005
Location: Belgium
Posts: 176
FCS code

The party ended a little sooner then expected so here it is:
Code:
procedure TForm1.Button1Click(Sender: TObject); var FCS : integer; w_i : integer; w_ii : integer; w_b : byte; begin // Line pointer in Listbox for w_i := 0 to ListBox1.Items.Count - 1 do // Check for correct string length if length(ListBox1.Items.Strings[w_i]) = 56 then begin FCS := 0; // Byte counter in frame for w_ii := 1 to 14 do begin // Move string hex byte into binairy byte HexToBin(StrLower(pchar(copy(ListBox1.Items.Strings[w_i], ((w_ii - 1) * 4) + 1, 2))), @w_b, 2); // XOR with previous Result FCS := FCS XOR w_b end; // Add FCS result to listbox ListBox1.Items.Strings[w_i] := ListBox1.Items.Strings[w_i] + ' FCS=' + IntToHex(FCS, 2) end; end;

Its written in Delphi and its the procedure that runs when you push the Calculate button in the program.
Putput is offline   Reply With Quote