An microcontroller comprising: a first measurement unit, comprising: a constant current source; a current steering switch arrangement (112, 114) coupled to the constant current source, wherein the current steering switch arrangement comprises switches formed by field effect transistors (112, 114); a capacitor (118; 328) coupled to the current steering switch arrangement (112, 114), the capacitor (118; 328) having a known value of capacitance, wherein a voltage on the capacitor (118; 328) increases substantially linearly in time when the current steering switch arrangement (112, 114) couples the constant current source to the capacitor (118; 328), wherein the current steering switch arrangement (112, 114) is configured such that the constant current source always is coupled with a load through the current steering switch arrangement (112, 114), and wherein the capacitor (118, 328) is discharged by means of a discharge switch prior to a time measurement and a remaining voltage on the capacitor (118, 318) is measured by the ADC; a circuit for controlling the current steering switch arrangement (112, 114), wherein the current steering switch couples the capacitor (118; 328) to the constant current source when the circuit detects a start of an event and decouples the capacitor from the constant current source when the circuit detects an end of the event; an analog-to-digital converter for converting the voltage on the capacitor (118; 328) to a digital representation thereof; and a digital processor configured to convert the digital representation of the voltage on the capacitor (118; 328) either to a time value representative of a time period between the start and the end of the event or to a capacitance value. a first measurement unit, comprising: a constant current source; a current steering switch arrangement (112, 114) coupled to the constant current source, wherein the current steering switch arrangement comprises switches formed by field effect transistors (112, 114); a capacitor (118; 328) coupled to the current steering switch arrangement (112, 114), the capacitor (118; 328) having a known value of capacitance, wherein a voltage on the capacitor (118; 328) increases substantially linearly in time when the current steering switch arrangement (112, 114) couples the constant current source to the capacitor (118; 328), wherein the current steering switch arrangement (112, 114) is configured such that the constant current source always is coupled with a load through the current steering switch arrangement (112, 114), and wherein the capacitor (118, 328) is discharged by means of a discharge switch prior to a time measurement and a remaining voltage on the capacitor (118, 318) is measured by the ADC; a circuit for controlling the current steering switch arrangement (112, 114), wherein the current steering switch couples the capacitor (118; 328) to the constant current source when the circuit detects a start of an event and decouples the capacitor from the constant current source when the circuit detects an end of the event; a constant current source; a current steering switch arrangement (112, 114) coupled to the constant current source, wherein the current steering switch arrangement comprises switches formed by field effect transistors (112, 114); a capacitor (118; 328) coupled to the current steering switch arrangement (112, 114), the capacitor (118; 328) having a known value of capacitance, wherein a voltage on the capacitor (118; 328) increases substantially linearly in time when the current steering switch arrangement (112, 114) couples the constant current source to the capacitor (118; 328), wherein the current steering switch arrangement (112, 114) is configured such that the constant current source always is coupled with a load through the current steering switch arrangement (112, 114), and wherein the capacitor (118, 328) is discharged by means of a discharge switch prior to a time measurement and a remaining voltage on the capacitor (118, 318) is measured by the ADC; a circuit for controlling the current steering switch arrangement (112, 114), wherein the current steering switch couples the capacitor (118; 328) to the constant current source when the circuit detects a start of an event and decouples the capacitor from the constant current source when the circuit detects an end of the event; an analog-to-digital converter for converting the voltage on the capacitor (118; 328) to a digital representation thereof; and a digital processor configured to convert the digital representation of the voltage on the capacitor (118; 328) either to a time value representative of a time period between the start and the end of the event or to a capacitance value.