​ ​ ​ ​ Automatic frequency calibration / finetuning of internal PICAXE resonators
Results 1 to 2 of 2

Thread: Automatic frequency calibration / finetuning of internal PICAXE resonators

  1. #1
    Senior Member
    Join Date
    Jan 1970
    Location
    Groningen, The Netherlands
    Posts
    467

    Default Automatic frequency calibration / finetuning of internal PICAXE resonators

    The two code snippets given here (for a master and a slave picaxe, connected to each other via a 1K or larger resistor) cause the slave node internal resonator frequency to get aligned with the master node. This is done in a loop in which the master node sends a number of pulses (using PULSOUT) of 10ms width and the slave node measures them with repeated PULSIN commands at CALIBFREQ 15, 14, 13 ... etc. until the same pulse length is found. The slave code then sends the corresponding final Calibfreq parameter to the PC using SERTXD (this parameter could then for example be noted on the back of the slave chip so that only a single CALIBFREQ command is needed in an application). The codes work on any picaxe type (new and old) and at any speed as long as the master and slave speeds are the same.

    Although in general with serial comms there is no need to do this type of calibration, sometimes early release chips have larger oscillator margins (for example early silicon PIC18F14K22 (20X2) a few years back), and thus a procedure like presented here can mitigate any potential problems associated with it and thus guarantee stable serial communication and - in general - better aligned execution timing.

    Best regards,
    Jurjen
    Attached Files Attached Files
    Last edited by kranenborg; 19-10-2011 at 09:10.

  2. #2
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,741

    Default

    That's an interesting idea. For even greater accuracy but with less flexibility of using any pins an option is to use HSEROUT and HSERIN as their timing is completely hardware based.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •