TECHNICAL NOTES

HP 48 DMS/HMS PROGRAM

INTRODUCTION

HP 48 Degrees Minutes Seconds, DMS, calculations are made easier with the program described in this Technical Note. Any calculation using (or converting) decimal degree formated or DMS formated numbers may be performed. The operating mode is to perform all calculations on the HP 48 just as you would normally except two results are always displayed. The decimal form and the DMS form. A special menu provides convenient entry of degrees, minutes and seconds. All entries are automaticlly converted to their simplest form.

The highest number the program will display is 360 degrees. If 175 is entered as degrees (DEG) the FIF form will show 175ø 0' and the decimal form will show 175 displayed as you have set your HP 48 display mode. If 360 is entered (displayed) and 1 SEC is "added" the display will show 0ø 0' and 1".

This program is from an EduCALC HP 48 Programming Class assignment. The class was taught by Richard Nelson and Joseph Horn. The program is Joseph's, this description is Richard's. The program structure is also used by the FIF, Feet Inch Fraction, program described in EduCALC Technical Note 60. Create a directory called DMS. Key in the two programs from the listing. One is used to open an environment, the other is used to perform the necessary calculations and display the result at the top of the screen.

USING THE PROGRAM

To use the program press the DMS directory menu key. Two programs will be in the menus - DK2 and DEG2. DEG2 is used by DK2 and is not run by itself. Press DK2 to open the menu shown below. Note from the display that the program places the machine in user mode. This is a requirement of the vectored ENTER used in the program.

DEG MIN SEC     EXIT

The operation of this environment is to show the number normally on level one of the stack and in labeled DMS form at the top of the display. In this manner you are able to perform any calculations you wish using the menu keys to enter numbers in DMS form and calculating with them in decimal form.

Level one must have a number (zero OK) if you press user menu MIN or SEC. MIN and SEC menu keys cause the entered number to be added to the number on the stack. If there is no number on the stack the machine will error. Press zero, DEG (or ENTER) if zero degrees is the case. Once you enter a number on level one of the stack it will also appear at the top of the screen in DMS form with the Label, DMS: at the top left side of the screen.

The change sign key, +/-, will calculate the compliment of the displayed angle. Enter 179 degrees and press +/-. The display will change to 181 degrees because 360 - 179 = 181. When you are finished with DMS calculations press [EXIT] to return to your DMS directory to see the menu line shown below. Use the order command if they are reversed.

DEG DK2 DEG2      

CORRECTING ERRORS : Error correction is accomplished by entering the number that was entered incorrectly and pressing the +/-, NEG, key. This makes the value negative which when entered again will subtract the error number from the Level one value.

EXAMPLE PROBLEMS (Use FIX two display mode.)

  1. Divide 225ø 55' 39" into three equal parts and take the sine.

    PressL1DMSRemarks
    DMS, DK2--Opens DMS environment
    DEL USERCLEARs stack
    225, DEG or ENTER225.00225ø 0'Degrees of number
    55, MIN225.92225ø 55'Adds minutes
    39, SEC 225.93225ø 55' 39"Adds seconds
    3, ö75.3175ø 18' 31"Divide by three
    SIN0.970ø 58' 2.31"DMS is meaningless

    The last operation, SIN 75.31 degrees, gives a correct answer - 0.97. Change the display mode to STD to see 0.967308338753. The expression of this decimal number in DMS form has no meaning.

    The DMS environment may be used for HMS, hours minutes seconds, calculations as long as the number of hours doesn't exceed 360.

  2. Ginny, a Michigan radio station manager wants to verify her programming will fit a 58 minute 30 second time slot to insure time for the station break. The programming times are listed below. The timing must be within one second. Will this schedule work? How much fill music must she plan for. Could another commercial fit?

          1.  Commercial 1 -                     30 seconds
          2.  Commercial 2 -                     60 seconds
          3.  Announcer Introduction - 3 Minutes 48 seconds
          4.  Music -                 12 Minutes 42 seconds
          5.  Commercial 3 -                     55 seconds
          6.  public service spot -    1 Minutes 18 seconds
          7.  Music -                 15 Minutes 27 seconds
          8.  Commercial 4 -                     55 seconds
          9.  Commercial 5 -           1 Minutes 15 seconds
         10.  Commercial 6 -           1 Minutes 30 seconds
         11.  Commercial 7 -                     47 seconds
         12.  Nature program -        15 Minutes  0 seconds
         13.  Commercial 8 -                     45 seconds
         14.  News -                   2 Minutes 37 seconds
    

    The times must be added. Ginny knows that dealing with time is error prone because of the base 60 arithmetic. She can't help, however, to recognize that the first two times are 1.5 minutes. Using her HP 48 and DMS program she knows she can save time and keystrokes if she enters the first two commercial times as 1.5 minutes. Here are the keys she pressed.

    PressL1:FIFRemarks
    DMS, DK2--Opens FIF environment
    DEL USERCLEARs stack
    0, DEG or ENTER0.000° 0"Initial value°
    1.5, MIN0.030° 1' 30"Com. 1 & 2 time
    3, MIN0.080° 4' 30"Intro. minutes
    48, SEC0.090° 5' 18"Intro seconds
    12, MIN 0.290° 17'18"Music minutes
    42, SEC0.300° 18'Music seconds
    55, SEC 0.320° 18' 55"Com. 3 seconds
    1, MIN0.330° 19' 55"Pub. Serv. minutes
    18, SEC0.340° 20' 13"Pub. Serv. seconds
    15, MIN0.590° 35' 13"Music minutes
    27, SEC 0.590° 35' 40"Music seconds
    55, SEC0.610° 36' 35"Com. 4 seconds
    1.25, MIN 0.630° 37' 50"Com. 5 minutes/seconds
    1.5, MIN0.660° 39' 20" Com. 6 minutes/seconds
    47, SEC0.670° 40' 7"Com. 7 seconds
    15, MIN0.920° 55' 7"Nature prog. minutes
    45, SEC 0.930° 55' 52"Com. 8 seconds
    2, MIN0.960° 57' 52"News minutes
    37, SEC0.970° 58' 29"News seconds

    Indeed, the times are OK and this time slot is well planned.

    Keying In the Programs The programs utilize two advanced programming techniques - Vectored ENTER (áENTER two places in DK2) and SYSEVALS (two places in DEG2). These are not well documented in the User's Guide. If you have questions consult Bill Wickes book HP 48 Insights Part I, either S (#2322) or G (#3006) Series Editions. Double check your SYSEVAL addresses - if they are wrong the machine could lock up or corrupt memory. When you have keyed in the programs get a byte count on them program object only) to verify that they are the same as listed with the program on the last page of this Technical Note.

    Key the programs as listed. Use alpha mode and spell out the commands if you are not familar with their menu locations. The Advanced User's Reference Manual is a must for looking up these commands. One part of DEG2 is confusing. The eighth line ends with: SWAP + """ . The three double quotes, """, cannot be entered by pressing the quotes key. This is a special case of a string object with a quote inside. If there is an odd number of quotes in a program the machine will attempt to place a missing quote to make it complete. Usually this makes a mess of the program. In order to enter a quote within a string object (a special case because the quote defines the string object) it must be entered as a counted string. To enter, """, use C$ 1 ". Note the space between the $ and 1 and another space between the 1 and the " (quote). Always verify correct program entry with the byte count and check sum given with the program. If you have checked it twice and can't find the error have someone else look at it. More than twice is a waste of your time becuse you are human and are temporarily "blind" to the error.

    Program Listings The programs are printed on the 82240B IR printer and enlarged. The byte counts and check sums are included in the data following the listing. If you use HMS most of the time change "DEG" at the beginning of DK2 to "HMS". Also change your directory name.

    REV A 960402

    <-- Back to Technical Notes Index