I am trying to use a 18F45K22, but want to use the internal clock @ 8Mhz.
I don't understand how to edit the registers using this software.
I need to edit
OSCCON
OSCCON2
Any ideas would be helpful.
I know Mikroe do preset configurations for this chip, but strangely enough not using the internal oscillator
(Perhaps they don't know either!)
Thanks
Nigel
Changing register settings in Mikro C
Re: Changing register settings in Mikro C
Hi,
To access the OSCCON registers, simply assign them a value in the the code, like this :
Also be sure to set the internal clock configuration bits in the Edit Project Window.
Regards,
Filip.
To access the OSCCON registers, simply assign them a value in the the code, like this :
Code: Select all
void main() {
OSCCON = 0xAA;
OSCCON2 = 0x55;
}
Regards,
Filip.
Re: Changing register settings in Mikro C
Hi,
Thanks, I will give it a try.
My only worry, is that this software runs @ run time, so if I set the registers to use the internal oscillator, it may not startup?
It concerns me that I can't set the registers when I download the code to the chip.
Thanks
Thanks, I will give it a try.
My only worry, is that this software runs @ run time, so if I set the registers to use the internal oscillator, it may not startup?
It concerns me that I can't set the registers when I download the code to the chip.
Thanks
Re: Changing register settings in Mikro C
Hi,
It will run correctly as long as you do this at the beginning of your code.
Regards,
Filip.
It will run correctly as long as you do this at the beginning of your code.
Regards,
Filip.
Re: Changing register settings in Mikro C
Thanks
Will give it a try
Will give it a try
Re: Changing register settings in Mikro C
Hi Filip,
All working now.
It took a while as I have never used this chip before.
The timings were wrong, so having spent some time going through the assembler output, I now know to set the clock in the compiler to the final clock speed of 64 MHz, as against the master clock @ 16 MHz.
Perhaps there should be a note somewhere on the Edit Project screen.
Onward and forward to learning about timers next.
Thanks
Nigel
All working now.
It took a while as I have never used this chip before.
The timings were wrong, so having spent some time going through the assembler output, I now know to set the clock in the compiler to the final clock speed of 64 MHz, as against the master clock @ 16 MHz.
Perhaps there should be a note somewhere on the Edit Project screen.
Onward and forward to learning about timers next.
Thanks
Nigel