Jared Clarke > Convert-MIL1750A-0.1 > Convert::MIL1750A

Download:
Convert-MIL1750A-0.1.zip

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  

NAME ^

Convert::MIL1750A - Conversion routines between decimal floating/integer values and hexadecimal values in the MIL-STD-1750A format.

SYNOPSIS ^

    use MIL1750A;

    # Convert to MIL-STD-1750A hex from decimal
    $hex16i = I16_to_1750A( $dec_value );
    $hex16f = F16_to_1750A( $dec_value );
    $hex32f = F32_to_1750A( $dec_value );
    $hex48f = F48_to_1750A( $dec_value );
    
    # Convert MIL-STD-1750A hex to decimal
    $dec_value = M1750A_to_16int( $hex16i );
    $dec_value = M1750A_to_16flt( $hex16f );
    $dec_value = M1750A_to_32flt( $hex32f );
    $dec_value = M1750A_to_48flt( $hex48f );

or ...

    use MIL1750A qw( i16_to_mil f16_to_mil f32_to_mil f48_to_mil
                        mil_to_32f mil_to_48f mil_to_16f mil_to_16i );

    # Convert to MIL-STD-1750A hex from decimal
    $hex16i = i16_to_mil( $dec_value );
    $hex16f = f16_to_mil( $dec_value );
    $hex32f = f32_to_mil( $dec_value );
    $hex48f = f48_to_mil( $dec_value );
    
    # Convert MIL-STD-1750A hex to decimal
    $dec_value = mil_to_16i( $hex16i );
    $dec_value = mil_to_16f( $hex16f );
    $dec_value = mil_to_32f( $hex32f );
    $dec_value = mil_to_48f( $hex48f );

DESCRIPTION ^

Convert::MIL1750A features routines to convert between 16I/16F/32F/48F decimal values and their equivalent in MIL-STD-1750A hexadecimal. The 1750A standard describes a microprocessor that is used as the backbone of many modern and legacy avionics systems. The 1750A stores data as an 8-bit exponent and n-bit mantissa (where n is the number of bits remaining in the value). It is important to treat 16-bit values as 16-bit, 32-bit as 32-bit and 48-bit as 48-bit. Crossing bit structures will create unexpected results as 1750A hex values are structured differently, depending on their size. Additionally, the 16F format is not a formal member of the 1750A standard; it is used, however, in certain applications and is provided for reference. The 1750A standard allows positive and negative values using the 2's complement arrangement.

This module is extremely useful for ingesting data output by or for a 1750A flight processor. I would like to thank and acknowledge Dave Niklewski for helping me to find the standard documentation.

AUTHOR ^

Jared Clarke, ASRC Aerospace

FUNCTIONS ^

M1750A_to_16i (mil_to_16i)
        $hex = '0x83CA';
        $int = M1750A_to_16int( $hex );
        # $dec is -994
        print( "$int\n" );
M1750A_to_16flt (mil_to_16f)
        $hex = '0x6344';
        $dec = M1750A_to_16flt( $hex );
        # $dec is 12.4
        print( "$dec\n" );
M1750A_to_32flt (mil_to_32f)
        $hex = '0x997AE105';
        $dec = M1750A_to_32flt( $hex );
        # $dec is -25.63
        print( "$dec\n" );
M1750A_to_48flt (mil_to_48f)
        $hex = '0x69A3B50754AB';
        $dec = M1750A_to_48flt( $hex );
        # $dec is 105.639485637361
        print( "$dec\n" );
I16_to_1750A (i16_to_mil)
        $int = -994;
        $hex = I16_to_1750A( $int );
        # $hex is '0x83CA'
        print( "$hex\n" );
F16_to_1750A (f16_to_mil)
        $dec = 12.4;
        $hex = M1750A_to_16flt( $dec );
        # $hex is '0x6344'
        print( "$hex\n" );
F32_to_1750A (f32_to_mil)
        $dec = -25.63;
        $hex = F32_to_1750A( $dec );
        # $hex is '0x997AE105'
        print( "$hex\n" );
F48_to_1750A (f48_to_mil)
        $dec = 105.639485637361;
        $hex = M1750A_to_48flt( $dec );
        # $hex is '0x69A3B50754AB'
        print( "$hex\n" );
syntax highlighting: