Download Print this page

Omron NS Reference Manual page 45

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
READHOSTB
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 READHOSTB, 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
READHOSTB, it is necessary to specify the host name after change.
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 bit data from the specified address
System Version 6.2 or higher
READHOSTB(D, h, ch, addr, r, n)
Reads n-bit data from the host, h and copies it to the PT memory ($B/$HB), D.
D: Starting address to read data to ($B0 to $B32767, $HB0 to $HB8191)
h: Host (host name / host number)
ch: Host address type *1
addr: Starting address in the host
r: Bits
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.00 in the PLC connected to the host 1 (Serial
-
port A) and stores it to $B10 to $B19.
READHOSTB($B10, 1, 100, 1000, 0, 10);
Reads 10-bit data from DM2000.05 in the PLC connected to the host
-
name=[Serial B] (Serial port B) and stores it to $HB10 to $HB19.
READHOSTB($HB10, [SerialB], 300, 2000, 5, 10);
Host Name
SERIALA
HOST2
HOST3
READHOSTB($B10,3,100,1000,0,10);
READHOSTB($B10,2,100,1000,0,10);
READHOSTB($B10,[HOST_1],100,1000,0,10);
READHOSTB($B10,[HOST_A],100,1000,0,10);
After Deleting Host
Host Number
1
2
-
Change "3", the 2
that specifies HOST3, to "2"
25
Host Name
SERIALA
HOST3
-
nd
argument
Change
HOST_1 to
HOST_A

Advertisement

loading

This manual is also suitable for:

Ns-series