Parker Hannifin GEM6K User Manual

Page 37

Advertising
background image

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

NTRATE100

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

VARSHO2=4PCEA

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

VARSHO1=3AS

; 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
VAR2=8PCEA-3VARSHI2

; Calculate offset position: Subtract synch unit #3's
; VARSHO2 (4PCEA) from the captured encoder position
; of axis #8 (8PCEA).

IF(VAR2>10000)

; If position offset by more than 10000 encoder counts

WRITE"AXIS 20 OUT OF POSITION"

NIF
VARB1=3VARSHI1

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

IF(VARB1=B1)

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

WRITE"AXIS 19 IN MOTION"

NIF
;*************************************************************************

page 33

Advertising
This manual is related to the following products:

6K