7-25
7.5.5 Flag Operation in Serial Communication
Header: No-STX, Terminator: CR
Receiving data:
The “reception done” flag, the “transmission done” flag, and the F159 (MTRN) instruction are
related as follows:
- For general-purpose serial communication, half-duplex transmission must be used.
- Reception is disabled when the “reception done” flag R9038 is on.
- When F159 (MTRN) is executed, the number of bytes received is cleared, and the address (write
pointer) in the receive buffer is reset to the initial address.
- Also, when F159 (MTRN) is executed, the error flag R9037, the “reception done” flag R9038 and the
“transmission done” flag R9039 goes off.
- Duplex transmission is disabled while F159 (MTRN) is being executed. The “transmission done” flag
R9039 must be observed.
- Reception stops if the error flag R9037 goes on. To resume reception, execute the F159 (MTRN)
instruction, which turns off the error flag.
Note:
Be aware that the “reception done” flag R9038 changes even while a scan is in progress (e.g., if the
“reception done” flag is used multiple times as an input condition, there is a possibility of different
statuses existing within the same scan.) To prevent multiple read access to the special internal relay you
should generate a copy of it at the beginning of the program.