User guide

85
VTB USER GUIDE
ENCODER ENABLE=true on NGQ INIT Object
Syntax
NG_ENC(Char Chan, Long *Val)
Parameters
Chan Number of channel (from 0 to 1)
val Pointer to a long variable where will be contained the counter
Example
Used variables:
posx LONG ' Counter encoder channel 0
posy LONG ' Counter encoder channel 1
In TASK PLC:
ng_enc(0,posx)
ng_enc(1,posy)
EVERYWHERE:
if posx>25000 ' Read encoder channel 0
. . .
posx=0 ' Reset counter channel 0
endif
if posy>200000 ' Read encoder channel 1
. . .
posy=1000 ' Preset counter channel 1
endif
NG-T0 - ZERO INDEX OF ENCODER NGQx
This function allows to read the state of the zero index input of each encoder channel equipped in the expansion card
NGQx. The channel selection is made as for the reading of encoders.
Syntax
NG_T0(Char Chan) as char
Parameters
Chan Number of channel (from 0 to 1)
Return value:
State of the index input:
0 OFF
1 ON
WARNING: THE INDEX INPUT IS DIFFERENTIAL, THE ON STATE ON OCCURS WHEN ON CH+ THERE IS A VOLTAGE
GREATER THAN THE VOLTAGE ON CH- .
Example
if ng_t0(0)
. . .
endif
NG_RELE – RELE' on NGQx
This function allows to update the two RELAIS equipped in each expansion card NGQx.
Usually these RELAIS are connected to the input ENABLE of the SERVO DRIVER but they can be managed for any
applications. The channel selection is made as for the reading of encoders.
Syntax
NG_RELE(Char Chan, char State)