![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: After using the appropriate search criteria I did not find an entry for my question. I apologize if this question has been asked. I need to talk to RS232 devices and I inherited a piece of code that uses QIOW to communicate over the RS232 line. QIOW us es a terminal mask to define the terminator, the code is looking for. I've read the section of the VMS manual with regard to this mask (ie. "function terminators" in Terminal Driver chapter of I/O User's: Part I) and I still don't get it. Could yo u help me understand how it works. Maybe an example or to to go with it? Thanks, Jeff The Answer is : When one of the terminator characters specified in the mask is seen in the input stream, the sys$qiow read operation completes, and the AST (if specified) fires. Probably the most commonly-used terminator in serial communications is the carriage return character. Attached is a BASIC example of the sys$qiow call specifying the terminator mask. 1 OPTION TYPE = EXPLICIT ON ERROR GO TO OOPS EXTERNAL LONG FUNCTION SYS$ASSIGN, SYS$QIOW EXTERNAL LONG CONSTANT IO$_READVBLK, IO$M_TIMED DECLARE LONG THE_LENGTH, TT_CHAN, S, I DECLARE LONG CONSTANT BACKSPACE_BIT=256, TAB_BIT=512, & LINEFEED_BIT=1024, RETURN_BIT=8192 MAP (IO_STAT) WORD IO_STAT, TERM_OFF, & BYTE TERM_CHAR, FILL, TERM_LEN, CURS_POS, & LONG TERMINATOR_MASK, TERMINATOR_BITS, & STRING THE_BUFFER = 80 TERMINATOR_BITS = BACKSPACE_BIT + TAB_BIT + LINEFEED_BIT + RETURN_BIT S=SYS$ASSIGN ("TT", TT_CHAN,,) !Get a channel for the QIO WHILE 1 + 1 = 2 S=SYS$QIOW ( ,TT_CHAN BY VALUE ,IO$_READVBLK + IO$M_TIMED BY VALUE & ,IO_STAT BY REF & ,,,THE_BUFFER BY REF, LEN(THE_BUFFER) BY VALUE & ,10% by value ,TERMINATOR_MASK BY REF & ,,) PRINT S; "IO_STAT"; IO_STAT; & "TERM_OFF"; TERM_OFF; "TERM_CHAR"; TERM_CHAR; & "TERM_LEN"; TERM_LEN; "CURS_POS"; CURS_POS PRINT "Buffer="; THE_BUFFER; " "; PRINT " "; ASCII(SEG$(THE_BUFFER,I,I)); FOR I = 1 TO 20 INPUT THE_BUFFER !Exit with control-Z here NEXT OOPS: PRINT ERT$(ERR) UNLESS ERR=11 RESUME 2 2 END
|