Re: Unpacking packed BCD in Ionosonde SAO files [message #54481] |
Wed, 13 June 2007 01:23 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Andrew Cool <andrew.cool@dsto.defence.gov.au> writes:
> Hi All,
>
> Does anyone have an existing routine to unpack
> packed BCD (Binary Code Decimal) data?
I would probably do something like this,
n_digits = number of digits in input
bcd = binary coded decimal value
fact = 1L
dec = 0L
for i = 0, n_digits-1 do begin
dec = dec + (bcd AND '0f'xl)*fact
bcd = ishft(bcd,-4)
fact = fact * 10L
endfor
The output is the DEC variable. The code has a loop, but it only does
a few iterations, and is fast even if BCD is an array.
> If you've got a routine to decipher ionosonde SAO (Standard
> Archiving Output) files, that'd be even better!! ;-)
Sorry, can't help you there, but I do have telemetry extraction
routines for bit-packed values, if that's what you need.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|