7.4.2 Communication with External Devices
Programming example of general-purpose serial communication
The F159 (MTRN) instruction is used to send and receive data via the specified COM port. F159 (MTRN)
F144 (TRNS) instruction is not available with the FP-X.
F159 (MTRN) instruction
Data 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, H
Only the K constants (only K1 and K2)
Sending data
The amount of data specified by n is sent to the external device from among the data stored in the data
table, starting with the area specified by S, through the COM port specified by D. Data can be sent with
the header and terminator automatically attached. A maximum of 2048 bytes can be sent. When the
above program is run, the eight bytes of data contained in DT101 to DT104 and stored in the send buffer
starting from DT100 are sent from COM1 port.
Receiving data
Reception of data is controlled by turning the “reception done” flags R9038/R9048 on and off. The
received data is stored in the receive buffer specified in the system register. Data can be received when
F159 (MTRN) turns the “reception done” flag off. When the reception of the data is completed (the
terminator 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 to
clear the number of received bytes to 0. To receive data continuously without sending data, clear the
number of transmitted bytes to 0 (set “n” to “K0”), and then execute the F159 (MTRN) instruction.
Reference:
<Programming Manual ARCT1F313E>
Binary communication
Selecting “STX not exist” for the header and “None” for the terminator in the general-purpose serial
communication enables the binary communication.
Sending data: Sends the data of bytes to be specified.
Receiving data: Check the No. of bytes received before the process. At that time, the reception done flag
does not work.
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: [email protected]
Summary of Contents for AFPX-C30R
Page 6: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 12: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 28: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 54: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 102: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 295: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 300: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 309: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 311: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 314: ...Program Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 347: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 352: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 361: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 363: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 366: ...Program Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 384: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 398: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 410: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 430: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 448: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Page 543: ...17 7 ASCII Codes Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...