PIC 18F26K22
PIC 18F26K22
Hello All,
I would like the speed clock of the PIC to be set to 64 MHz.
I wrote in C Code "OSCCON = 0x7C", General Option (in Flowcode) 16000000Hz clock speed and Configure 0x1 = 39ff; 0x2 = 0x3cf9; 0x3 = 0x9bff
My problem is that I am not sure of my 0x7C and I hesitate with 0x74 (OSCCON), or maybe I am not good with these 2 proposals.
I admit that I am a little lost.
Thank you in advance for your answer.
Luc
I would like the speed clock of the PIC to be set to 64 MHz.
I wrote in C Code "OSCCON = 0x7C", General Option (in Flowcode) 16000000Hz clock speed and Configure 0x1 = 39ff; 0x2 = 0x3cf9; 0x3 = 0x9bff
My problem is that I am not sure of my 0x7C and I hesitate with 0x74 (OSCCON), or maybe I am not good with these 2 proposals.
I admit that I am a little lost.
Thank you in advance for your answer.
Luc
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC 18F26K22
7C looks like it should work.
Looking at the datasheet it states: to C code block
once that is done, just run 1 second clock flasher.
Looking at the datasheet it states:
You could try addingDatasheet wrote:Unlike external clock modes, when internal clock
modes are enabled, the PLL can only be controlled
through software. The PLLEN control bit of the
OSCTUNE register is used to enable or disable the
PLL operation when the HFINTOSC is used.
Code: Select all
st_bit(OSCTUNE,PLLEN);
once that is done, just run 1 second clock flasher.
Martin
Re: PIC 18F26K22
Thanks a lot Martin, I shall try your adding proposal.
through my question and your answer, I discovered the "IntOsc Helper", (it's good to ask questions and especially to get good answers). unfortunately in the Helper it is not possible to go above 16 MHz, the Helper does not take into account the PLL.
on the other hand I have another question, I would use the EEPROM to memorize the value of a counter that will go beyond 255 (ff), how to do?
In detail, I coupled an encoder on the axis of an electric motor.
I consulted the forum but I did not find anything about it, otherwise memorizing decimal.
many thanks in advance
Luc
through my question and your answer, I discovered the "IntOsc Helper", (it's good to ask questions and especially to get good answers). unfortunately in the Helper it is not possible to go above 16 MHz, the Helper does not take into account the PLL.
on the other hand I have another question, I would use the EEPROM to memorize the value of a counter that will go beyond 255 (ff), how to do?
In detail, I coupled an encoder on the axis of an electric motor.
I consulted the forum but I did not find anything about it, otherwise memorizing decimal.
many thanks in advance
Luc
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC 18F26K22
Your welcome.
Then enable PLL in configuration settings.
according to osccon helper the value should be 0x70.
But as I stated earlier 0x7c will work.
The difference (0xC) is only &
Both of which are read only so would not have affected the speed of oscillator.
Take a look at this thread
You can use the helper to set the Speed at 16MHz.Corto wrote:unfortunately in the Helper it is not possible to go above 16 MHz, the Helper does not take into account the PLL.
Then enable PLL in configuration settings.
according to osccon helper the value should be 0x70.
But as I stated earlier 0x7c will work.
The difference (0xC) is only
Code: Select all
Oscillator Start-up Time-out Status bit
Code: Select all
HFINTOSC Frequency Stable bit
You will need to separate the inter value into two seperate bytes which will then take up two EEPROM locations instead of one.Corto wrote: I would use the EEPROM to memorize the value of a counter that will go beyond 255 (ff), how to do?
Take a look at this thread
Martin
Re: PIC 18F26K22
Many thanks Martin,
For the osccon that's OK, thanks.
but for the EEPROM, I took a look at the thread and I don't understand, because you wrote :
ByteHigh = (IntValue/ 256)
ByteLow = IntValue - ByteHigh* 256
for exemple, IntValue = 1000; ByteHigh = 1000/256 = 3.9; ByteLow = 1000 - (3.9*256) = 0.
I am sorry but something is wrong, I can't separate the value.
Sorry a new time
Luc
For the osccon that's OK, thanks.
but for the EEPROM, I took a look at the thread and I don't understand, because you wrote :
ByteHigh = (IntValue/ 256)
ByteLow = IntValue - ByteHigh* 256
for exemple, IntValue = 1000; ByteHigh = 1000/256 = 3.9; ByteLow = 1000 - (3.9*256) = 0.
I am sorry but something is wrong, I can't separate the value.
Sorry a new time
Luc
- 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: PIC 18F26K22
Hello,
Bytes can only hold integer values so this is incorrect.
It would actually be like this.
Bytes can only hold integer values so this is incorrect.
Code: Select all
ByteHigh = 1000/256 = 3.9
Code: Select all
ByteHigh = 1000/256 = 3
ByteLow = 1000 - (3*256) = 232
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
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC 18F26K22
Personally, I would use:Corto wrote:for the EEPROM, I took a look at the thread and I don't understand, because you wrote :
ByteHigh = (IntValue/ 256)
ByteLow = IntValue - ByteHigh* 256
Code: Select all
ByteLow = IntValue & 0xFF
ByteHigh = (IntValue >> 8) & 0xFF
Code: Select all
IntValue = ByteLow+(ByteHigh << 8)
Also if interested in storing floats then I would use
Code: Select all
FloatToString$()
Martin
Re: PIC 18F26K22
thank you very much Martin, I finally understood!
I need time, but now it's ok.
I will follow your advice and avoid using divisions and multiplication
the bit shifting will do the trick.
Many thanks a new time
Luc
I need time, but now it's ok.
I will follow your advice and avoid using divisions and multiplication
the bit shifting will do the trick.
Many thanks a new time
Luc