i am working on MC9S12XDP512 microcontroller.and i have interfaced with proximity sensor. i have given 5v power supply and i was getting 5v when the obstacle was not present and 0v for when the obstacle was there. my objective is ,,,,,,when the obstacle is present for 2 seconds afterwards the LED should glow. or when there is no obstacle for 2 seconds afterwards also the LED should glow.
so...i have used normal timer programing ...but i am not getting.so is better to use periodic interrupt timer(PIT).