Page 1 of 1

Imterrupt

Posted: Fri Apr 30, 2010 7:43 pm
by jgu1
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.

Re: Imterrupt

Posted: Fri Apr 30, 2010 10:19 pm
by medelec35
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.

Re: Imterrupt

Posted: Sat May 01, 2010 7:48 am
by medelec35
If hardware is not working, then change oscillator from HS to XT. I forgot to change that for you. :oops:
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.

Re: Imterrupt

Posted: Sat May 01, 2010 2:19 pm
by jgu1
Hi Medelec!

Thank you for your fast reply, :P

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.

Re: Imterrupt

Posted: Sat May 01, 2010 3:47 pm
by medelec35
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.