# What is the purpose of asterix (*) in Gcode?

Doing some low level monitoring, the following sequence is sent to the printer:

N0 M106*36
N1 G28*18
N2 M107*39


This sequence just turns the fan on, homes the printer, then turns the fan off.

Question: What is the purpose of the asterix/star/(*) and the two succeeding digits on each line?

• * asterisk - Asterix is a character in a cartoon series. – Andrew Morton Sep 25 '19 at 10:33
• @AndrewMorton So that would make the gcode the Romans then - with Asterix being their checksum, stopping corruption in his local area? – Mtl Dev Sep 25 '19 at 14:43
• Hmmm... maybe. The Romans did build a lot of things, like a 3-d printer does. – Andrew Morton Sep 25 '19 at 14:46

That is a checksum. It's added by the host software to the G-code, to allow some basic verification by the firmware that the G-code was transmitted unchanged. It doesn't change the meaning of the G-code, and what your sequence actually represents is just M106, G28, M107. The N0,N1,N2,... are line numbers, and the combination of line numbers and checksums is used to request a re-send of any lines that were corrupted during transmission.
• Just XOR: byte checksum = 0; byte count = 0; while(instruction[count] != '*') checksum = checksum^instruction[count++]; – Mtl Dev Dec 4 '16 at 0:17