7-397.5.2 Communication with External DevicesProgramming example of general-purpose serial communicationThe F159 (MTRN) instruction is used to send and receive data via the specified COM port. F159 (MTRN)is only used with the FPΣ. It is an updated version of F144 (TRNS) and allows multiple communicationports to be accommodated.F144 (TRNS) is not available with the FPΣ.F159 (MTRN) instructionData is sent and received via the specified COM port .Devices that can be specified for S:Devices that can be specified for n:Devices that can be specified for D:Only data registers (DT) can be specified as the send buffer.WX, WY, WR, WL, SV, EV, DT, LD, I (I0 to ID), K, HOnly the K constants (only K1 and K2)Transmission of dataThe amount of data specified by n is sent to the external device from among the data stored in the datatable, starting with the area specified by S, through the COM port specified by D. Data can be sent withthe header and terminator automatically attached. A maximum of 2048 bytes can be sent. When theabove program is run, the eight bytes of data contained in DT101 to DT104 and stored in the send bufferstarting from DT100 are sent from COM1 port.Reception of dataReception of data is controlled by turning the “reception done” flags R9038/R9048 on and off. Thereceived data is stored in the receive buffe specified in the system register. Data can be received whenF159 (MTRN) turns the “reception done” flag off. When the reception of the data is completed (theterminator is received), the “reception done” flag turns on, and subsequently, receiving data is prohibited.To receive the next data, execute the F159 (MTRN) instruction and turn the “reception done” flag off toclear the number of received bytes to 0. To receive data continuously without sending data, clear thenumber of transmitted bytes to 0 (set “n” to “K0”), and then execute the F159 (MTRN) instruction.