Hi,
Does anyone know how to use the parport with perl on a windows XP machine?
I'd like to use a perl script to drive couple parallel port pins. Thanks.
I'd like to read several consective lines from a file. Could someone show me how to do it. I know i can put several foreach loops, but it is very clumsy. Thanks.
Here what i did:
open (FILE, "t") || die "can't open t.num: $!";
# create an array of the the file content
@input = <FILE>;
# close...
help...
$chksum = sprintf("%2x",$chksum); works fine when chksum is greater than 0x0f. If it's less than 0x10, the leading 0 does not show up in the string, only a space and the digit is appended at the end of the string. Any idea how to correct this problem?
Thanks
rharsh, please take a look at my mod on your code, I used the xor to compute 2's complement.
Thanks again for your effort.
my $str = '1000F000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F10';
my $check = substr($str,length($str)-2,2, ""); #Strip Checksum
my $sum;
$sum += $_ for unpack('C*', pack("H*"...
Thanks, KevinADC.
However, the script i'm looking for is not that complicated. All I need is to convert 2 char in the string to hex and then add them all up, then negate the number and add 1 to it. Take the LSB and put it back to the end of the string. That is it.
I'm reading the Perl Cookbook...
Does anyone know how to write a perl script to do a checksum calculation of an intel hex record?
The intel hex record format is:
:BBAAAATTDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCC
where
BB = 2 digit byte count
AAAA = 4 digit hex address
TT = 2 digit hex record type
DD = 2 digit hex data byte
CC = 2...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.