Does anybody know if 20MHz PICs can be overclocked say at 24 MHz.
Would GCBasic accept a value of 24 for a PIC rated at 20MHz or less?
Is the clock rate just a scaling factor for the timing sequences such as WAIT or does it have a more fundamental role in the operation of the program?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
cgb will error on compile if the clock freq is over what the chips DS is rated at. I believe its in the chip .dat files as a value that gcb looks at apon compiling. I get errors on any chip I try to compile that has a mhz rating over what the DS specs out as max. I have tried several 16 & 18 series for the tests. I would like to know this also and try a few overclocks myself...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Haven't tried overclocking myself. For sure, the chipmhz will affect the wait states as noted. Also, serial communication, adc measurement timing, one wire temp would account for a few others.
Why not look at the given upgrade paths like the:
18f's with 4x PLL for 40Mhz or 10mips
18f USB chips for 48Mhz or 12mips
18fXXKXX for 64Mhz or 16mips
Still not enough speed?
Try GCBasic and the AVR chips for 20mips
Although, depending on what the code is doing, this can be somewhat misleading. The AVR instruction set gives more cycles to clearing/setting pins and goto or jumps, than the PIC.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GCBASIC should let you overclock a chip, I've had no trouble telling it to compile for a 16F84A @ 100 MHz, an 18F2520 @ 90, or a 16F88 @ 50. Can someone post code that won't work?
The most important question though is why you'd actually want to overclock. If you need more speed, use an 18F chip - even at the same clock speed as a 16F, they'll run the program faster due to their more efficient instruction set. Or, as Kent suggests, use an 18F with PLL - if I need speed, I use an 18F4550 at 48 MHz.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the replies. What I am doing is sampling a waveform using a 12F675. Now using a 1 us sampling rate it can be Fourier transformed to give a maximum frequency of 500 kHz. What I would like is to get to 1 MHz which obviously requires 0.5 us. As I understand it it should be impossible to get exactly 0.5 us with a 20 MHz clock rate, but not with a 24 MHz.
Another thing that seems strange is at clock rates lower than 20 MHz the following will work
WAIT 1 us
but
x=1
wait x us
gives an error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't think the PIC A/D converter can sample anywhere near that fast. Even if it could, you need time between samples to put the samples in storage variables so you can compute the FFT after all the samples are in their "buckets".
In your WAIT code snippet, it doesn't work because GCB can use single-character variables.
Joe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
gives the message that variables cannot be used with us delays when the clock rate is less than 20 MHz.
My program looks something like this:
#chip 12F675, 20
#config OSC=HS, MCLRE=OFF, WDT=OFF
DIR GPIO.0 out
dir gpio.1 in
set gpio.0 off
qx=20
start:
start1:
if gpio.1=0 then goto start1
set gpio.0 on
wait 4 us
set gpio.0 off
wait qx us
set gpio.0 on
wait 4 us
set gpio.0 off
qx=qx+1
if qx>255 then end
wait 5 s
goto start
So basically there are two output pulses of 4 us separated by a variable delay.
What I would like to be able to do is have the delay incremented by 0.5 us (or even 0.6 us - more feasible with a 20 MHz clock).
Would a delay loop work? How many instructions does a delay loop take?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I've had no trouble telling it to compile for a 16F84A @ 100 MHz, an 18F2520 @ 90, or a
> 16F88 @ 50. Can someone post code that won't work?
If I do this is works fine (anything<40) : #chip 18F6722, 40
If I go anything over 40mhz: #chip 18F6722, 41 ( anything > 40)
I get :
Compile Error: Variable 551 if of type BYTE and does not have a bit 5854
So I assumed the .dat contained a value (somewhere?) to see the error if over the max mhz on the chip based on DS value for clk? I have the most current update.zip applied.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I could have a blinking led in a 16f876a at 25, 28 and 32 MHz, any problem.
The only thing is that it does not work with the same 22pf capacitors that i used for 20 MHz, but with any capacitor it works OK. I think capacitors should be redimensioned to the new speed.
Really interesting.
>If you need more speed, use an 18F chip
The cuestion is: why using a 18f if you can run a 16f at 32 MHz??
I suppose that it could be problems running a pic16 at that speeds... but i don't know... i can understand that a 20 MHz rated pic could work at 25 MHz, this is a small difference, but 32 MHz is more than 50% above.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That compile error looks like it's related to one of the included libraries. Are you using rs232, A/D, or similar?
With the latest (9/8) update, this code:
xdly=1
wait xdly us
will now work on any chip speed. GCBASIC will show a warning when the delay will be inaccurate. For the delay to be correct, the clock speed needs to be 12 + 4x MHz, where x is a positive integer >= 0. This is due to the way that the delay routine works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anybody know if 20MHz PICs can be overclocked say at 24 MHz.
Would GCBasic accept a value of 24 for a PIC rated at 20MHz or less?
Is the clock rate just a scaling factor for the timing sequences such as WAIT or does it have a more fundamental role in the operation of the program?
cgb will error on compile if the clock freq is over what the chips DS is rated at. I believe its in the chip .dat files as a value that gcb looks at apon compiling. I get errors on any chip I try to compile that has a mhz rating over what the DS specs out as max. I have tried several 16 & 18 series for the tests. I would like to know this also and try a few overclocks myself...
Haven't tried overclocking myself. For sure, the chipmhz will affect the wait states as noted. Also, serial communication, adc measurement timing, one wire temp would account for a few others.
Why not look at the given upgrade paths like the:
18f's with 4x PLL for 40Mhz or 10mips
18f USB chips for 48Mhz or 12mips
18fXXKXX for 64Mhz or 16mips
Still not enough speed?
Try GCBasic and the AVR chips for 20mips
Although, depending on what the code is doing, this can be somewhat misleading. The AVR instruction set gives more cycles to clearing/setting pins and goto or jumps, than the PIC.
GCBASIC should let you overclock a chip, I've had no trouble telling it to compile for a 16F84A @ 100 MHz, an 18F2520 @ 90, or a 16F88 @ 50. Can someone post code that won't work?
The most important question though is why you'd actually want to overclock. If you need more speed, use an 18F chip - even at the same clock speed as a 16F, they'll run the program faster due to their more efficient instruction set. Or, as Kent suggests, use an 18F with PLL - if I need speed, I use an 18F4550 at 48 MHz.
Thanks for the replies. What I am doing is sampling a waveform using a 12F675. Now using a 1 us sampling rate it can be Fourier transformed to give a maximum frequency of 500 kHz. What I would like is to get to 1 MHz which obviously requires 0.5 us. As I understand it it should be impossible to get exactly 0.5 us with a 20 MHz clock rate, but not with a 24 MHz.
Another thing that seems strange is at clock rates lower than 20 MHz the following will work
WAIT 1 us
but
x=1
wait x us
gives an error.
I don't think the PIC A/D converter can sample anywhere near that fast. Even if it could, you need time between samples to put the samples in storage variables so you can compute the FFT after all the samples are in their "buckets".
In your WAIT code snippet, it doesn't work because GCB can use single-character variables.
Joe
....mean't to say "can't " use single-character variables.
....mean't to say "can't " use single-character variables.
Ok so
xdly=1
wait xdly us
gives the message that variables cannot be used with us delays when the clock rate is less than 20 MHz.
My program looks something like this:
#chip 12F675, 20
#config OSC=HS, MCLRE=OFF, WDT=OFF
DIR GPIO.0 out
dir gpio.1 in
set gpio.0 off
qx=20
start:
start1:
if gpio.1=0 then goto start1
set gpio.0 on
wait 4 us
set gpio.0 off
wait qx us
set gpio.0 on
wait 4 us
set gpio.0 off
qx=qx+1
if qx>255 then end
wait 5 s
goto start
So basically there are two output pulses of 4 us separated by a variable delay.
What I would like to be able to do is have the delay incremented by 0.5 us (or even 0.6 us - more feasible with a 20 MHz clock).
Would a delay loop work? How many instructions does a delay loop take?
> I've had no trouble telling it to compile for a 16F84A @ 100 MHz, an 18F2520 @ 90, or a
> 16F88 @ 50. Can someone post code that won't work?
If I do this is works fine (anything<40) : #chip 18F6722, 40
If I go anything over 40mhz: #chip 18F6722, 41 ( anything > 40)
I get :
Compile Error: Variable 551 if of type BYTE and does not have a bit 5854
So I assumed the .dat contained a value (somewhere?) to see the error if over the max mhz on the chip based on DS value for clk? I have the most current update.zip applied.
Eyy... very interesting.
I could have a blinking led in a 16f876a at 25, 28 and 32 MHz, any problem.
The only thing is that it does not work with the same 22pf capacitors that i used for 20 MHz, but with any capacitor it works OK. I think capacitors should be redimensioned to the new speed.
Really interesting.
>If you need more speed, use an 18F chip
The cuestion is: why using a 18f if you can run a 16f at 32 MHz??
I suppose that it could be problems running a pic16 at that speeds... but i don't know... i can understand that a 20 MHz rated pic could work at 25 MHz, this is a small difference, but 32 MHz is more than 50% above.
That compile error looks like it's related to one of the included libraries. Are you using rs232, A/D, or similar?
With the latest (9/8) update, this code:
xdly=1
wait xdly us
will now work on any chip speed. GCBASIC will show a warning when the delay will be inaccurate. For the delay to be correct, the clock speed needs to be 12 + 4x MHz, where x is a positive integer >= 0. This is due to the way that the delay routine works.