using TIMER2 .. to make a 1 msec interrupt long routine

Use this section to discuss your embedded Flowcode projects.
Post Reply
Lambra
Posts: 12
http://meble-kuchenne.info.pl
Joined: Thu Nov 24, 2022 11:55 pm
Been thanked: 1 time

using TIMER2 .. to make a 1 msec interrupt long routine

Post by Lambra »

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..

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: using TIMER2 .. to make a 1 msec interrupt long routine

Post by chipfryer27 »

Hi

Without seeing your chart it is difficult to say, but it could be your osc settings.

If you post your chart we can help further.

Regards

Post Reply