![Denso Keyence Vision XG Series Manual Download Page 34](http://html.mh-extra.com/html/denso/keyence-vision-xg-series/keyence-vision-xg-series_manual_2483252034.webp)
34
画像処理システム/XGシリーズ
8. Sample Program
Sub Main
On Error Goto ErrProc
'Declare error process routine
Dim caoXG as Object
'Declare provider variable
Dim vntResult as Variant
'Declare character-string variable
Dim pTargetPos as Position
'Declare P-type variable
takearm keep = 0
pTargetPos = P11
caoXG = cao.AddController("XG", "CaoProv.KEYENCE.VWXG", "","Conn=eth:192.168.0.10")
'Provider implementation
caoXG.ChangeInspectSetting 1, 2
'Change to SD1 setting 2
caoXG.Trigger -1
'Trigger
delay 200
vntResult = caoXG.ReadVariable("#XPos") 'Receive data
letx pTargetPos = posx(P11) + val(vntResult)
'Expand X component of received data to position data
approach p, pTargetPos, @p 20, s = 100
'Go to position after correction
move l, @e pTargetPos, s = 10
call Hand.Close
depart l, @p 50, s = 100
EndProc:
'Normal end routine
"State necessary end process"
exit sub
ErrProc:
'Abnormal end routine
"State necessary error process"
Goto EndProc
End Sub