home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 310.lha / rexxserdev.library_v1.08 / testser.rexx < prev    next >
OS/2 REXX Batch file  |  1980-12-05  |  2KB  |  49 lines

  1. /* another serial port test program */
  2. /* works best when connected to another computer via a null modem */
  3.  
  4. /* open the Rexx support library */
  5.  
  6. signal on error
  7. if ~show('L',"rexxsupport.library") then do
  8.    if addlib('rexxsupport.library',0,-30,0) then
  9.       say 'added rexxsupport.library'
  10.    else do;
  11.       say 'support library not available'
  12.       exit 10
  13.       end
  14.    end
  15.  
  16. if ~show( 'L', "rexxserdev.library" ) then do
  17.    if addlib( 'rexxserdev.library', 0, -30, 0 ) then
  18.       say 'added rexxserdev.library'
  19.    else do;
  20.       say 'support library not available'
  21.       exit 10
  22.       end
  23.    end
  24.  
  25. libaddr = serlibbase()
  26. say 'serial library base =' libaddr
  27. if seropen() then say 'serial device opened'
  28. if serreset() then say 'serial device reset'
  29. if ~sersetparms( 9600, 8, 'N', 1, 0 ) then say 'Parms not set'
  30. if ~serclear() then say 'buffer not clear'
  31. block = allocmem( 80 ) 
  32. addr = c2d( block )
  33. say 'memory block address =' addr
  34. say "send a '~' to end"
  35. do until text = '~'
  36.    query = SerQuery()
  37.    parse var query err rl stat
  38.    if rl > 0 then do; text = SerRead( addr, rl ); call writech STDOUT, text; end;
  39.    end
  40. if ~freemem( block, 80 ) then say 'memory block not freed'
  41. text = 'send stuff out port again'
  42. say 'calling SerWrite'
  43. if ~serwrite( text, length( text ) ) then say 'nothing written'
  44. say 'back from SerWrite'
  45. error:
  46. if serclose() then say 'serial device closed'
  47. if remlib( 'rexxserdev.library' ) then say 'removed rexxserdev.library'
  48. /***************** ShoList.rexx ****************/
  49.