<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CRC Archives - Nerd Corner</title>
	<atom:link href="https://nerd-corner.com/tag/crc-en/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerd-corner.com/tag/crc-en/</link>
	<description>Craft your dreams!</description>
	<lastBuildDate>Tue, 15 Jun 2021 12:08:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://nerd-corner.com/wp-content/uploads/2019/10/cropped-LogoNerdCorner-2-32x32.png</url>
	<title>CRC Archives - Nerd Corner</title>
	<link>https://nerd-corner.com/tag/crc-en/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Cyclic Redundancy Check in C code</title>
		<link>https://nerd-corner.com/cyclic-redundancy-check-in-c-code/</link>
					<comments>https://nerd-corner.com/cyclic-redundancy-check-in-c-code/#comments</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Tue, 15 Jun 2021 12:08:30 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[communication technique]]></category>
		<category><![CDATA[CRC]]></category>
		<category><![CDATA[CRC Wert]]></category>
		<category><![CDATA[cyclic redundancy check]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[error free transmission]]></category>
		<category><![CDATA[frequency]]></category>
		<category><![CDATA[LiFi]]></category>
		<category><![CDATA[visible Light communication]]></category>
		<category><![CDATA[VLC]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/de/?p=930</guid>

					<description><![CDATA[<p>I plan to build a transmitter and receiver station which is able to transmit data with the help of light signals (&#8220;Visible Light Communication&#8221; &#8211; &#8230; </p>
<p>The post <a href="https://nerd-corner.com/cyclic-redundancy-check-in-c-code/">Cyclic Redundancy Check in C code</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I plan to build a transmitter and receiver station which is able to transmit data with the help of light signals (&#8220;Visible Light Communication&#8221; &#8211; VLC). In order for the data transmission to be possible, the clock frequency of the transmitter and the receiver must be precisely synchronized. I have already explained in previous posts how to set a precise clock frequency for the Arduino and the Raspberry Pi, to which I link below.</p>
<p>A cyclic redundancy check is a simple and elegant way to verify that the data arriving at a receiving station is correct. For example, if bits have been swapped in a received data packet or a 1 has been received instead of a 0, this can be detected by the cyclic redundancy check (CRC for short). The CRC identifies that a data packet has an error and the receiving station will drop the packet.</p>
<p><em><strong>This might also be interesting for you:</strong> <a href="https://nerd-corner.com/arduino-timer-interrupts-how-to-program-arduino-registers/" target="_blank" rel="noopener">Setting a precise clock frequency for an Arduino</a></em></p>
<p><em><strong>Also closely related to this article:</strong> <a href="https://nerd-corner.com/how-to-program-a-highly-precise-timer-in-c-for-linux/" target="_blank" rel="noopener">Setting a precise clock frequency for the Raspberry Pi</a></em></p>
<h2>Cyclic redundancy check &#8211; How it works:</h2>
<p>The CRC is a mathematical trick. In principle, the calculation is a polynomial division. For example, the data packet 10010101 corresponds to the following polynomial:</p>
<p><img fetchpriority="high" decoding="async" class="zoooom aligncenter wp-image-918" src="https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket.jpg" alt="zyklische redundazprüfung Datenpaket polynom cyclic redundancy check" width="1852" height="123" srcset="https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket.jpg 1853w, https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket-300x20.jpg 300w, https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket-1024x68.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket-768x51.jpg 768w, https://nerd-corner.com/wp-content/uploads/2021/06/Datenpaket-1536x102.jpg 1536w" sizes="(max-width: 1852px) 100vw, 1852px" /></p>
<p>A so-called generator polynomial is required for the calculation of the CRC. The generator polynomial can be chosen freely, but some polynomials have proven to be particularly suitable. It is important that the <a href="https://users.ece.cmu.edu/~koopman/crc/" target="_blank" rel="noopener">generator polynomial</a> for sending the data and for receiving the data is identical. I have chosen the polynomial 1011 for the sake of simplicity:</p>
<p><img decoding="async" class="zoooom aligncenter wp-image-919" src="https://nerd-corner.com/wp-content/uploads/2021/06/Generatorpolynom.jpg" alt="Generatorpolynom CRC cyclic redundancy check" width="873" height="115" srcset="https://nerd-corner.com/wp-content/uploads/2021/06/Generatorpolynom.jpg 874w, https://nerd-corner.com/wp-content/uploads/2021/06/Generatorpolynom-300x39.jpg 300w, https://nerd-corner.com/wp-content/uploads/2021/06/Generatorpolynom-768x101.jpg 768w" sizes="(max-width: 873px) 100vw, 873px" /></p>
<p>The procedure is the same for each data packet. An additional CRC value is appended to each data packet that is to be sent. This CRC value is one digit smaller than the generator polynomial. In the current case, the generator polynomial 1011 has a total of 4 digits, which means that the CRC value has 3 digits.  At the beginning of the calculation the CRC value is still unknown, therefore simply 3 times (since the CRC value has here 3 digits) the 0 is appended to the data package. Thus the data packet 10010101 now becomes 10010101000.</p>
<p>Then the polynomial division starts. 10010101000 is divided by 1011. I have summarized the step-by-step process of the division in a graphic. At the end of the polynomial division the remainder 110 remains on the transmitter. This remainder is the desired CRC value. The CRC value is appended to the actual data packet 10010101 and transmitted to the receiver. If the data transmission is correct, the receiver receives the packet 10010101110.</p>
<p><img decoding="async" class="zoooom aligncenter wp-image-920" src="https://nerd-corner.com/wp-content/uploads/2021/06/CRC_example.png" alt="zyklische Redundanzprüfung Beispiel cyclic redundancy check" width="1044" height="638" srcset="https://nerd-corner.com/wp-content/uploads/2021/06/CRC_example.png 1045w, https://nerd-corner.com/wp-content/uploads/2021/06/CRC_example-300x183.png 300w, https://nerd-corner.com/wp-content/uploads/2021/06/CRC_example-1024x626.png 1024w, https://nerd-corner.com/wp-content/uploads/2021/06/CRC_example-768x470.png 768w" sizes="(max-width: 1044px) 100vw, 1044px" /></p>
<p>At this point the mathematical trick happens. The calculated CRC was appended to the data packet and transmitted to the receiver. The receiver can now also perform a polynomial division with the generator polynomial 1011, but since this time the CRC value 110 was appended to the data packet 10010101 instead of 3 times 0, no remainder is left when the polynomial division is repeated.</p>
<p>No remainder on the receiver side means that the data packet was transmitted correctly. However, if a remainder is left, then an error has crept in during the transmission. The faulty data packet can be discarded and the receiver can ask for a retransmission of the data packet.</p>
<p><iframe loading="lazy" hcb-fetch-image-from="https://www.youtube.com/watch?v=6gbkoFciryA" title="Error Detection and Correction 2: Cyclic Redundancy Check" width="1200" height="675" src="https://www.youtube.com/embed/6gbkoFciryA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p>
<h2>Download files:</h2>
<ul>
<li><a  data-e-Disable-Page-Transition="true" class="download-link" title="" href="https://nerd-corner.com/download/923/?tmstv=1756114416" rel="nofollow" id="download-link-923" data-redirect="false" >
	Cyclic Redundancy Check in C</a>
</li>
</ul>
<p>The post <a href="https://nerd-corner.com/cyclic-redundancy-check-in-c-code/">Cyclic Redundancy Check in C code</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/cyclic-redundancy-check-in-c-code/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
