Hi there,
Does anyone have any Jade code to generate a Longitudinal Redundancy Check?
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;
}
Return to “Tips and Techniques”
Users browsing this forum: No registered users and 8 guests