PIC12F675, accuracy of baud rate with Internal Oscillator


Closed Thread
Results 1 to 4 of 4
  1. #1
    Chris Mayhew's Avatar
    Chris Mayhew Guest

    Default PIC12F675, accuracy of baud rate with Internal Oscillator

    Now that I have written this all up and checked my math I think I have worked out the answer myself but if someone would like to check my logic that would be appreciated....

    There has been a few threads about this general subject but the issue of reliability hasn't really been specified. I'm wondering how accurate the baud rate has to be in order to be reliable and if the internal Oscillator is really good enough. I know you can pad the baud rate as per this thread http://www.picbasic.co.uk/forum/showthread.php?t=1422 and I've done some tests along this line but:

    Does anyone have a rule of thumb with regard to the tolerance of the baud rate ?

    It would seem that a baud rate within a maximum of +/- 5% assuming the Oscillator was on target would be OK.

    Doing the math for the 12F675 it looks like the tolerance of the baud rate when using the internal calibrated Oscillator falls within the above +/- 5%

    I've found the following from using a SEROUT2 + FOR/NEXT loop to increment the baud rate (mode) and sending the data to my PC:

    Using a 16F628 with a 10 MHz xtal I could vary the baud rate mode number from 3142 to 3492 which works out to be about -5.2% to +5.4%

    Repeating the above with baud rate number from 767 to 857 gives about +/- 5% also

    Using a 16F628 with internal Oscillator Fosc/ 4 = 1.04183 MHz I could vary the baud rate from 799 to 901 (mode 813) which works out to about -1.7% to 10.2% or a similar tolerance to both the above, just spread differently due to the Oscillator running high.

    Using a 12F675 with the calibrated internal Oscillator running at 0.99128MHz I could vary the baud rate from 758 to 854 (mode 813) which works out to about -6.8% to +5% The data sheet says the Oscillator tolerance is +/- .08 MHz. If I take the Maximum frequency – 4.08 MHz / 4 = 1.02 MHz.

    Using the formula (1000000 / 1200)-20 = 813 and replacing the 1000000 gives: (1020000 / 1200) – 20 = 830 which falls with the 758 to 854 range, therefore using the internal, calibrated Oscillator in the 12F675 shouldn't be a problem ?

    I guess I could have just asked that question in the first place ......

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The internal oscillator is just not a good choice for anything timing cricital. It's an RC oscillator, and the frequency will change as temperature, humidity, and several other factors change.

    If you need reliable serial communications use an external oscillator.

    I have used various PIC's in serial applications with the internal osc, and it does work, but it's never been reliable under varying conditions with the internal RC oscillator.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Chris Mayhew's Avatar
    Chris Mayhew Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce
    The internal oscillator is just not a good choice for anything timing cricital. It's an RC oscillator, and the frequency will change as temperature, humidity, and several other factors change.

    If you need reliable serial communications use an external oscillator.

    I have used various PIC's in serial applications with the internal osc, and it does work, but it's never been reliable under varying conditions with the internal RC oscillator.
    Hi Bruce

    Thanks for your feedback.

    As I don't have enough I/O's to add an XTAL I think an alternative solution might be to reconfigure the hardware and use SHIFTOUT. I have looked, but can find any info that says it can't be done and since a PIC can send SEROUT direct over a cable (I'll be using about 2 metres) I'm assuming the same would apply to SHIFTOUT (putting in some current limiting resistors).

    Another alternative might be to use PULSOUT and COUNT but that could get a bit messy.....

    I should have also pointed out that I was intending to send 1 to 3 bytes of data every 10 to 15 seconds between 2 PIC's over about 2 metres of cable. One PIC would be potted and put into a water tank, while the other would be in free air. The one in free air would certainly be subject to wide temp changes. This would be even more of a reason NOT to use SEROUT2.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    by the amount of data you send, you can use a low baudrate, let's say 300 baud and should be fair enough with INTRC at almost any temperature.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  3. PIC18F4620 Using the Internal Oscillator
    By kiwipiper in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2007, 08:07
  4. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 16:48

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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