SEROUT on 16F876A @ 3.2768 MHz 4MHz Defined


Closed Thread
Results 1 to 2 of 2
  1. #1
    brodin's Avatar
    brodin Guest

    Default SEROUT on 16F876A @ 3.2768 MHz 4MHz Defined

    I am thinking about changing the crystal i am using(4MHz) to a 3.2768MHz to get a timer work good. What will happen with my serial communication with pc (baud=2400) and my 4-bit LCD? Will they work. It doesn't seems like it is possible to define a 3.2768 MHz crystal in PBP, right?

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


    Did you find this post helpful? Yes | No

    Default

    Firstly the problem is you can't tell PBP about your 3.27MHz xtal. The closest define is OSC 3 (3.58MHz) which still gives you an error of 310kHz - or almost 10%.

    All commands with timing considerations will be shot. Your 4-bit LCD will probably work just fine but all your async comms will require recalculation for the baud rates in order to fool PBP into giving you the correct equivallent rate.

    If you tell PBP that you have a 4MHz xtal (the default) you should be able to use the formula in the manual to configure SERIN/SEROUT etc for say 2930 baud, which, if my maths is correct, would give you 2400 baud actual.

    How did I work that out?... 4MHz/3.2768MHz gives 1.220703125, which if you multiply by 2400 baud gives 2929.6875 or 2930 rounding to the nearest integer.

    Just remember everything will be out by a factor of 1.2207 and account for it by either dividing or multiplying accordingly, eg Pause 819 to pause for approx 1 second, instead of Pause 1000.

    Melanie

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 21:58
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 17:45
  3. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 17:46
  4. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 21:42
  5. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 21:33

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