A method for code reading of an ear tag, the method comprising: sampling (S101) a first signal from the ear tag to obtain a second signal converting (S 102) the second signal into a rectangular wave signal; performing (S103) fragmentation and compensation on the rectangular wave signal to obtain multiple pieces of fragmented data, according to a data structure of the first signal and time differences between adjacent falling edges and rising edges in the rectangular wave signal; and decoding (S104) the multiple pieces of fragmented data respectively, and determining (S 104) target decoded data of the first signal according to the decoded data, wherein the target decoded data is obtained from combination in accordance with the data structure of the first signal; wherein the performing (S103) fragmentation and compensation on the rectangular wave signal to obtain multiple pieces of fragmented data, according to a data structure of the first signal and time differences between adjacent falling edges and rising edges in the rectangular wave signal comprises: adjusting the time differences between the adjacent falling edges and rising edges in the rectangular wave signal so that a sum of time differences in each piece of grouped data corresponds to a predefined value; and adjusting the time differences in each piece of grouped data to normal time differences of the data structure to obtain the multiple pieces of fragmented data. sampling (S101) a first signal from the ear tag to obtain a second signal converting (S 102) the second signal into a rectangular wave signal; performing (S103) fragmentation and compensation on the rectangular wave signal to obtain multiple pieces of fragmented data, according to a data structure of the first signal and time differences between adjacent falling edges and rising edges in the rectangular wave signal; and decoding (S104) the multiple pieces of fragmented data respectively, and determining (S 104) target decoded data of the first signal according to the decoded data, wherein the target decoded data is obtained from combination in accordance with the data structure of the first signal; wherein the performing (S103) fragmentation and compensation on the rectangular wave signal to obtain multiple pieces of fragmented data, according to a data structure of the first signal and time differences between adjacent falling edges and rising edges in the rectangular wave signal comprises: adjusting the time differences between the adjacent falling edges and rising edges in the rectangular wave signal so that a sum of time differences in each piece of grouped data corresponds to a predefined value; and adjusting the time differences in each piece of grouped data to normal time differences of the data structure to obtain the multiple pieces of fragmented data. adjusting the time differences between the adjacent falling edges and rising edges in the rectangular wave signal so that a sum of time differences in each piece of grouped data corresponds to a predefined value; and adjusting the time differences in each piece of grouped data to normal time differences of the data structure to obtain the multiple pieces of fragmented data. <EOS>