Can't set 38400 baud @ 48Mhz


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Wink Solution!

    Hi guys,

    After speaking with the nice folks at MeLabs I have the following explanation, the warning is due to the fact that PicBasic defaults to 2400 baud, and I had the oscillator set to 48Mhz, which it can't do with the high speed baud generator register set. I was close, I could get it to compile without the warning, but the baudrate wasn't right. The following code works perfectly now;

    BAUDCON.3 = 1 'SETUP FOR HIGH SPEED.
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H 'HIGH SPEED MODE BAUD RATE GENERATOR
    DEFINE HSER_BAUD 38400
    DEFINE HSER_SPBRG 38H '38400 BAUD *** THIS WORKS! ***
    DEFINE HSER_SPBRGH 01H

    Thanks,

    Jerry.

    Thanks for all your help!
    If your oscilloscope costs more than your car...

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Isn't that what Steve and I said in Post #24 and 23?

    DT

  3. #3
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Smile Exactly!

    I'm sorry, I should have made it more clear, that was why I posted the 'solution,' so that you and Steve would know that you were indeed right! More importantly, you guys were available and willing to help out on the weekend, which is when I have uninterrupted time to work, as opposed to during the week when the phone rings incessantly. Have a great weekend!

    Jerry.
    If your oscilloscope costs more than your car...

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Oh, woops. Now I get it.

    Woohoo.

    DT

  5. #5

    Default

    Hi there
    Can someone please help i am trying to upgrage one of my projects to a 18F4550 but it is turning into a nigtmare, for some reason i can not get my serial port to work
    Any help would be appreciated

    ps I have downloaded the patch for 2.46 but it seems not to help

    my 18F4550.inc file
    Code:
      NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F4550, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F4550.INC"	; MPASM  Header
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L  
    	__CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H 
    	__CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
    	__CONFIG    _CONFIG2H, _WDT_OFF_2H 
    	__CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
    	__CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L 
           
            
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	32
    And my setup i am running a 48M cristal
    Code:
    '*Serial port Setup 3800 8N1*
    BAUDCON.3 = 1 'SETUP FOR HIGH SPEED.
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H 'HIGH SPEED MODE BAUD RATE GENERATOR
    DEFINE HSER_BAUD 38400
    DEFINE HSER_SPBRG 77 ' 38400 Bauds
    DEFINE HSER_CLROERR 1

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    And my setup i am running a 48M cristal
    Ummm, you mean you are running a 20mhz crystal, with DEFINE OSC 48?

    I Hope.

    DT

  7. #7

    Default

    No, 48M cristal with define osc 48

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. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 03:17
  3. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 15:31
  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