using TIMER2 .. to make a 1 msec interrupt long routine
Posted: Fri Aug 29, 2025 10:00 pm
Hi there .. okay so very simply - after setting up using the INT icon at the start of the program.. and hopefully according to sources .. i hope reliable enough.. a LED does not want to flash at the desired rate.!!
so.. it is so simple.. but it don't work.!??
using the INT icon - setup for TIMER2 .. so that oscillator frequency is 8000000 Hz.. then set prescaler and postscaler values .. and the rollover (PR2) register to 125 .. to give an interrupt every 1000 Hz or .. 1 msec.
a simple routine resetting a counter 'a' .. to zero after it counts to 500 .. = 500 msec .. and using the syntax .. LED_STATE = ! LED_STATE .. which is the variable in an output icon.. on a port A5 of a PIC12F683 ...
the LED sposed to go on for 500 msec then off for 500 msec.. but it rather comes on for 5 sec and off for 5 sec..!!
Please someone - tell me what I done wrong..??
thank you.
Regards Lambra..
so.. it is so simple.. but it don't work.!??
using the INT icon - setup for TIMER2 .. so that oscillator frequency is 8000000 Hz.. then set prescaler and postscaler values .. and the rollover (PR2) register to 125 .. to give an interrupt every 1000 Hz or .. 1 msec.
a simple routine resetting a counter 'a' .. to zero after it counts to 500 .. = 500 msec .. and using the syntax .. LED_STATE = ! LED_STATE .. which is the variable in an output icon.. on a port A5 of a PIC12F683 ...
the LED sposed to go on for 500 msec then off for 500 msec.. but it rather comes on for 5 sec and off for 5 sec..!!
Please someone - tell me what I done wrong..??
thank you.
Regards Lambra..