The system clock runs at 8MHz so to get a PIT2 flag with a 1kHz frequency requires a TimeOut
value of 8000. Also ADC has to be configured to run with injected conversions with triggers
coming from PIT 2. Channel 1 and its end of conversion are set:
Meanwhile, from the SIUL, LEDs have to be selected as GPIO output, two buttons as GPIO inputs,
two pins as eMIOS channels and a pin for ADC input.
eMIOS is initialised with a prescaler of 8 for getting 1MHz internal clock. Its channel 23 is
configured as MCB counting from 1 to 1000, giving a roll-over at 1kHz. The channel 22 is
configured as OPWMB with a leading edge at zero and a trailing edge at 25%.And then a function
is given for setting the eMIOS channel’s duty cycle: