Serial com with internal oscillator


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2007
    Posts
    24

    Default Serial com with internal oscillator

    Hi,
    Iam looking at using a 16F88 with an AD7730 and outputing the result in RS-232. I have read in other threads that the internal oscillator is not recommended for asynchronous serial. I have a few questions and would be very greatful if someone could help me with any of them.

    1. Is the problem that the ocsillator is unstable or can it be adjusted with the OSCTUNE register to work ok?

    2. It says on page1 of the datasheet that you don't need a crystal for RS-232. Is this not true?

    3. As the 16F88 only has 1 AUSART port is it better to use it for RS-232 or SSP.

    Thanks,

    Mike

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

    Default

    1. Is the problem that the ocsillator is unstable or can it be adjusted with the OSCTUNE register to work ok?

    it could be adjusted, but for any serial communication, i never trust any internal oscillator, i prefer to use a crystal instead. The internal will shift with temperature, gas price, wind direction and so on. Using a crystal allow to sleep really well all night


    2. It says on page1 of the datasheet that you don't need a crystal for RS-232. Is this not true?

    Not false, not true, this will depend of the environment and how lucky you are.


    3. As the 16F88 only has 1 AUSART port is it better to use it for RS-232 or SSP.

    It's two different animal, MSSP is used to interface I2C and/or SPI device, while USART is just plain serial communication, synchronous or not.
    Steve

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

  3. #3
    Join Date
    Jun 2007
    Posts
    24

    Default Still Unclear

    Hi Mister-e
    Thanks for the reply.

    My question with the AUSART is. I have to us SHIFTIN and SHIFTOUT to talk to the AD7730 and Serout2 to send the result to another Pic.

    Can I use Shiftout with RB1/SDO, RB2/SDI and RB4/SCK and SEROUT or HSEROUT with RB5/TX?

    If I did this would the TXSTA register have to be changed between transmissions or would it be better to use another pin?

  4. #4
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default

    I have spent days collectively trying to work with async comms and no xtal. I can get lucky, but for a customer app. I would always revert to a crystal Why not use SPI for both. Use one pin to select your other PIC, and one to select your peripheral.Or, if the peripheral is looking for a low to select, set your outlying PIC as an enable high, and use the same pin. Just make sure both external units go into high impedance when deselected. I did this with a video on screen display. The PIC generating the overlay could only grab a little info between frames. I used shiftin and shiftout with very reliable results. Async can be unreliable even with a crystal in noisy environs, but makes it easy to hook up to a PC or GPS engine, etc...

    Ron

  5. #5
    Join Date
    Jun 2007
    Posts
    24

    Default Thanks

    Hi Ron,

    I think this will be the solution for me. I will have to use an extra pin to select the AD7730 but then I have 2 extras from not using an xtal. I can't see whether it is high impedance when not selected from the Datasheet but will check in a breadboard to see. I'll have to learn to use a pic as a slave in SPI but hopefully that won't be too tricky.

    Thankyou both for your help. I'd be stumbling around in the dark without it.

    Thanks,

    Mike

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

    Default

    SPI or I2C, synchronous serial communication is really the way to go with an internal oscillator. If you're using SPI/I2C device, no harm to use the internal oscillator as it's a synchronous communication, but for RS232 asynch... this will cause you problem one day or another... unless you're really lucky!
    Steve

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

Similar Threads

  1. Pic16f882 internal oscillator
    By offlander in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th October 2009, 20:15
  2. Internal oscillator please help
    By timbash in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th February 2009, 14:11
  3. PIC18F4620 Using the Internal Oscillator
    By kiwipiper in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2007, 08:07
  4. How to use Internal Oscillator?
    By xobx in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th September 2007, 19:49
  5. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41

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