1. A microcontroller comprising: a central processing unit (CPU); a plurality of peripheral units coupled with said CPU; and a peripheral trigger generator coupled with said CPU and the plurality of peripheral units and comprising a state machine which is programmable via said CPU by a plurality of sequential programming steps, wherein the peripheral trigger generator is configured to receive a plurality of input signals and depending on a programming of the state machine selects at least one of said plurality of input signals and controls a function of a selected one of said plurality of peripheral units depending on the selected input signal and the programming of the state machine, wherein the state machine generates at least one output signal to control the function of the selected peripheral unit.