Page 1 of 1
Problem with interrupt timer
Posted: Tue Apr 17, 2012 8:57 am
by Rabbit
Hello,
The example "Interrupt every second" will not run exact in simulation and at the EB-06.
Simulation: if I change the prescaler rate from 1:256 to 1:16 the LEDs increase in about 1 sec. interval.
EB-06: no action, only LED D0 is lighting constant.
Is my configuration correct? Please look to "PICmicro-Configuration.jpg"
Chip-Freuquency: 19.6608MHz
I have no idea where I have to debug.
Best Regards
Rabbit
Re: Problem with interrupt timer
Posted: Tue Apr 17, 2012 9:25 am
by Benj
Hello Rabbit,
In your timer interrupt properties please ensure you are selecting the clock source as the CLKI and not the External Input. The timer should then run correctly on the hardware. The simulation speed will probably not be exact but allows you to see how the program should work when it is running at the correct speed on the hardware.
Re: Problem with interrupt timer
Posted: Tue Apr 17, 2012 9:54 am
by Rabbit
Hello Ben,
You got it! Many thanks to you. The internal clock (CLKO) is it. Now the program running with correct speed on the hardware.
Only the simulation is very slow.
Many thanks and best regards from Rabbit
Re: Problem with interrupt timer
Posted: Tue Jun 05, 2012 4:30 pm
by mauro
Thanx Ben,
Would you please help me resolve the "Uninitialized Variable" in the Error Results window.
Thanx
Mauro
Re: Problem with interrupt timer
Posted: Tue Jun 05, 2012 4:53 pm
by medelec35
Uninitialized Variables normally only occur if variable is read from before it's written to.
One way to resolve that is to select the variable and Edit type a value in the Initial Value: Box.
Martin
Re: Problem with interrupt timer
Posted: Tue Jun 05, 2012 9:36 pm
by mauro

Thank you Martin, all makes good sense now.
Re: Problem with interrupt timer
Posted: Tue Jun 05, 2012 9:56 pm
by medelec35
No problem.
Glad it makes good sense now.
To make things even clearer.
When chip first starts up, unlike Flowcode simulator, all variables are at a random number to start with.
So if you have
Int_Count = Int_Count +1
If Int_Count = 75 then Int_Count = 0
Int_Count could start of with a value of 98 (just as a random number I thought of)
So the other option is to place a variable before the interrupt enable component:
Int_Count=0
So when the 'Int_Count = Int_Count +1' takes place then Int_Count would start off as 0
So again you would not get the message.
Martin
Re: Problem with interrupt timer
Posted: Tue Jun 05, 2012 10:11 pm
by mauro

Hi Martin,
i have just finished getting rid of those "undesirables" in my flowchart...looks so much better now. I just could not figure it out. All was well and good in V4, then along came V5 with all its new stuff... guess its resistance to change.
Thanx for the great explanation
Mauro