Hi!
I am trying to make a 1sec pulse I used the examble from Matrix (att.) But I want to change the clock frequens from 19mhz to 4Mhz.
I have also downloaded the caculator XLsheet from Matrix. I am not undrstanding the procedure 100% with the divider. Maybe if somebody could help me to change the attach. file to a 4 Mhz, I could find the "ligth".
Best regard
Jørgen.
Imterrupt
Moderator: Benj
-
jgu1
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Imterrupt
Hello jgu1
To change from one frequency to another here are the steps.
1) select View menu then project options and change the Clock speed to 4000000Hz
2) Right Click Timer0 interrupt and select properties. In the properties window that pops up, select properties....
I personally change the prescaler rate to give the lowest interrupt frequency possible but is also nearest to a whole number.
E.g. with prescaler at 1:128, interrupt frequency = 30.518 Hz, which means Timer0 interrupt macro will be accessed just over 30 times every second.
So to be more accurate, we select a different interrupt frequency. 61.035Hz (1:64) is better since .035 is less than .518
It is that 61 value that is used in the interrupt macro. so you change from int_count < 75 to int_count < 61.
I have also disabled the low voltage programming option, because it uses the same port as LED's, so not all LEDS would have lit.
Hope this helps.
To change from one frequency to another here are the steps.
1) select View menu then project options and change the Clock speed to 4000000Hz
2) Right Click Timer0 interrupt and select properties. In the properties window that pops up, select properties....
I personally change the prescaler rate to give the lowest interrupt frequency possible but is also nearest to a whole number.
E.g. with prescaler at 1:128, interrupt frequency = 30.518 Hz, which means Timer0 interrupt macro will be accessed just over 30 times every second.
So to be more accurate, we select a different interrupt frequency. 61.035Hz (1:64) is better since .035 is less than .518
It is that 61 value that is used in the interrupt macro. so you change from int_count < 75 to int_count < 61.
I have also disabled the low voltage programming option, because it uses the same port as LED's, so not all LEDS would have lit.
Hope this helps.
- Attachments
-
- 2. Interrupt every second Changed to 4MHz.fcf
- (6.5 KiB) Downloaded 349 times
Martin
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Imterrupt
If hardware is not working, then change oscillator from HS to XT. I forgot to change that for you.
XT =< 4MHz
HS is > 4MHz
To change oscillator type:
select 'Chip', 'Configure....'
You can only do that if 1) PPP is installed
and
2) In 'Chip', 'Compiler options' , 'Use external program to set configuration options; is ticked.
XT =< 4MHz
HS is > 4MHz
To change oscillator type:
select 'Chip', 'Configure....'
You can only do that if 1) PPP is installed
and
2) In 'Chip', 'Compiler options' , 'Use external program to set configuration options; is ticked.
Martin
-
jgu1
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: Imterrupt
Hi Medelec!
Thank you for your fast reply,
Now I can see the "ligth", and my thoughts vere correct. So on this way the 1sec. puls will not be 100% precice causes the last 2 digit in the interrupt frequence (35) but ok.
Thank you.
Have a nice week-end.
Best regard
Jørgen.
Thank you for your fast reply,
Now I can see the "ligth", and my thoughts vere correct. So on this way the 1sec. puls will not be 100% precice causes the last 2 digit in the interrupt frequence (35) but ok.
Thank you.
Have a nice week-end.
Best regard
Jørgen.
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Imterrupt
Your welcome.
.035 nothing to be concerned about, it only means instead of every second, port b changes every 1.0143 seconds. Not much difference at all!
You have a good weekend also.
.035 nothing to be concerned about, it only means instead of every second, port b changes every 1.0143 seconds. Not much difference at all!
You have a good weekend also.
Martin