[Pdx-pm] bit conversion brain-teaser

Randal L. Schwartz merlyn at stonehenge.com
Mon Mar 3 21:36:16 CST 2003

>>>>> "Joshua" == Joshua Hoblitt <jhoblitt at ifa.hawaii.edu> writes:

Joshua> I have a 7-bit digital I/O module that outputs the state of it's channels via an ascii hex value.
Joshua> For example:

Joshua> normal state		: 7F
Joshua> channel 0 to V-		: 7E
Joshua> channel 6 to V-		: 3F
Joshua> .
Joshua> .

Joshua> What I need to get out of this is the state of each channel.
Joshua> I thought it would be pretty simple to do a hex -> per bit
Joshua> conversion

perl -le 'print unpack "B*", pack "H*", "3F";'



Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

More information about the Pdx-pm-list mailing list