#!/bin/perl use strict; use warnings; my $hexdata = "fe0401"; my @split = unpack( "A2" x (length($hexdata)/2), $hexdata ); my $strToSend = ("\\x". join ("\\x",@split)."\\x00\\x00"); print $strToSend,"\n"; my $CRC16 = GetCRC16($strToSend); # ergibt "BED2" print "Checksum A: ". sprintf("%x", $CRC16). "\n"; $strToSend = "\xfe\x04\x01"; print $strToSend,"\n"; $CRC16 = GetCRC16($strToSend. "\x00\x00"); # ergibt "BED2" print "Checksum 1: ". sprintf("%x", $CRC16). "\n"; sub GetCRC16 { my $s = shift; my $CRCreg = 0xffff00; for (my $cp=0; $cp> 8; } 1;