LRC generation
Posted: Thu Aug 13, 2020 4:03 pm
Hi there,
Does anyone have any Jade code to generate a Longitudinal Redundancy Check?
Does anyone have any Jade code to generate a Longitudinal Redundancy Check?
Forums for the discussion of JADE technologies and solutions
https://forums.jadeworld.com/
Code: Select all
vars
i : Integer;
lrc : Integer;
begin
lrc := null;
i := 1;
while i <= self.length do
lrc := lrc.bitXor (self[i]);
i := i + 1;
endwhile;
return lrc.Character;
end;
Cheers,// 2012.06.11 C# Code from Edwards TurboPump Controller SCU-1600: Serial Communication LRC Logic.
// eg: Data (6bytes hexa): 02 30 30 31 23 03 should result in LRC of 0xEC
public byte MakeLRC ( byte[] bytes )
{
byte LRC = 0xff;
for ( int i = 0 ; i < bytes.Length ; i++ )
{
LRC ^= bytes[ i ];
}
return LRC;
}