16F777 at 115200 baud


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53

    Default 16F777 at 115200 baud

    I am trying to get a 16F777 with a 20MHz external oscillator running at 115200 baud. There is no parity and it is true. My math for those conditions gives me -11.

    I need to use the hardware serial port for something else and need to use SEROUT2.

    What should the mode actually be when a negative number is calculated?

    Thanks
    Last edited by cpayne; - 22nd March 2011 at 20:18. Reason: Fixed Typo

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    I don't use SERIN/SEROUT very often, but I think you should read the formula as :
    ((Fosc/4)/Bauds)-20 so, since you are using a 20 MHz external oscillator you should end up with 23. Try it and post the result, so I can verify if my understanding is correct.

    Cheers

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    the forumula they have in the maual is (1000000/baud)-20, which results in -11. I tried 23 with no luck, or atlest the motor controller I was communicating with acts dumb. works fine with hyperterminal 8N1, 115k no flow control

  4. #4
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Unhappy Re: 16F777 at 115200 baud

    this is what i come up with the varrious values to set the baud value
    No Parity, True Parity, True No Parity, Inverted Parity, Inverted
    115200 -11 8181 16373 24565


    I have tried all the values, except -11, which is what i need I am pretty sure...

    HSEROUT ["!M ", dec Motor_Val_R," ", dec Motor_Val_L, 13]'command motors ***THIS WORKS!!!!!!

    SEROUT2 portB.4, 23, ["!M ", dec Motor_Val_R," ", dec Motor_Val_L, 13]'command motors, this does not....

    I am snooping the packages, there is nothing when i run the serout2 line. the hserout2 works fine and looks fine on hyperterminal with the snooping...

    Any ideas, Unfortunatly I can not change the baud rate of the motor controller to something slower... Have to get 115k working and i can't use the hardware port for the final configuration...

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


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    You will not be able to run serout at more than about 19.2K baud with a 20Mhz Xtal

    But, you MAY be able use DEBUGOUT at that rate. I have done it at 40Mhz on an 18F part.
    Charles Linquist

  6. #6


    Did you find this post helpful? Yes | No

    Default PIC at 115200 baud

    I routinely run 115,200 on a PIC18F4620 at 20 MHz.
    Works a treat. I always set char_pacing to 20 or more to give some more time for the receiving side to process the character.

    HTH
    BrianT

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    The forumula they have in the maual is (1000000/baud)-20, which results in -11.
    As Al pointed out (but didn't really spell out) the 1000000 comes from Fosc/4 and since you're running at 20MHz the formula becomes (5000000/115200) - 20 = 23. I don't know if 115200 "should" work at 20MHz but if you can't get it going try DEBUG instead.

    /Henrik.

  8. #8
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    Thanks for all the help. I understand fosc/4, but i am not sure Serout2 or serin2 uses that. I define the osc speed up top. I have to use 10000000 to get 19200 or 38400 to work with no issue. the debug may work for outgoing, but eventually i will need incoming... I am currently laying out another board with a 2 UART chip since hserin and hserout work fine at 115k and a 20mhz osc, but i would really prefer to use my existing chip.

    -Charlie

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    OK, you're probably correct then, sounds a bit strange though.... Anyway, if DEBUG does indeed work for the output then DEBUGIN will most likely work for the input - as long as you don't need to change pin or baudrate at runtime.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: 16F777 at 115200 baud

    Debug is much more "light weight", since the parameters are calculated at compile time, not every time the routine is called.

    It works fast in both directions.
    Charles Linquist

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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