Herunterladen Inhalt Inhalt Diese Seite drucken

JÄGER ADwin-Pro II Systembeschreibung Seite 183

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

Werbung

ADwin
Beispiel
#Include
ADwinPro_All.inc
#Define
frequency
Dim
time,
edges
As Long
Dim
rest
As Float
Dim
oldpw, oldcnt, newpw,
Dim
pw_cnt
As Long
Init:
Processdelay
=
3000000
P2_Cnt_Enable(1,0001b)
P2_Cnt_Mode(1,1,00000000b)
P2_Cnt_Clear(1,0Fh)
P2_Cnt_Enable(1,0Fh)
P2_Cnt_PW_Enable(1,0Fh)
P2_Cnt_PW_Latch(1,0Fh)
oldpw
=
0
oldcnt
=
0
frequency
=
0
Event:
P2_Cnt_Sync_Latch(1,0001b)
newcnt
= P2_Cnt_Read_Latch(1,1)
edges
= (newcnt-oldcnt)
If
(edges
<> 0)
PW_cnt
= P2_Cnt_Read_Int_Register(1,1,8)
time
=
PW_cnt
frequency
=
edges*100000000/time
P2-CNT-Module)
oldcnt=newcnt
oldpw =newpw
EndIf
ADwin-Pro II Software, Handbuch Version 1.6, Januar 2010
FPar_1
newcnt
As Long
'100Hz
'mode: clock/dir
'enable standard counters
'enable PW counters
'copy all counter values
'latch all counter values
'number of edges between events
Then
-
oldpw
'calculate timebase
'(100000000->frequency of
'store VR-counter value
'store PW-counter value
'vr-cnt
'frequency
Pro II: Zähler
P2_Cnt_Sync_Latch
179

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis