Download Print this page

Omron NS Reference Manual page 60

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
WRITEHOSTW
Applicable versions
Format
Function
Return Value
Example
Reference
If a host is deleted with CX-Designer, the subsequent hosts will be renumbered in order. The example
below shows when HOST2 is deleted, the host numbers are renumbered and HOST3's number will be
changed to 2.
Before Deleting Host
Host Number
1
2
3
Please note that when a host number is given as argument h of WRITEHOSTW, it is necessary to specify the
host number after change. With the above example, please change the macro as follows.
Macro Before Deleting Host
Macro After Deleting Host
To check the host number, confirm the number at the left side of host name shown on the Comm.Setting
dialog of CX-Designer.
Also, note that if a host name is changed with CX-Designer when the host name is used as argument h of
WRITEHOSTW, it is necessary to specify the host name after change.
For example, if a host name is changed from HOST_1 to HOST_A, change as follows.
Macro Before Changing Host Name
Macro After Changing Host Name
Writes word data to the specified address
System Version 6.2 or higher
WRITEHOSTW(h, ch, addr, r, S, n)
Copies n-word data starting ($W/$HW), S in the PT memory to the specified host, h.
h: Host (host name/host number)
ch: Host address type *1
addr: Host starting address
S: Source starting address ($W0 to $W32767, $HW0 to $HW8191)
n: Number of elements to write (1 to 126)
* 1: Refer to address type number at the end of this chapter.
Normal termination: 0x0000
Error: high order 8 bits (B8 to B15): MRES (main response cord)
low order 8 bits (B0 to B7) : SRES (sub-response cord)
*Refer to 5-2-7 Communications Errors and Countermeasures in the NS-Series
Programming Manual for MRES, and SRES.
SerialA and Serial B are registered in the host:
-
Writes $W10 to $W19 to CIO1000 in the PLC connected to the host 1 (Serial
port A).
WRITEHOSTW(1, 100, 1000, $W10, 10);
-
Writes $HW10 to $HW19 to DM1000 in the PLC connected to the host
name=[Serial B] (Serial port B).
WRITEHOSTW([SerialB], 300, 1000, $HW10, 10);
Host Name
SERIALA
HOST2
HOST3
WRITEHOSTW($B10,3,100,1000,0,10);
WRITEHOSTW($B10,2,100,1000,0,10);
WRITEHOSTW($B10,[HOST_1],100,1000,0,10);
WRITEHOSTW($B10,[HOST_A],100,1000,0,10);
After Deleting Host
Host Number
1
2
-
40
Host Name
SERIALA
HOST3
-
st
Change "3", the 1
argument
that specifies HOST3, to "2"
Change
HOST_1 to
HOST_A

Advertisement

loading

This manual is also suitable for:

Ns-series