[Perldl] Read Hex values into piddles and conversion hex, binary, decimal

Clifford Sobchuk clifford.sobchuk at ericsson.com
Tue Feb 7 06:47:44 HST 2012


Hi David,
The file has a list of values of the form:

Text = 0x02765e11

I want to be able to take the hex value and convert it into binary so that I can apply a bit mask representing specific attributes such as :

bbbb bfff ffff ffff cccc cccc cccc ssss

As you can see from the above I can't simply take the four bits as the 'b' attribute is 5 bits long so I need to read in all the values, convert to binary so that i can mask/map the required bit pattern to get my attribute.

I am trying to place the code in to an existing PDL code portion so was hoping to be able to read the values from the file at the same time and perform the conversion in to the respective attributes using PDL. If not I will just perform it separately and convert them all to piddles at the end.

B=bbbb b
F= FFF FFFF FFFF
C= CCCC CCCC CCCC
S= SSSS

Does that make sense?

CLIFF SOBCHUK
Core RF Engineering
Phone 613-667-1974   ecn: 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com/>

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is solely responsible for this email and its contents. All inquiries regarding this email should be addressed to Ericsson. The web site for Ericsson is www.ericsson.com."

This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>



________________________________
From: David Mertens [mailto:dcmertens.perl at gmail.com]
Sent: Tuesday, February 07, 2012 9:38 AM
To: Clifford Sobchuk
Cc: perldl at jach.hawaii.edu
Subject: Re: [Perldl] Read Hex values into piddles and conversion hex, binary, decimal

I'm not quite sure what you mean. Do you have working pure-Perl code that does what you want?

David

On Tue, Feb 7, 2012 at 10:34 AM, Clifford Sobchuk <clifford.sobchuk at ericsson.com<mailto:clifford.sobchuk at ericsson.com>> wrote:

Hi Folks,

Is there a way to be able to read in hex values in to piddles so that they can be bitmasked and then each bitmask portion converted to decimal or is this a Perl only operation. I thought that there would be a way with transform, but reading in the data will include 0x[0-9a-f] which PDL typically didn't recognize as valid values.

Thanks,

CLIFF SOBCHUK
Ericsson
Core RF Engineering
Calgary, AB, Canada
Phone 613-667-1974<tel:613-667-1974>  ECN 8109 x71974
Mobile 403-819-9233<tel:403-819-9233>
clifford.sobchuk at ericsson.com<mailto:clifford.sobchuk at ericsson.com>
yahoo: sobchuk
http://www.ericsson.com/

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is solely responsible for this email and its contents. All inquiries regarding this email should be addressed to Ericsson. The web site for Ericsson is www.ericsson.com<http://www.ericsson.com>."

This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>



_______________________________________________
Perldl mailing list
Perldl at jach.hawaii.edu<mailto:Perldl at jach.hawaii.edu>
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl




--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.jach.hawaii.edu/pipermail/perldl/attachments/20120207/87e68450/attachment.html>


More information about the Perldl mailing list