LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lrc understanding

Hello,

 

I received a prtocol for controlling a device with RS232 serial communication.

I need to build two LRC's as check.

I have a working send command and I receive a message back, but I do not understand how to calculatie the LRC.

Can somebody help me with this?

Thanks in advance.

I attached the vi and the protokoll in pdf.lrc vi.PNG

Download All
0 Kudos
Message 1 of 2
(2,550 Views)

Hi RvG,

 

To calculate the LRC, you perform an XOR operation of every bit, add it to the end of the message, and then XOR that entire message again after transmission. If that second XOR calculation equals zero, then the last bitstream (minus the added LRC value at the end) is the same message as the one that was sent.

 

This pseudo-code might explain the XOR operation a bit better:

 

LRC = 0

For every byte (b)

     LRC = LRC XOR b

end

 

For a LabVIEW example, the following link might help: https://decibel.ni.com/content/docs/DOC-15042

0 Kudos
Message 2 of 2
(2,463 Views)