![Mect MPNE1001 Series User Manual Download Page 44](http://html1.mh-extra.com/html/mect/mpne1001-series/mpne1001-series_user-manual_1759153044.webp)
Inputs/outputs modules: MPNE
Mect Srl
43
ME7087_13 04/21
5.2.3 Using lines as PWM
Lines 22, 23, 24, 30, 31 and 32 can be configured as PWM. There are two possible
PWM configurations, one with 50% duty-cycle and the other with a configurable
duty-cycle between 0 and 100%.
To use lines such as PWM, you must configure the following registers:
MPNE_ExpDigitalOutConfig17_24 / MPNE_ExpDigitalOutConfig25_32
MPNE_Frequency_PWM1 / MPNE_Frequency_PWM2
MPNE_PWM_OUT22_OUT21_DC / MPNE_PWM_OUT24_OUT23_DC /
MPNE_PWM_OUT30_OUT29_DC / MPNE_PWM_OUT32_OUT31_DC
Once the registers are configured, bringing the corresponding line to 1, the outgoing
signal is emitted.
For example, if you want to emit a 1kHz frequency signal with duty-cycle 10% on
line 24, please follow the following instructions (ST code):
MPNE_ExpDigitalOutConfig17_24 := 16#C000;(* bits 14 and 15 configured as 11 *)
MPNE_PWM_OUT24_OUT23_DC := 16#0A00; (* high byte configured with 10 (10%) *)
MPNE_Frequency_PWM1
:= 1000;
(* frequency 1000 Hz *)
MPNE_DigOut_24
:= true; (*output 24 activation *)