omron — Serial and Disk I/O Basics

Serial and Disk I/O Basics Input Wait Modes Normally, eV+ waits until the data from an input instruction is available before continuing with program execution. However, the READ instruction and GETC function accept an optional argument that specifies no-wait mode. In no-wait mode, these instructions return immediately with the error status -526 (No data received) if there is no data available. A program can loop and use these operations repeatedly until a successful read is completed or until some other error is received. The disk devices do not recognize no-wait mode on input and treat such requests as normal input-with-wait requests.

Output Wait Modes Normally, eV+ waits for each I/O operation to be completed before continuing to the next program instruction. For example, the instruction: TYPE /X50 causes eV+ to wait for the entire record of 50 spaces to be transmitted (about 50 milliseconds with the terminal set to 9600 baud) before continuing to the next program instruction. Similarly, WRITE instructions to serial lines or disk files will wait for any required physical output to complete before continuing. This waiting is not performed if the /N (no wait) format control is specified in an output instruction. Instead, eV+ immediately executes the next instruction.

The IOSTAT function checks whether or not the output has completed. It returns a value of zero if the previous I/O is not complete. If a second output instruction for a particular LUN is encountered before the first no-wait operation has completed, the second instruction automatically waits until the first is done. This scheme means the no-wait output is effectively double-buffered. If an error occurs in the first operation, the second operation is canceled, and the IOSTAT value is correct for the first operation. With eV+, the IOSTAT function can be used with a second argument of 3 to explicitly check for the completion of a no-wait write.

eV+Language User's Guide, v2.x, 18318-000 Rev A Page 142