ADwin-Pro
Hardware, manual version 2.9, June 2006
137
Pro I: Digital-I/O- and Counter Modules
Programming the Module Pro-PWM-4(-I)
ADwin
PWM_ENABLE
PWM_ENABLE
enables or stops the counters corresponding to the specified
PWM outputs.
PWM_ENABLE(
module
,
pattern
)
Parameters
Description
This instruction does not affect the PWM outputs, only the counters cor-
responding to the outputs. It should be used only in combination with the
instruction
PWM_OUT
.
PWM_OUT
PWM_OUT
sets the specified PWM output channel to high or low level.
PWM_OUT(
module
,
channel
,
level
)
Parameters
Description
This instruction does only work, when the counters corresponding to the
PWM outputs are enabled with
PWM_ENABLE
.
Programming Example / Program Description
The program <
Pro_PWM_4.bas
> provided on the
ADwin
CDROM in the
folder <
C:\ADwin\ADbasic3\Samples_ADwin_Pro
> generates identical
PWM signals at the outputs 1…4 with a frequency of 1kHz.
With the parameters
PAR_1
…
PAR_14
you will be able to change in
ADbasic
the following values in the parameter window:
– The high-level duration of the PWM signals:
PAR_1
,
PAR_3
,
PAR_5
,
PAR_7
.
– The low-level duration of the PWM signal:
PAR_2
,
PAR_4
,
PAR_6
,
PAR_8
.
– The division factor (prescaler) for the frequency of 5MHz, which will be
generated by the crystal oscillator on the
ADwin-Pro
module PWM-4:
PAR_9
…
PAR_12
.
– The enabling of the 16-bit counters (only the internal counter and not the
PWM outputs!) :
PAR_13
.
– The module address:
PAR_14
.
LONG FLOAT VAR CONST
module
defined module address
9
-
9
9
pattern
Bit pattern for the PWM outputs. Bits 0-3
correspond to outputs 1-4:
bit=0: enable counter
bit=1: stop counter
9
-
9
9
LONG FLOAT VAR CONST
module
defined module address
9
-
9
9
channel
PWM output channel (1…4)
9
-
9
9
level
Output value to be set
0: U
out
= logical "0"
1: U
out
= logical "1" (or V
EE
at PWM-4-I)
9
-
9
9