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
Problem with interrupt timer
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Problem with interrupt timer
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 28
- Joined: Wed Apr 04, 2012 1:33 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: Problem with interrupt timer
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
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
Thanx Ben,
Would you please help me resolve the "Uninitialized Variable" in the Error Results window.
Thanx
Mauro
Would you please help me resolve the "Uninitialized Variable" in the Error Results window.
Thanx
Mauro
- Attachments
-
- Interrupt every second
- UninitVar.JPG (87.49 KiB) Viewed 5505 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Problem with interrupt timer
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
One way to resolve that is to select the variable and Edit type a value in the Initial Value: Box. Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Problem with interrupt timer
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
Glad it makes good sense now.
![Smile :)](./images/smilies/icon_smile.gif)
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
Martin
Re: Problem with interrupt timer
![Laughing :lol:](./images/smilies/icon_lol.gif)
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