home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxrtctrl.zip / RTrack2.CMD < prev    next >
OS/2 REXX Batch file  |  1998-12-21  |  7KB  |  183 lines

  1. /* RTrack2.CMD */
  2. /* Sample REXX Program to access AIMS RadioTrack (newer version) using RXRTCTRL.DLL */
  3.  
  4. /* To run this program, the file RXRTCTRL.DLL must be in */
  5. /* the same directory as this file or in a directory */
  6. /* listed in your LIBPATH. */
  7.  
  8. /* Prerequisites for RXRTCTRL to work properly:
  9.  
  10. The following two statements must be in your CONFIG.SYS
  11.  
  12. IOPL=YES,FXPRINT  (or just IOPL=YES)
  13. DEVICE=D:\OS2\BOOT\TESTCFG.SYS
  14.  
  15. These statements are added by default by Warp 3 and Warp 4.
  16.  
  17. */
  18.  
  19. /*======================*/
  20. /* Load RXRTCTRL.DLL    */
  21. /*======================*/
  22. CALL RXFuncAdd 'RTLoadFuncs', 'RXRTCTRL', 'RTLoadFuncs'
  23. CALL RTLoadFuncs
  24.  
  25. SAY ''
  26. SAY '--- Sample REXX Program to access newer RadioTrack FM card.---'
  27. SAY ''
  28.  
  29. SAY 'CAUTION: This program is capable of writing to I/O directly.'
  30. SAY '         Make sure the rt_Address is set to the same'
  31. SAY '         address as your RadioTrack card.'
  32. SAY '         rt_Address is set to 20C hex by default.'
  33. SAY ''
  34.  
  35. rt_Address = X2D('20C')   /* enter rt_address in hex. rt_address variable is converted from hex to decimal */
  36.  
  37. keyhit = ""
  38. DO FOREVER
  39.    SAY "---------------------------------------------------"
  40.    SAY "Type 'x' to eXit..."
  41.    SAY "Commands below are for newer RadioTrack only"
  42.    SAY "(type commands without the quotes):"
  43.    SAY "Type 'on' for radio On; 'off' for radio Off;"
  44.    SAY "'90' to set radio to 90.1 MHz;"
  45.    SAY "'99' to set radio to 99.5 MHz; "
  46.    SAY "'101' to set radio to 101.1 MHz; "
  47.    SAY "'tu' fine tune 90.1 MHz up; 'td' to fine tune 90.1 MHz down;"
  48.    SAY "'t' to check if station is tuned; 'p' to check if radio card is present;"
  49.    SAY "'v' for DLL version."
  50.    SAY "--------------------------------------------------"
  51.    SAY 'Enter selection: '
  52.    PARSE PULL keyhit
  53.    keyhit = Translate(keyhit)
  54.    SELECT
  55.  
  56.       when keyhit = "90" then    /* set frequency  */
  57.         do
  58.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  59.                                /* there is no range check, so that must be done in the REXX program */
  60.  
  61.           fine_tune = 0       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  62.                               /* No range check takes place and fine_tune should be kept inside this range: */
  63.                               /* -8, -6, -4, -2, 0, 2, 4, 6, 8 since this corresponds to +/-0.1MHz */
  64.  
  65.           return_data = RT2Freq( rt_Address, freq_value, fine_tune )
  66.           SAY "Set Freq, to 90.1 MHz: " || return_data
  67.           keyhit = ""
  68.         end
  69.  
  70.       when keyhit = "99" then    /* set frequency  */
  71.         do
  72.           freq_value = 995     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  73.                                /* there is no range check, so that must be done in the REXX program */
  74.  
  75.           fine_tune = 0       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  76.                               /* No range check takes place and fine_tune should be kept inside this range: */
  77.                               /* -8, -6, -4, -2, 0, 2, 4, 6, 8 since this corresponds to +/-0.1MHz */
  78.  
  79.           return_data = RT2Freq( rt_Address, freq_value, fine_tune )
  80.           SAY "Set Freq. to 99.5 MHz: " || return_data
  81.           keyhit = ""
  82.         end
  83.  
  84.       when keyhit = "101" then    /* set frequency  */
  85.         do
  86.           freq_value = 1011     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  87.                                 /* there is no range check, so that must be done in the REXX program */
  88.  
  89.           fine_tune = 0       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  90.                               /* No range check takes place and fine_tune should be kept inside this range: */
  91.                               /* -8, -6, -4, -2, 0, 2, 4, 6, 8 since this corresponds to +/-0.1MHz */
  92.  
  93.           return_data = RT2Freq( rt_Address, freq_value, fine_tune )
  94.           SAY "Set Freq. 101.1 MHz: " || return_data
  95.           keyhit = ""
  96.         end
  97.  
  98.       when keyhit = "TU" then    /* tune frequency  */
  99.         do
  100.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  101.                                /* there is no range check, so that must be done in the REXX program */
  102.  
  103.           fine_tune = fine_tune + 2       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  104.                                           /* No range check takes place and fine_tune should be kept inside this range: */
  105.                                           /* -8, -6, -4, -2, 0, 2, 4, 6, 8 since this corresponds to +/-0.1MHz */
  106.           IF fine_tune > 8 THEN
  107.             fine_tune = 0
  108.  
  109.           return_data = RT2Freq( rt_Address, freq_value, fine_tune )
  110.           SAY "Tune freq (90.1 MHz+) up: " || return_data
  111.  
  112.           keyhit = ""
  113.         end
  114.  
  115.       when  keyhit = "TD" then    /* tune frequency  */
  116.         do
  117.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  118.                                /* there is no range check, so that must be done in the REXX program */
  119.  
  120.           fine_tune = fine_tune - 2       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  121.                                           /* No range check takes place and fine_tune should be kept inside this range: */
  122.                                           /* -8, -6, -4, -2, 0, 2, 4, 6, 8 since this corresponds to +/-0.1MHz */
  123.           IF fine_tune < -8 THEN
  124.             fine_tune = 0
  125.  
  126.           return_data = RT2Freq( rt_Address, freq_value, fine_tune )
  127.           SAY "Tune freq (90.1 MHz-) down: " || return_data
  128.  
  129.           keyhit = ""
  130.         end
  131.  
  132.       when keyhit = "OFF" then    /* Radio Off / mute */
  133.         do
  134.           return_data = RT2Off( rt_Address )    /* rt_address must be decimal */
  135.           SAY "Turn radio off or mute: " || return_data
  136.           keyhit = ""
  137.         end
  138.  
  139.       when keyhit = "ON" then    /* Radio On / unmute  */
  140.         do
  141.           return_data = RT2On( rt_Address )    /* rt_address must be decimal */
  142.           SAY "Turn radio on or unmute: " || return_data
  143.           keyhit = ""
  144.         end
  145.  
  146.       when keyhit = "T" then    /* Radio tuned */
  147.         do
  148.           return_data = RT2Tuned( rt_Address, '250' )    /* rt_address must be decimal */
  149.           SAY "Radio is (1=tuned, 0=not tuned): " || return_data
  150.           keyhit = ""
  151.         end
  152.  
  153.       when keyhit = "P" then    /* New RadioTrack card present */
  154.         do
  155.           return_data = RT2Present( rt_Address )    /* rt_address must be decimal */
  156.           SAY "New RadioTrack is (1=present, 0=not present): " || return_data
  157.           keyhit = ""
  158.         end
  159.  
  160.       when keyhit = "V" then    /* rxRTCtrl.DLL version */
  161.         do
  162.           return_data = RTDLLVersion()    /* no parameters passed on */
  163.           SAY "DLL version is: " || return_data
  164.           keyhit = ""
  165.         end
  166.  
  167.    otherwise
  168.      DO
  169.        IF keyhit = "X" THEN
  170.          DO
  171.             CALL RTDropFuncs
  172.             SAY 'RXRTCTRL dropped.'
  173.             EXIT
  174.          END
  175.        ELSE
  176.          SAY "Invalid Input."
  177.      END
  178.    end  /* select */
  179. end /* do */
  180.  
  181. EXIT
  182.  
  183.