2 Instruction Descriptions
2-676
NJ-series Instructions Reference Manual (W502)
• The command or response is sometimes lost during communications due to noise or other factors.
You can increase reliability by setting Option.Retry to a value higher than 0 to perform retry process-
ing when a response is not returned.
• To specify a serial port with the serial gateway function, specify the unit address of the serial port for
DstNetAdr.NetNo. The unit addresses of the ports on Serial Communications Units are as follows:
• Port 1
Unit address = BYTE#16#80 + BYTE#16#04 × unit number (hex)
Example for Unit Number 1
BYTE#16#80+BYTE#16#04 × 1 = BYTE#16#84
• Port 2
Unit address = BYTE#16#81 + BYTE#16#04 × unit number (hex)
Example for Unit Number 2
BYTE#16#81+BYTE#16#04 × 2 = BYTE#16#89
• The instruction is executed only when there is an available port. Therefore, use the system-defined
variable _Port_isAvailable (Network Communications Instruction Enabled Flag) in an N.O. execution
condition for the instruction.
• Execution of this instruction is continued until processing is completed even if the value of Execute
changes to FALSE or the execution time exceeds the task period. The value of Done changes to
TRUE when processing is completed. Use this to confirm normal completion of processing.
• If the instruction is used in ST, make sure that the instruction is processed each task period as long
as instruction execution continues. Otherwise, normal processing is sometimes not possible.
• The command is not sent if the value of CmdSize is 0. When the instruction is executed, the value of
Done changes to TRUE.
• Refer to Using this Section on page 2-2 for a timing chart for Execute, Done, Busy, and Error.
• An error occurs in the following cases. Error will change to TRUE.
• The value of CommPort is outside of the valid range.
• The value of a member of DstNetAdr is outside of the valid range.
• The value of CmdSize is outside of the valid range.
• The value of a member of Option is outside of the valid range.
• The value of CmdSize exceeds the size of CmdDat[].
• The response size exceeds the size of RespDat[].
• The value of _Port_isAvailable is FALSE.
• Communications fail.
Related System-defined Variables
Name Meaning Description
_Port_numUsingPort Number of Used Ports This is the number of ports that are currently used.
_Port_isAvailable Network Communica-
tions Instruction
Enabled Flag
TRUE: A port is available.
FALSE: A port is not available.
Additional Information
Precautions for Correct Use