ADwin-Gold II
, Manual February 2013
121
Counters
Cnt_PW_Latch
ADwin
Cnt_PW_Latch
Cnt_PW_Latch
copies the value of one or more PWM counters into a buffer.
Syntax
#Include
ADwinGoldII.inc / GoldIITiCo.inc
Cnt_PW_Latch
(
pattern
)
Parameters
Notes
The buffer is to be read with
Cnt_PW_F_DC
or
Cnt_PW_HL
.
See also
,
,
Valid for
Gold II-CNT
Example
Rem Please select the appropriate include for ADbasic /
TiCoBasic
#Include
ADwinGoldII.inc
'for ADbasic
Rem #Include GoldIITiCo.inc 'for TiCoBasic
Dim
old_1
,
new_1
As
Long
Dim
old_2
,
new_2
As
Long
Init:
old_1
=
0
'initialize
old_2
=
0
Cnt_SE_Diff
(
0
)
'all counters single ended (TTL)
Cnt_Mode
(
1
,
0
)
'Counter 1: PWM at input A
Cnt_Mode
(
2
,
0
)
'Counter 2: PWM at input A
Cnt_Enable
(
1100000000b
)
'start PWM counters 1+2
Event:
Cnt_PW_Latch
(
11b
)
'latch both counters 1+2
Cnt_Get_PW_HL
(
1
,
Par_1
,
Par_2
)
'read high/low time
Cnt_Get_PW
(
1
,
FPar_1
,
FPar_2
)
'read frequency./duty cycle
T11 TiCo
pattern
Bit pattern.
Bit = 0: no function.
Bit = 1: transfer PWM counter value into a buffer.
LONG
Bit no.
31…4
3
2
1
0
Counter
–
4
3
2
1