Example: This example uses peer-to-peer communication with three 6K8 products.

;****

This code is executed on Peer unit #1:

**************************

NTID1

 

; This unit is the "primary unit" (unit #1)

NTRATE100

; Set the sharing

rate to 100ms and enable this unit

VARSHO1=1PE

; Store axis #1 encoder position in shared output variable #1

;*************************************************************************

;****

This code is executed on unit #3: **************************

NTID3

 

; Set unit ID to 3

rate to 100ms and enable this unit

NTRATE100

; Set the sharing

VARSHO2=4PCEA

; Store the captured encoder position of axis #4 in shared

VARSHO1=3AS

; output variable

#2

; Store axis #3's

axis status (binary data) in shared

;output variable #1

;*************************************************************************

;**** This code is executed on unit #2: **************************

NTID2

; Set unit ID to 2

NTRATE100

; Set the sharing rate to 100ms and enable this unit

VAR1=1VARSHI1

; Load the value of unit #1's first shared data (1PE) into VAR1

WRITE"AXIS 1 AT POSITION" ; Report axis 1's current position (the value of VAR1)

WRVAR1

; Calculate offset position: Subtract synch unit #3's

VAR2=8PCEA-3VARSHI2

 

; VARSHO2 (4PCEA) from the captured encoder position

IF(VAR2>10000)

; of axis #8 (8PCEA).

; If position offset by more than 10000 encoder counts

WRITE"AXIS 20 OUT OF POSITION"

NIF

; Get unit 3's VARSHO1 information (3AS)

VARB1=3VARSHI1

IF(VARB1=B1)

; If axis 3 on unit #3 (axis #19) is in motion

WRITE"AXIS 19 IN MOTION"

 

NIF

 

;*************************************************************************

page 33

Page 37
Image 37
Parker Hannifin GEM6K manual Output variable #1 This code is executed on unit #2