Herunterladen Inhalt Inhalt Diese Seite drucken

JÄGER ADwin-Pro II Systembeschreibung Seite 274

Programmierung in adbasic
Vorschau ausblenden Andere Handbücher für ADwin-Pro II:
Inhaltsverzeichnis

Werbung

Pro II: EtherCAT-Schnittstelle
P2_ECAT_Init
270
Beispiel
#Include
ADwinPro_All.INC
#Define
ECAT_MODULE_ADDRESS
#Define
ecat_inputs
#Define
ecat_outputs
Dim
ecat_inputs[16]
Dim
ecat_outputs[16]
Dim
ecat_comtable[150]
Dim
i
As Long
Dim
ret
As Long
Init:
Processdelay
=
300000
Rem initialize data transfer T11 <-> TiCo
Par_1
= P2_ECAT_Init(ECAT_MODULE_ADDRESS, ecat_comtable)
Par_2
= P2_ECAT_Get_Version(ecat_comtable)
For
i
=
1
To
16
ecat_inputs[i] =
Next
For
i
=
1
To
16
ecat_outputs[i] =
Next
Par_11
=
0
Par_12
=
0
Event:
ret
= P2_ECAT_Get_State(ecat_comtable)
If
(ret
= 8)
Then
ret
= P2_ECAT_Write_Data_16L(ecat_comtable, ecat_outputs)
If
(ret
= 0)
Then
Inc
Par_11
EndIf
ret
= P2_ECAT_Read_Data_16L(ecat_comtable, ecat_inputs)
If
(ret
= 0)
Then
Inc
Par_12
EndIf
EndIf
5
Data_1
Data_2
As Long
As Long
As Long
' 1kHz
0
i
'operational mode
'writing data was o.k.
'increase write counter
'reading data was o.k.
'increase read counter
ADwin-Pro II Software, Handbuch Version 1.6, Januar 2010
ADwin
'10000h

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis