Resonator Confusions...

ChedderCheeser

Senior Member
hi all. I am going to be working with a icaxe 40X2 and a 4Mhz resonator. I am confused on this though... do I need any extra code to get the maximum speed out of it or... does it just.. automatically do it?
 

nick12ab

Senior Member
I am going to be working with a icaxe 40X2
You mean PICAXE-40X2
and a 4Mhz resonator.
Internal or external? I'll assume external
I am confused on this though... do I need any extra code to get the maximum speed out of it or... does it just.. automatically do it?
You need to use the SETFREQ command to use anything other than the internal 8MHz oscillator although unfortunately it will automatically go back to 8MHz if there's a problem with the external resonator (which is a pain on battery supplies or ones with big capacitors). the PICAXE-40X2 has an option for an internal oscillator at 16MHz so unless you need the extra timing accuracy offered by an external one, I suggest you use the internal one.
  • For internal 16MHz, use 'SETFREQ M16'
  • For external 16MHz using a 4MHz resonator and 4xPLL, use 'SETFREQ EM16'
  • For external 4MHz on a 4MHz resonator, use the same as above but then disable the PLL (see PLLEN bit in OSCTUNE register)
 
A supplementary question relating to external resonators/crystals ad PICAXE 40X2 chips:
The manual says if you use an external resonator then it must be for a quarter of the desired operating frequency. Does this mean that the only way to get say 32MHz operation is with an 8MHz external resonator ? And with an 8MHz external resonator you can get 32 MHz operation, and [as well as neglecting frequencies for the external resonator is not absolutely required (ie, k31, k250, k500,m1, m2, m4, m8, m16)], the only other frequency control you can have is at 8MHZ with the external resonator described by nickab12 above ?

I am sorry this so clumsily phrased: with an 8MHz resonator and a 40X2 PICAXE the only frequencies that you can get tht are controlled by the resonator are 8MHz and 32 MHz ? Is this correct ?

AB
28.July.2011
 

eclectic

Moderator
Cake and eat it.

32 MHz (8 * 4 resonator controlled)

AND
all the
internally controlled speeds.

See "Setfreq" in Manual 2

e
 
Top