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

  1. /* RTrack1.CMD */
  2. /* Sample REXX Program to access AIMS RadioTrack (older 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 RadioTrack FM card (older version).---'
  27. SAY ''
  28. SAY 'CAUTION: This program is capable of writing to I/O directly.'
  29. SAY '         Make sure the rt_Address is set to the same value'
  30. SAY '         as your RadioTrack card.'
  31. SAY '         rt_Address is set to 20C hex by default.'
  32. SAY ''
  33.  
  34. rt_Address = X2D('20C')    /* enter radio address in hex. rt_address variable is converted from hex to decimal */
  35.  
  36. keyhit = ""
  37. DO FOREVER
  38.    SAY "---------------------------------------------------"
  39.    SAY "Type 'x' to eXit..."
  40.    SAY "Commands below are for older RadioTrack only"
  41.    SAY "(type commands without the quotes):"
  42.    SAY "Type 'on' for radio on; 'off' for radio off;"
  43.    SAY "'f' to set radio to 90.1 MHz;"
  44.    SAY "'tu' fine tune 90.1 MHz up; 'td' to fine tune 90.1 MHz down;"
  45.    SAY "'vu' for volume up; 'vd' for volume down;"
  46.    SAY "'t' to check if station is tuned; 'v' for DLL version."
  47.    SAY ""
  48.    SAY "--------------------------------------------------"
  49.    SAY 'Enter selection: '
  50.    PARSE PULL keyhit
  51.    keyhit = Translate(keyhit)
  52.    SELECT
  53.  
  54.       when keyhit = "F" then    /* set frequency  */
  55.         do
  56.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901; 101.1 MHz = 1011 */
  57.                                /* valid range is 87.0MHz to 109MHz. There is no range check, so that must be done in the REXX program */
  58.  
  59.           return_data = RT1Freq( rt_Address, freq_value, '0' )
  60.           SAY "Set freq to 90.1 MHz: " || return_data
  61.           keyhit = ""
  62.         end
  63.  
  64.       when keyhit = "OFF" then    /* Radio off */
  65.         do
  66.           return_data = RT1Off( rt_Address )    /* rt_address must be decimal */
  67.           SAY "Set Radio off: " || return_data
  68.  
  69.           keyhit = ""
  70.         end
  71.  
  72.       when keyhit = "ON" then    /* Radio on */
  73.         do
  74.           return_data = RT1On( rt_Address )    /* rt_address must be decimal */
  75.           SAY "Set Radio on: " || return_data
  76.           keyhit = ""
  77.         end
  78.  
  79.       when keyhit = "VU" then    /* volume up */
  80.         do
  81.           return_data = RT1Volup( rt_Address )    /* rt_address must be decimal */
  82.           SAY "Set volume up: " || return_data
  83.           keyhit = ""
  84.         end
  85.  
  86.       when keyhit = "VD" then    /* volume down */
  87.         do
  88.           return_data = RT1VolDn( rt_Address )    /* rt_address must be decimal */
  89.           SAY "Set volume down: " || return_data
  90.           keyhit = ""
  91.         end
  92.  
  93.       when keyhit = "TU" then    /* tune frequency  */
  94.         do
  95.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  96.                                /* there is no range check, so that must be done in the REXX program */
  97.  
  98.           fine_tune = fine_tune + 1       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  99.                                           /* No range check takes place and fine_tune should be kept inside this range: */
  100.                                           /* -4, -3, -2, -1, 0, 1, 2, 3, 4 since this corresponds to +/-0.1MHz */
  101.           IF fine_tune > 4 THEN
  102.             fine_tune = 0
  103.  
  104.           return_data = RT1Freq( rt_Address, freq_value, fine_tune )
  105.           SAY "Tune freq (90.1 MHz+) up: " || return_data
  106.  
  107.           keyhit = ""
  108.         end
  109.  
  110.       when  keyhit = "TD" then    /* tune frequency  */
  111.         do
  112.           freq_value = 901     /* frequency is MHZ x 10, must be integer!!!! So 90.1 MHz = 901 */
  113.                                /* there is no range check, so that must be done in the REXX program */
  114.  
  115.           fine_tune = fine_tune - 1       /* use this to fine tune the frequency to a resolution of 0.025MHz */
  116.                                           /* No range check takes place and fine_tune should be kept inside this range: */
  117.                                           /* -4, -3, -2, -1, 0, 1, 2, 3, 4 since this corresponds to +/-0.1MHz */
  118.           IF fine_tune < -4 THEN
  119.             fine_tune = 0
  120.  
  121.           return_data = RT1Freq( rt_Address, freq_value, fine_tune )
  122.           SAY "Tune freq (90.1 MHz-) down: " || return_data
  123.  
  124.           keyhit = ""
  125.         end
  126.  
  127.  
  128.       when keyhit = "T" then    /* Radio tuned */
  129.         do
  130.           return_data = RT1Tuned( rt_Address, '150', '100' )    /* rt_address must be decimal */
  131.           SAY "Radio is (1=tuned, 0=not tuned): " || return_data
  132.           keyhit = ""
  133.         end
  134.  
  135.       when keyhit = "V" then    /* rxRTCtrl.DLL version */
  136.         do
  137.           return_data = RTDLLVersion()    /* no parameters passed on */
  138.           SAY "DLL version is: " || return_data
  139.           keyhit = ""
  140.         end
  141.  
  142.    otherwise
  143.      DO
  144.        IF keyhit = "X" THEN
  145.          DO
  146.             CALL RTDropFuncs
  147.             SAY 'RXRTCTRL dropped.'
  148.             EXIT
  149.          END
  150.        ELSE
  151.          SAY "Invalid Input."
  152.      END
  153.    end  /* select */
  154. end /* do */
  155.  
  156. EXIT
  157.  
  158.