Osctune


Closed Thread
Results 1 to 36 of 36

Thread: Osctune

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Update:

    I found a spool with 500' of Belden 8444 (unshielded, not twisted, 22Ga 4 conductor). I put a sensor at one end and hooked it to my PIC test board. It didn't work.

    I lowered the Baud rate to 9600. It still didn't work. I lowered the pull-ups from 2.2K to 820 ohms. It worked perfectly! A scope showed the signals looked more than acceptable. This is driving directly from PIC pins.
    Charles Linquist

  2. #2
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Wow. Thats open-collector TTL, right? If you really needed more distance, you might try RS485. You can turn each driver off at the sensor when not transmitting, it's a great long-distance party line, and it likes 100-120 ohm hose.
    Last edited by circuitpro; - 1st October 2010 at 05:02.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    The sensor is capable of RS-485, both half and full-duplex, and I have used that before. The sensor board (0.25" wide X 1.9" long) has stuffing options that allow all sorts of protocols - I2C,RS232,RS-485.

    I have 8 or 10 different "Main" (or controller boards) already designed, any one of which that could control the sensor array. The particular feature set the customer wants, (SSH, SNMP, telnet, Real-Time Clock, Large event log) is on a board that doesn' t have an RS-485 chip. I don't want to design a new add on board at this time, so I'm going with the single-ended stuff. The customer will be using 30 sensors on 400' (total) of 4-wire cable. I think it will work!
    Charles Linquist

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Osctune

    18F2620 hserout baud rates off consistently.

    I'm using hserout to send data to a PC running the old plx-daq excel data acquisition macro/control.
    It's worked in the past but i haven't used it for a long time.

    I have cranked up my pic speed to 32mhz using the PLL etc and that's confirmed by the simple flashing 1hz led trick.

    I set the ESUART with data from PicMulticalc using 32mhz as osc speed.

    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 51 ' 38400 Baud @ 32MHz, 0.16%
    SPBRGH = 0
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator

    The pic is transmitting data correctly but when checked with my logic probe I can see the baud rate is off.

    At 38400 it is actually 40000
    At 19200 it is 20000
    At 9600 it is 10000

    Seems very consistent and perhaps the windows serial port can't tolerate this error?

    Do you thing this is a ESUART register setting problem or a wayward oscillator that needs OSCTUNE tweaking?
    Last edited by retepsnikrep; - 15th February 2017 at 08:54.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Osctune

    I have a bunch of boards, all on a RS485 bus, all running the same code, and ONE board had to have its baudrate tweaked because it was off (I don't remember if I tweaked OSCTUNE or BAUDCON) so I'm leaning towards the oscillator not being quite where it should be.

    Do you have another PIC of the same type to try with?

    To verify if it's the oscillator, try generating a pulse with a known width and measure it.

    /Henrik.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Osctune

    I tried another pic that produced exactly the same results

    The pic is transmitting data correctly but when checked with my logic probe I can see the baud rate is off.

    At 38400 it is actually 40000
    At 19200 it is 20000
    At 9600 it is 10000

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Osctune

    you're sending a start bit, 8 bits of data and a stop bit all encoded as one symbol ie 10 bits .
    @say 9600 symbols per sec that yields a bit time of 10.4uS.
    how and what are you measuring ?
    logic probe ? do you mean logic analyser
    have you left off the start or stop bit in your calcs ?
    10 bits @ 10.4uS /bit = 9600 baud
    9 bits @ 10.4uS /bit = 10000 baud
    Warning I'm not a teacher

Members who have read this thread : 0

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