199
Function Descriptions Appendix C
• Arguments and Return Values
•Example
Variable name Data type Description
Storage_location STRING Specifies the storage location for the received text
string.
Number_of_characters INT, UINT, WORD Specifies the number of characters to receive.
0 to 255
SCU_unit_number INT, UINT, WORD Specifies the number of the Serial Communica-
tions Unit.
Serial_port INT, UINT, WORD 1: Serial port 1
2: Serial port 2
Internal_logic_port INT, UINT, WORD 0 to 7: Internal logic port number specified
16#F: Automatic internal logic port allocation
Barcode reade
CPU Unit
Serial
Communications
Unit (SCU)
Unit No.: 0
Message → Value to read
Serial
port 2
Variables
BOOL P_DoRecvData (* Variable to control receive function *)
INT iProcess (* Process number *)
STRING Message (* Variable to store received message *)
BOOL P_RXDU_Recv (* Status of Serial Communications Unit *) AT 1519.06 Unit No. 0
Use serial port 2
BOOL P_ComInstEnable (* Communications Port Enable Flag *)*) AT A202.07 Use port 7
(* Use the following: Unit number: 0, Serial port number: 2, Logical port number: 7 *)
(* Receive data when P_DoRecvData is ON and iProcess is 0 *)
IF (P_DoRecvData = TRUE) AND (iProcess = 0) THEN
iProcess := 1;
P_DoRecvData := FALSE;
END_IF;
(* Execute receive processing according to process number *)
CASE iProcess OF
1: (* Reception function executed if Communications Enabled Flag and Reception Completed
Flag are ON. *);
IF (P_ComInstEnable = TRUE) AND (P_RXDU_Recv = TRUE) THEN
RXD_SCU(Message, 16, 0, 2, 7);
iProcess := 2;
END_IF;
2: (* Reception has been completed if Communications Port Enable Flag is ON *)
IF P_ComInstEnable = TRUE THEN
iProcess := 0;
END_IF;
END_CASE;