Herunterladen Inhalt Inhalt Diese Seite drucken

JÄGER ADwin-Pro II Systembeschreibung Seite 423

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

Werbung

ADwin
Beispiel
#Include
ADwinPro_All.inc
#Define
module
4
Rem set SENT channel and appropriate bit pattern
channel
#Define
1
#Define
ch_pattern
Shift_Left(1, channel-1)
#Define
msg_count
Par_2
#Define
error_count
#Define
lost_msg
Par_9
Dim
senttable[150]
As Long At DM_Local
Dim
sent_data[100]
As Long At DM_Local
Dim
msg_no,
msg_no_old
Dim
i
As Long
Init:
Rem Initialize receive buffer for SENT data
For
i
=
1
To
100
sent_data[i] =
0
Next
i
Processdelay = 60000
Rem initialize module, request latch for channel 1 (once)
P2_SENT_Init(module, senttable)
Do
:
Until
(P2_SENT_Command_Ready(module)
Par_3 = P2_SENT_Request_Latch(module, ch_pattern)
Do
:
Until
(P2_SENT_Command_Ready(module)
Par_4 = P2_SENT_Set_CRC_Implementation(module, channel, 1)
msg_count
=
0
msg_no_old
=
-1
lost_msg
=
-1
'number of lost messages, skip first check
Event:
Rem read latch status of all channels
Par_1 = P2_SENT_Check_Latch(module)
Rem Any data for SENT channel 1?
If
((Par_1
And
ch_pattern) = 0)
Rem read latch data into sent_data[]
P2_SENT_Get_Latch_Data(senttable, channel, sent_data, 1)
Rem request latch for channel 1 again
Do
:
Until
(P2_SENT_Command_Ready(module)
Par_3 = P2_SENT_Request_Latch(module, Par_1
Inc
msg_count
Rem check for serial message
If
(sent_data[7]
Rem serial message data are given in sent_data[7]..[11]
EndIf
Rem check for lost messages
msg_no
=
sent_data[1]
If
((msg_no
- msg_no_old) <> 1)
msg_no_old
=
msg_no
Rem check for CRC errors (index 6)
If
(sent_data[6]
EndIf
ADwin-Pro II Software, Handbuch Apr. 2021
'number of received messages
Par_7
'number of CRC errors
'number of lost messages
As Long
'60000=5kHz / 30000=10kHz
'number of received messages
'init msg number
Then
'number of received messages
<> 0)
Then
Then
'store for next check
<> 0)
Then
Inc
error_count
= 0)
= 0)
= 0)
XOr
ch_pattern)
Inc
lost_msg
Pro II: SENT-Schnittstelle
P2_SENT_Get_Latch_Data
419

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis