Serial Baudrate 115200


Closed Thread
Results 1 to 36 of 36
  1. #1
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31

    Default Serial Baudrate 115200

    Hi all,
    Could anyone guide me about setting up the serial communication to 115200 baudrate?

    Thanks


    kblim

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


    Did you find this post helpful? Yes | No

    Default

    I use DEBUG & DEBUGIN. These commands produce much smaller code, and
    you can get higher data-rates like 19200 with a 4MHz osc.
    Code:
    DEFINE OSC 20
    DEFINE DEBUG_REG PORTC
    DEFINE DEBUGIN_REG PORTC
    DEFINE DEBUGIN_BIT 7
    DEFINE DEBUG_BIT 6 
    DEFINE DEBUG_MODE 0 '1 = Inverted, 0 = true
    DEFINE DEBUGIN_MODE 0
    DEFINE DEBUG_BAUD 19200
     
    X VAR BYTE[3]
     
    MAIN:
        DEBUGIN 6000,NoData,[WAIT("A"),str X\3]
        DEBUG "Received:  ",str X\3,13,10
        GOTO MAIN
     
    NoData:
        DEBUG "Nada",13,10
        GOTO Main
     
        END
    This example works with a max232 PIC-PC interface. If you need direct, then
    just change mode to inverted.
    Last edited by Bruce; - 25th July 2010 at 22:39. Reason: baud rate change to 19200 max
    Regards,

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

  3. #3
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Red face

    Hi Bruce,

    Just wonder how to use Serout2, Serin2 with 115200 baudrate.


    From the formula :int(1000000/baudrate)-20,

    if use 115200 i will have int(1000000/115200)-20 = -12


    Please help.


    kblim

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


    Did you find this post helpful? Yes | No

    Default

    If the baud rate calc doesn't work out to a positive number, then I'm pretty
    sure the data rate you need isn't supported by the command.
    Regards,

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

  5. #5
    seinfield's Avatar
    seinfield Guest


    Did you find this post helpful? Yes | No

    Default

    Use this:
    DEFINE HSER_SPBRG 21 'Configuración de velocidad de USART
    DEFINE HSER_TXSTA 36 'a 115200 baudios.

    Now you can use hserin and hserout at 115200 bauds

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


    Did you find this post helpful? Yes | No

    Default

    Yeah but in synchronous mode... and all that imply too
    Steve

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

  7. #7
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Default SerIn2 / SerOut2

    First of all thank you for all the kindness reply. However I still couldn't solve the problem. I think I must clearify something.

    Actually I would like to use the Serin2 and Serout2 command to do the asynchronising on any of the hardware pin.

    As I know the Hserout and Hserin only implemented on the certain hardware pins.


    The command of the SerOut2:
    SerOut2 ModemOut, ModemSpeed, ["ate0",13]

    Where the
    1. ModemOut = Pin to be used

    2. ModemSpeed = A number from the calculation Of
    [int(1000000/baudrate)-20]

    3. ["ate0",13] = any string to send out to the pin


    So I do not know the HSER setting will effect the SerOut2 and SerIn2 command or not.

    Please help.

  8. #8
    seinfield's Avatar
    seinfield Guest


    Did you find this post helpful? Yes | No

    Default

    The hserout instruction is for the hardware USART.

  9. #9
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    I know the hserout instruction is for the hardware USART, but how about the SerIn2 and Serout2 command.

    Do you guys use Serin2 and Serout2 command instead of hserout?

    What is the main difference between Serin2/Serout2 and hserout?

    How to set the 115200 baud rate for serin2/serout2 bcoz previously i was using these command to connect to a gsm module with 19200 baud rate?

    Thanks

  10. #10


    Did you find this post helpful? Yes | No

    Default

    Hi kblim,

    As far as I know, you can't use baud rates higher than 38400 baud (I think) with the ser-type commands.
    I'm sure you can't do 115200.
    This is because the ser-type commands use a "bit-banging" approach as opposed to the hser-type commands which use the built-in usart and generate less code.

    This was the first time that I heard that you can communicate at 115200 using debug though.
    What are the pros and cons of that anyhow, Bruce?

    Regards.
    ---> picnaut

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


    Did you find this post helpful? Yes | No

    Default

    The serin, serout type commands were originally designed to offer BASIC Stamp users similar commands. They all produce huge code when used because the command libraries have to cover so many various options to maintain Stamp compatibility.

    Debug/Debugin produce much smaller code, and offer the higher data-rates because the library routines are much smaller.

    Serin, serout commands can be used on any I/O-pins that support digital I/O. Data-rates & pins used can be changed on the fly. Debug/Debugin pins & data-rates are fixed with the DEFINE used to set them up, but offer much higher data-rates since the library routines are much smaller.

    If you need higher baud rates with slower osc speeds, then use Debug and Debugin if you can live with fixed rates & pins you can use.

    Of course you can use them all if needed, but I'll normally opt for the hardware USART or Debug/Debugin.
    Regards,

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

  12. #12
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Using Open Mode with Debug/DebugIn

    Hi all,
    Just wonder how to define the debug to communicate with the open mode when receiving serial data from other device. Using the open mode because need to share the data line with few PICs.
    It is possible to do Open mode for DebugIn, Non Open Mode for Debug?

    Kindly share your expectise.

    Thanks alot.

    Regards

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


    Did you find this post helpful? Yes | No

    Default

    There is one other possible unconventional solution... Set SERIN2/SEROUT2 to run at 11500 baud at 4MHz and then switch to 40MHz Oscillator (approipriate 18F PIC Series) WITHOUT telling PICBasic you've done so... everything works at x10 speed... so PAUSE 1000 will only give you 100mS instead of a Second. In theory it should work (I'd use 67 rather than 66 as the calculated Speed figure)...

  14. #14
    Join Date
    Jul 2005
    Location
    Selangor, Malaysia
    Posts
    31


    Did you find this post helpful? Yes | No

    Unhappy How to setup Debug in Open Mode Like SerialOut

    Hi all,
    I was previously using the SerOut2 to send data, but the data line was sharing by few PICs and I have used Open Mode.
    Recently porting my code by replacing SerOut2 with the Debug command to save same space. But later found out that there are no way to setup the Debug in the open mode.
    Please help! Is there neccessary to use Open mode to share the data? or the Debug doesn't need the Open mode even sharing the data line.

    Regards

  15. #15
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    I have an application where a PIC12F683 has to communicate with an external peripheral. I need SerIn/SerOut because the external device may be 4800 or 9600 bps.

    The PIC12F683 also needs to communicate with a PIC16F876A.

    Is there any advantage to using Debug/DebugIn for the PIC2PIC comms given that the PIC12F683 already uses SerIn/SerOut?

  16. #16
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    dhouston, Serin/out provide software type communications and can have the baudrate's and port's changed on the fly during program execution. Therefore the compiled code overhead is quite large, whereas Debigin/out commands after the compile are the smallest for software type usart emulation. The port and baudrate used for Debugin/out can not be changed during program execution therefor they must be DEFINE'd at the start of the source program. There are some other functions that are lost in the use of Debugin/out but for the most part it was designed for program debugging with a terminal. I have used Debugout for PIC micros that have no internal usart and still use it today for programming debug functions. The limitations of Debugin/out are covered in the manual. LOL

    Dave Purola,
    N8NTA

  17. #17
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Dave,

    I understand all of that.

    My question is, given that I have to use SerIn/SerOut for the external link, will I take another overhead hit if I also use it for the internal link or can I gain by using Debug for the internal link?

  18. #18
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    dhouston , If you are already using Serin/out on your program there is no need to add the extra code overhead in using Debugin/out unless you need the serial speed.

    Dave Purola,
    N8NTA

  19. #19
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Serial Baudrate 115200 using HSEROUT - how to?

    I'm having difficulties making my PIC's HSEROUT working at all. I need to get 115200bps.

    I can reach 38400bps with the SEROUT2 command without any trouble.

    For 115200bps, I go with HSEROUT. I use the MCS Serial Communicator and the PIC has a 20MHz crystal.

    SEROUT2 is okay, HSEROUT is not working at all (not even @1200bps).

    I've been trying to make it work for hours and hours, redoing the cabling (see picture) different ways as suggested in other threads, modifying the code also many times but no success until now. I just always get garbage on the serial terminal's screen.
    Code:
    ' SEROUT2
      
    ' PIC 16F690 Fuses
    @ __Config _FCMEN_OFF &_IESO_OFF &_BOR_OFF &_CPD_OFF &_CP_OFF &_MCLRE_OFF &_PWRTE_OFF &_WDT_OFF &_HS_OSC
     
    OPTION_REG = 000000 'PORT A&B Pull-Ups (look WPUA & WPUB)
    ADCON0     = 000000 'A/D Module
    ANSEL      = 000000 'Select analog inputs Channels 0 to 7
    ANSELH     = 000000 'Select analog inputs Channels 8 to 11
    INTCON     = 000000 'INTERRUPT Control
    'WPUA       = 000000 'Select PORTA weak pull-ups
    'IOCA       = 000000 'Interrupt On Change selection
    CM1CON0    = 000000 'Comparator1 Module
    CM2CON0    = 000000 'Comparator2 Module
    TRISA      = 000000 'Set Input/Output (0 to 5)
    PORTA      = 000000 'Ports High/Low (0 to 5)
    TRISB      = 000000 'Set Input/Output (4 to 7)
    PORTB      = 000000 'Ports High/Low (4 to 7)
    TRISC      = 000000 'Set Input/Output (0 to 7)
    PORTC      = 000000 'Ports High/Low (0 to 7)
     
    '-------------------------------------------------------------------------------
    ' DEFINEs
    DEFINE OSC 20
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
     
    '-------------------------------------------------------------------------------
    LED1    VAR PORTA.2
    Counter VAR WORD
    Counter = 0
     
    TEST:
      TOGGLE LED1
      'serout2 PORTB.7,16416,[dec counter,13,10]'19200 DIN with MAX232
      SEROUT2 PORTB.7,16390,[DEC Counter,13,10]'38400 DIN with MAX232
      PAUSE 500
      Counter = Counter + 1
      GOTO TEST
      
      END
    Code:
    ' HSEROUT
      
    ' PIC 16F690 Fuses
    @ __Config _FCMEN_OFF &_IESO_OFF &_BOR_OFF &_CPD_OFF &_CP_OFF &_MCLRE_OFF &_PWRTE_OFF &_WDT_OFF &_HS_OSC
     
    OPTION_REG = 000000 'PORT A&B Pull-Ups (look WPUA & WPUB)
    ADCON0     = 000000 'A/D Module
    ANSEL      = 000000 'Select analog inputs Channels 0 to 7
    ANSELH     = 000000 'Select analog inputs Channels 8 to 11
    INTCON     = 000000 'INTERRUPT Control
    'WPUA       = 000000 'Select PORTA weak pull-ups
    'IOCA       = 000000 'Interrupt On Change selection
    CM1CON0    = 000000 'Comparator1 Module
    CM2CON0    = 000000 'Comparator2 Module
    TRISA      = 000000 'Set Input/Output (0 to 5)
    PORTA      = 000000 'Ports High/Low (0 to 5)
    TRISB      = 000000 'Set Input/Output (4 to 7)
    PORTB      = 000000 'Ports High/Low (4 to 7)
    TRISC      = 000000 'Set Input/Output (0 to 7)
    PORTC      = 000000 'Ports High/Low (0 to 7)
     
    '-------------------------------------------------------------------------------
    ' DEFINEs
    DEFINE OSC 20
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 19200
    'DEFINE HSER_SPBRG 64
    DEFINE HSER_CLOERR 1
     
    '-------------------------------------------------------------------------------
    LED1    VAR PORTA.2
    Counter VAR WORD
    Counter = 0
     
    TEST:
      TOGGLE LED1
      HSEROUT [DEC Counter,13,10]
      PAUSE 500
      Counter = Counter + 1
      GOTO TEST
      
      END  

    There's a MAX232 close to the PIC making me think the lines are as short as possible. But is it enough on the hw side?
    Name:  SerialCom.jpg
Views: 1851
Size:  65.6 KB
    Last edited by flotulopex; - 16th October 2011 at 14:56.
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    Try changing

    DEFINE
    HSER_TXSTA 24h to

    DEFINE HSER_TXSTA 20h
    Charles Linquist

  21. #21
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    I tried this already: no success.

    Still looks like this:

    Name:  SerialCom1.jpg
Views: 1726
Size:  35.4 KB
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    I was referring to you trying to run 19200. That was what your code above referenced.

    If you want to run 115K baud -

    From Mr. E's Multi-Calc:

    RCSTA1 = $90 ' Enable serial port & continuous receive
    TXSTA1 = $24 ' Enable transmit, BRGH = 1
    SPBRG1 = 42 ' 115200 Baud @ 20MHz, 0.94%
    SPBRGH1 = 0
    BAUDCON1.3 = 1 ' Enable 16 bit baudrate generator

    Some of these might change if you are using a 16F part.

    You may have to remove the "1" after the register names if you are not using PBP 3
    Charles Linquist

  23. #23


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    if serout2 was inverted, HSER is not inverted. 16416 in table shows inverted.
    Last edited by amgen; - 16th October 2011 at 19:40.

  24. #24
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    Is there any way to set the DEBUG baud rate at runtime?

  25. #25
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200 using HSEROUT - how to?

    Quote Originally Posted by amgen
    if serout2 was inverted, HSER is not inverted. 16416 in table shows inverted.
    Sorry, I don't understand what you want me to do?! I don't have any problems with SEROUT2 at this time.


    Quote Originally Posted by Charles Linquis
    I was referring to you trying to run 19200...
    I did try this at all available baudrates; never worked. Before you ask, yes, I tried with another PIC

    I do use a PIC16F690 and modified the code with your suggestion as it is herunder:
    Code:
    ' HSEROUT
    
    ' PIC 16F690 Fuses
    @ __Config _FCMEN_OFF &_IESO_OFF &_BOR_OFF &_CPD_OFF &_CP_OFF &_MCLRE_OFF &_PWRTE_OFF &_WDT_OFF &_HS_OSC
    
    OPTION_REG = %10000000 'PORT A&B Pull-Ups (look WPUA & WPUB)
    ADCON0     = %00000000 'A/D Module
    ANSEL      = %00000000 'Select analog inputs Channels 0 to 7
    ANSELH     = %00000000 'Select analog inputs Channels 8 to 11
    INTCON     = %00000000 'INTERRUPT Control
    'WPUA       = %00000000 'Select PORTA weak pull-ups
    'IOCA       = %00000000 'Interrupt On Change selection
    CM1CON0    = %00000000 'Comparator1 Module
    CM2CON0    = %00000000 'Comparator2 Module
    TRISA      = %00000000 'Set Input/Output (0 to 5)
    PORTA      = %00000000 'Ports High/Low (0 to 5)
    TRISB      = %00000000 'Set Input/Output (4 to 7)
    PORTB      = %00000000 'Ports High/Low (4 to 7)
    TRISC      = %00000000 'Set Input/Output (0 to 7)
    PORTC      = %00000000 'Ports High/Low (0 to 7)
    
    '-------------------------------------------------------------------------------
    ' DEFINEs
    DEFINE OSC 20
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 42 ' 115200 Baud @ 20MHz, 0.94%
    BAUDCTL.3 = 1 'for PIC16F690 - BAUDCON1.3 = 1 ' Enable 16 bit baudrate generator 
    
    '-------------------------------------------------------------------------------
    LED1    var PORTA.2
    Counter var word
    Counter = 0
    
    TEST:
      Toggle led1
      HSEROUT [dec counter,13,10]
      pause 500
      Counter = counter + 1
      goto test
      
      end
    As said, I tried also the lowest selectable baudrate 300bps; even so, I can't see any "good" data in the terminal.
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200

    back to basic Roger... check your ANSEL(h) settings.. you're sending something on a analog configured pin.
    Steve

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

  27. #27


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200

    are you using a USB to serial converter ?

  28. #28
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Thumbs up Serial Baudrate 115200 using HSEROUT - how to?

    Quote Originally Posted by amgen View Post
    if serout2 was inverted, HSER is not inverted.
    Why didn't you SHOUT IT OUT LOUD!!??

    You're absolutely right: the signal has to be inverted in the way I'm using it. I added a transistor to invert the signal going to the MAX232 chip and guess what: IT WORKS!!!!

    The HSEROUT code example in one of my previous post is working fine, also with 115200bps.

    I still have some transmission errors but I think this can be due to the small error rate - I'll try with a 18,432MHz crystal.

    Thanks a lot and have a nice day.
    Roger

  29. #29
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Using a "non-DEFINE-listed" oscillator speed

    Hi there,

    I need to use a 18,432MHz crystal with this PIC16F690 project to achieve a clean 115200bps serial comm.

    Looking at the OSC values in the DEFINEs list, I can't find the value "18".

    Shall I simply define the OSC as, i.e., "20" while connecting a 18MHZ crystal?

    The only drawback I can see is about timing in PAUSE commands or similar. I assume the HUSART will still run from the 18MHz osc; right?

    Any other problems I wouldn't see?
    Roger

  30. #30


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    Why didn't you SHOUT IT OUT LOUD!!??
    I don't like to yell because I'm usually wrong.

    Just a few thoughts, the Max232 chip inverts signal, if your using USB to serial adapter, that takes a non-inverted signal, so you may be inverting redundently. Also, have you tried OSC-Tune to adjust clock to good 115Kb, then you can use standard Xtal ?

    Don

  31. #31
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    Yes, I do use a USB-to-serial interface (FTDI).

    I now corrected the BAUDCTL register so as it sends data inverted (no need for a hw inverter anymore).

    As far as I understand this register's function, OSCTUNE calibrates the internal oscillator so I don't think it will affect the baud rate generator (I don't know).

    BTW, how do I measure a "good" 115200bps signal?

    Code:
    ' HSEROUT
     
    ' PIC 16F690 Fuses
    @ __Config _FCMEN_OFF &_IESO_OFF &_BOR_OFF &_CPD_OFF &_CP_OFF &_MCLRE_OFF &_PWRTE_OFF &_WDT_OFF &_HS_OSC
     
    OPTION_REG = %10000000 'PORT A&B Pull-Ups (look WPUA & WPUB)
    ADCON0     = %00000000 'A/D Module
    ANSEL      = %00000000 'Select analog inputs Channels 0 to 7
    ANSELH     = %00000000 'Select analog inputs Channels 8 to 11
    INTCON     = %00000000 'INTERRUPT Control
    'WPUA       = %00000000 'Select PORTA weak pull-ups
    'IOCA       = %00000000 'Interrupt On Change selection
    CM1CON0    = %00000000 'Comparator1 Module
    CM2CON0    = %00000000 'Comparator2 Module
    TRISA      = %00000000 'Set Input/Output (0 to 5)
    PORTA      = %00000000 'Ports High/Low (0 to 5)
    TRISB      = %00000000 'Set Input/Output (4 to 7)
    PORTB      = %00000000 'Ports High/Low (4 to 7)
    TRISC      = %00000000 'Set Input/Output (0 to 7)
    PORTC      = %00000000 'Ports High/Low (0 to 7)
     
    '-------------------------------------------------------------------------------
    ' DEFINEs
    DEFINE OSC 20
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 42 ' 115200 Baud @ 20MHz, 0.94%
    BAUDCTL = 24 'Transmit INVERTED data to RB7, Enable 16 bit baudrate generator
     
     
    '-------------------------------------------------------------------------------
    LED1    var PORTA.2
    Counter var word
    Counter = 0
     
    TEST:
      Toggle led1
      HSEROUT [dec counter,13,10]
      pause 500
      Counter = counter + 1
      goto test
     
      end
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    The baud rate generator will be accurate. If the formula says you will get 115KBaud with a 20Mhz oscillator, you will.
    If you don't get 115K baud, then you aren't really running at 20Mhz, or the receiving device has an issue.

    I mentioned in another post how to measure just how fast your chip is running - without an oscilloscope.

    (Turn LED ON)
    For X = 1 to 60
    Pause 60000
    Next X
    (Turn LED OFF)

    Wait one hour. If your LED goes off in exactly 60 minutes, your chip is running the speed you think it is. Using a
    calculator, you can measure the actual frequency to about 0.1%

    A useful tool is BRAY's TERMINAL program (Google it). Free, and it lets you set odd baud rates, like 113Kbaud.
    or 120Kbaud.
    Charles Linquist

  33. #33
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    I need to use a 18,432MHz crystal...
    Looking at the OSC values in the DEFINEs list, I can't find the value "18".
    Shall I simply define the OSC as, i.e., "20" while connecting a 18MHZ crystal?
    Can anyone give some info about this please?
    Roger

  34. #34
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    I need to use a 18,432MHz crystal...
    Looking at the OSC values in the DEFINEs list, I can't find the value "18".
    Shall I simply define the OSC as, i.e., "20" while connecting a 18MHZ crystal?
    Does really nobody know something about that?
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: Using a "non-DEFINE-listed" oscillator speed

    You are going to have to unless you change the libraries. Just remember that any PAUSE commands will be 8.5% longer than you think.
    You can get around that by creating some variables.

    For example: If your program needed 3 different delays 20ms, 50ms, 190ms
    You would create 3 vars

    delay20 con 18
    delay50 con 46
    delay190 con 175

    Now, if you need a 20mSec delay, you can use the command

    PAUSE delay20

    It is not exact, but it is close.
    Charles Linquist

  36. #36
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Serial Baudrate 115200

    Thanks Charles,

    I thought this would happen. No problem then, for me ;-)
    Roger

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. 16f88 internal osc 8mhz max serial baudrate ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th December 2008, 23:27
  4. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  5. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35

Members who have read this thread : 2

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