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 reader
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;
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......