home *** CD-ROM | disk | FTP | other *** search
- /* another serial port test program */
- /* works best when connected to another computer via a null modem */
-
- /* open the Rexx support library */
-
- signal on error
- if ~show('L',"rexxsupport.library") then do
- if addlib('rexxsupport.library',0,-30,0) then
- say 'added rexxsupport.library'
- else do;
- say 'support library not available'
- exit 10
- end
- end
-
- if ~show( 'L', "rexxserdev.library" ) then do
- if addlib( 'rexxserdev.library', 0, -30, 0 ) then
- say 'added rexxserdev.library'
- else do;
- say 'support library not available'
- exit 10
- end
- end
-
- libaddr = serlibbase()
- say 'serial library base =' libaddr
- if seropen() then say 'serial device opened'
- if serreset() then say 'serial device reset'
- if ~sersetparms( 9600, 8, 'N', 1, 0 ) then say 'Parms not set'
- if ~serclear() then say 'buffer not clear'
- block = allocmem( 80 )
- addr = c2d( block )
- say 'memory block address =' addr
- say "send a '~' to end"
- do until text = '~'
- query = SerQuery()
- parse var query err rl stat
- if rl > 0 then do; text = SerRead( addr, rl ); call writech STDOUT, text; end;
- end
- if ~freemem( block, 80 ) then say 'memory block not freed'
- text = 'send stuff out port again'
- say 'calling SerWrite'
- if ~serwrite( text, length( text ) ) then say 'nothing written'
- say 'back from SerWrite'
- error:
- if serclose() then say 'serial device closed'
- if remlib( 'rexxserdev.library' ) then say 'removed rexxserdev.library'
- /***************** ShoList.rexx ****************/
-