Datasheet

4D SYSTEMS DIABLO16 Processor
© 2014 4D SYSTEMS Page 17 of 33 www.4dsystems.com.au
DIABLO16 PROCESSOR
PWM Out 5.12.
There are 6 PWM channels available to be
configured by the user, with 4 time bases available
for selection.
The PWM can be configured to be used in Servo
Mode, or Simple Mode.
Please refer to the table on the previous page for
details on which GPIO can be configured for PWM.
Servo Mode allows a millisecond input value with
0.01ms resolution, which runs at a frequency of
approximately 50Hz or 50pps (20ms). The position
of the servo is determined by the width of the
pulse. Generally 1.5ms is 90 degrees, 1ms being 0
degrees and 2ms being 180 degrees. Servos
however vary, and the DIABLO16 PWM control can
be adjusted to suit most applications.
Simple Mode allows a percentage input value with
resolution of 0.1%, which runs at a frequency of
approximately 70Hz.
To enable the PWM output on a GPIO pin, the
following 4DGL function is used:
PWM_Init(pin, mode, value);
Where ‘pin’ is the GPIO compatible with the
particular pin function, ‘mode’ is the type of PWM
to generate, and ‘value’ is the parameter which
defined the PWM pulse itself.
Example Connection Diagram
This illustrates PWM Out being configured on GPIO
PA4, and is used to open an external relay via a
transistor, for an application such as dimming a
lamp.
Note: This example is an illustration of a PWM
connection from the Diablo16 processor. It is not
the complete circuit nor illustrates best practice.
Please refer to the separate document titled
'DIABLO16-4DGL-Internal-Functions.pdf' for more
information on how to use the PWM functions.
Pin Counter 5.13.
There are 6 Pin Counter channels available to be
configured by the user, used to count incoming
pulses with the ability to call a user function on
overflow. The Pin Counter function is available for
use in a variety of modes.
The counters can be read and written at any time.
Please refer to the table in section 5.8 ‘Alternate
Pin Functions Overview’ for details on which
GPIO can be configured for this.
To enable the Pin Counter function on a GPIO pin,
the following 4DGL function is used:
pin_Counter(pin, mode, OVFfunction);
Where ‘pin’ is the GPIO pin compatible with this
particular function, ‘mode’ is the type of trigger
used to count on such as Rising/Falling/Edge, and
‘OVFfunction’ is the user function to call when the
counter overflows, if desired.
Example Connection Diagram
This illustrates Pin Counter being configured on
GPIO PA8, and is used to count pulses coming from
a rotation sensor for example.
Note: This example is an illustration of a PWM
connection from the Diablo16 processor. It is not
the complete circuit nor illustrates best practice.
Please refer to the separate document titled
'DIABLO16-4DGL-Internal-Functions.pdf' for more
information on how to use the Pin Counter
functions.