28X2 odd but brilliant behavior.

fernando_g

Senior Member
I was playing with a 28X2 had to run quite fast, and therefore I decided to use an external 8Mhz resonator and use the setfreq EM32 function.

Upon debugging the circuit, I noticed that the code was running much slower.
Long story short, I had failed to solder the resonator! Soldering it and the code ran at its proper speed.

This piqued my curiosity and with another 28X2 repeated the experiment, simply toggling an output and measuring the output frequency, with the same result.
Experimenting with different setfreq values, I noticed that the resonator-less is identical to the default M8.

If this is a 28X2 feature, it is brilliant! Even in the case of crystal or a solder joint failure, the ability of the processor to continue running is very valuable indeed.
If so, it should be documented.
 

Goeytex

Senior Member
I imagine that that the hard coded Configuration is set to fall back to the internal oscillator if a resonator is not found. This would be the FCMEN bit in the Config1H register.

Setting this bit allows the Picaxe to use either the internal RC Oscillator or an External Resonator/ Crystal without having to change the "fuses". This is a feature of the PIC microcontroller and not Picaxe specific.

See the 18F25K22 Datasheet (Section 2) And Section 24.2
 
Last edited:

fernando_g

Senior Member
Thanks Tex for pointing me out in the proper direction.

I have read the 18F25K22 Datasheet a few times, but it contains so much information that is easy not to spot these operational details.

Anyways....I'm very glad that this feature is available.
 

Goeytex

Senior Member
Hi Fernando,

Yes, there is lots of information in PIC Datasheets. So much that it can be overwhelming.

This is one of the reasons that the Picaxe platform is so attractive to so many folks. There is generally no need to refer to or understand the Datasheets as Rev-Ed has done all of the hard work for us.

Recently I have been living in the PIC Datasheets as I have had to write PIC code in MPASM (Assembly Language) for several projects. It really makes me appreciate Picaxe Basic and other high level languages.
 
Top