But how to change record format to binary correctly? because the binary need to transport in network. When I try below, the output seems wrong. -record(semper_packet_t, {tdm_leg = <<1:8, 3:8>>, ip_leg = 2 }). term_to_binary(#semper_packet_t.tdm_leg) result: <<131,97,2>>