beautypg.com

Pm designer operation manual, Communication operation – B&B Electronics WOP-2121V-N4AE - Manual User Manual

Page 440

background image

4

14

PM Designer Operation Manual

14-31

CHAPTER 14 USING MACROS

14.4.12. Communication Operation

EN_LINK

Format

EN_LINK(P1,P2,P3)

Data Type

U

Function

Enables communication link P1 or sub-link P2 of communication link P1 when P3 is 1. Disables
the specified communication link or sub-link when P3 is 0.

P1 (I/C)

The number of the communication link to be enabled or disabled.

P2 (I/C)

The node address of the sub-link to be enabled or disabled. If the specified communication link
has no sub-link, this parameter is ignored. If the specified communication link has sub-links and
you want to enable or disable the link itself, set this parameter to 0.

P3 (I/C)

To enable the specified communication link or sub-link, set this parameter to 1. To disable the
specified communication link or sub-link, set this parameter to 0.

Example 1

ENABLE_LINK(

1

,

20

,

0

)

/* Disable the sub-link, whose node address is 20, of communication

link 1. */

LINK_STS

Format

P1

= LINK_STS(P2,P3 )

Data Type

U

Function

Gets the status of communication link P2 or the sub-link P3 of communication link P2 and saves
the result in P1.

P1 (I/C)

The word to receive the status of the specified communication link or sub-link. The status is a
16-bit value. The following table lists the meaning of each status value.

Status Value

Meaning

Status Value

Meaning

0 OK

14

Device

busy

1

Overrun error

15

Unknown error

2

Break error

16

Link disabled

3

Parity error

17

Initialization failure

4

Framing error

18

Failed to send data

5

No response

19

Failed to receive data

6

Unrecognized
response

20

Failed to open connection

7

Timeout

21

Connection not ready

8

Inactive CTS

22

Invalid sub-link

9

Checksum error

23

Invalid COM port

10 Command

rejected

24 Error

11

Invalid address

255

Condition uncertain

12

Invalid range

65535

Failed to get status

13 Invalid

request

P2 (I/C)

The number of the communication link.

P3 (I/C)

The node address of the sub-link. If the specified communication link has no sub-link, this
parameter is ignored.

Example 1

$U100

= LINK_STS(

2

,

0

)

/* Get the status of communication link 2 and save it to $U100. */

Example 2

$U12

= LINK_STS(

1

,

128

)

/* Get the status of the sub-link, whose node address is 128, of

communication link 1 and save it to $U12. */