Download Print this page

Omron NS Reference Manual page 59

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
WRITEHOSTB
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 WRITEHOSTB, 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
WRITEHOSTB, 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 bit data to the specified address
System Version 6.2 or higher
WRITEHOSTB(h, ch, addr, r, S, n)
Copies n-bit data from ($B/$HB), 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
r: Bits
S: Source starting address ($B0 to $B32767, $HB0 to $HB8191)
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 $B10 to $B19 to CIO1000.00 in the PLC connected to the host 1 (Serial
-
port A).
WRITEHOSTB(1, 100, 1000, 0, $B10, 10);
Writes $HB10 to $HB19 to DM1000.05 in the PLC connected to the host
-
name=[Serial B] (Serial port B).
WRITEHOSTB([SerialB], 300, 1000, 5, $HB10,10);
Host Name
SERIALA
HOST2
HOST3
WRITEHOSTB($B10,3,100,1000,0,10);
WRITEHOSTB($B10,2,100,1000,0,10);
Host Number
1
2
-
WRITEHOSTB($B10,[HOST_1],100,1000,0,10);
WRITEHOSTB($B10,[HOST_A],100,1000,0,10);
39
After Deleting Host
Host Name
SERIALA
HOST3
-
Change "3", the 1
that specifies HOST3, to "2"
st
argument
Change
HOST_1 to
HOST_A

Advertisement

loading

This manual is also suitable for:

Ns-series