Download Print this page

Omron NS Reference Manual page 46

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
READHOSTW
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 READHOSTW, 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
, it is necessary to specify the host name after change.
READHOSTW
For example, if a host name is changed from HOST_1 to HOST_A, please change as follows.
Macro Before Changing Host Name
Macro After Changing Host Name
Reads word data from the specified address
System Version 6.2 or higher
READHOSTW(D, h, ch, addr, n)
Reads n-word data from the host (h) and copies it to the PT memory ($W/$HW),
D.
D: Starting address to read data to ($W0 to $W32767, $HW0 to $HW8191)
h: Host (host name/host number)
ch: Host address type *1
addr: Host starting address
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:
Reads 10-bit data from CIO1000 in the PLC connected to the host 1 (Serial
-
port A) and stores it to $W10 to $W19.
READHOSTW($W10, 1, 100, 1000, 10);
Reads 10-bit data from DM2000 in the PLC connected to the host
-
name=[Serial B] (Serial port B) and stores it to $HW10 to $HW19.
READHOSTW($HW10, [SerialB], 300, 2000, 10);
Host Name
SERIALA
HOST2
HOST3
READHOSTW($B10,3,100,1000,0,10);
READHOSTW($B10,2,100,1000,0,10);
READHOSTW($B10,[HOST_1],100,1000,0,10);
READHOSTW($B10,[HOST_A],100,1000,0,10);
After Deleting Host
Host Number
1
2
-
26
Host Name
SERIALA
HOST3
-
nd
Change "3", the 2
argument
that specifies HOST3, to "2"
Change
HOST_1 to
HOST_A

Advertisement

loading

This manual is also suitable for:

Ns-series