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 Still typing!

    Thanks guys. I have ruled out my programmer, crystal, etc. due to the fact that I can program and run Steve's USB demo program no problem. In fact what started all of this is that I tried to add a serial port connection to his program to see if I could extract data via the serial port, and put it out the USB port. I did copy and paste from Steve's Pic Multicalc program. If I set my OSC define to 20 Mhz, and set up the programmer for HS instead of HSPLL, I can get 38400 out, and if I insert a 16f877 into the same board I can get 38400 out. It's just when I set the OSC to 48 Mhz that I get the argument out of range warning. I'm using a MELABS Labxusb board, in fact I have two of them, and I have tried both. I'm using MELABS USB serial programmer, I have the latest patches installed from their website, I tried the USB programmer Beta version as well. I even tried installing all of the software on a different PC. What is weird is that I can burn Steve's USB demo ok, and I can do the USB mouse demo no problem, or like I said, I can drop down to 20Mhz ok. I'm still not ruling out my doing something stupid............

    Keep warm in Montreal and North Dakota. It's getting colder here in Pennsylvania, but Saint Patty's day is coming!

    Many thanks again,
    Jerry.

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

    Default

    it's not too cold in here, but we had 50-60 cm of snow since thursday night, and we're suppose to have 10-20 more tomorrow or tuesday Bah, could be worst!

    You have a strange problem, i've attach a working .HEX code: USART, 38400 Bauds, 20Mhz crystal, send string loop. nothing fancy.

    Now if you dump it directly to your PIC and it's not working... it's because of the Melabs Programmer. Obviously, if it's working, it's down to V2.46... which may explain this weird warning 202... who knows?
    Attached Files Attached Files
    Steve

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

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

    Default It's working!

    Steve,

    Como ca va? Tres bien! Forgive my spelling, but your hex file loaded and works perfectly! This means that I have my programmer etc. set correctly. Just two quick questions then; a) are you using PBP 2.47? b) would you please try adding this to your USB demo program and see what happens. I placed these right after the Define OSC 48 line.

    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 56 ' 38400 Baud @ -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator

    cren var rcsta.4
    hserout ["Yes we have no bananas!",13]

    When I take these lines back out the program compiles fine. The good news is that I've almost memorized the 18f4550 datasheet this weekend! I also tried adding this;
    asm
    mov w,1
    movlw spbrgh
    mov w,56
    movlw spbrg
    endasm
    right after the _config portion of the program, but no luck. I'm don't do assembler, but I read Myke Predko's book, and can follow along.

    Thanks again, and don't shovel too much snow!

    Jerry.

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

    Default

    Maybe I'm reading the PicMultiCalc wrong but...

    With BRGH = 1 (TXSTA = $24), and BRG16 = 1 (BAUDCON.3)

    Don't you need SPBRG = 312

    Attached Images Attached Images  
    DT

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

    Default

    Doh!, nevermind.

    Got confused with SPBR<G:H> notation.

    Lowbyte = 56
    Highbyte = 1

    DT

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

    Default

    Quote Originally Posted by b1arrk5 View Post
    Como ca va? Tres bien! Forgive my spelling,
    Ca va très bien you spelling is not that bad. Como=Comment
    but your hex file loaded and works perfectly! This means that I have my programmer etc. set correctly.
    Woooohooo!
    a) are you using PBP 2.47? b) would you please try adding this to your USB demo program and see what happens. I placed these right after the Define OSC 48 line.

    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 56 ' 38400 Baud @ -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator

    cren var rcsta.4
    hserout ["Yes we have no bananas!",13]
    Yes i use PBP 2.47, and your lines will work no problem.

    Thanks again, and don't shovel too much snow!
    i'll try


    EDIT: i'll change the PicMultiCalc display stuff.. it's really simple and i agree, it will be easier to read.
    Steve

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

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

    Smile Merci!

    I called MeLabs this morning as soon as they opened, ordered the upgrade, and they shipped it this afternoon. Thanks for all your help. I'm curious though that Darrel got it to compile ok with 2.46, but maybe it has to do with the temperature. I think you and I should go to California and investigate!
    Thanks to all of you for your kind assistance.

    Jerry.

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

    Default

    You're welcome. in meantime, i've did the promised change to the PicMultiCalc

    You can download it at the usual place
    http://www.mister-e.org/pages/utilitiespag.html
    Attached Images Attached Images  
    Steve

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

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

    Default

    b1arrk,

    It's good to have the upgrade.

    But for future reference, I'd still like to figure out what's going on. And I'm still not sure it will solve your problem.

    Can you go back to the .LST file again? Search for [202], and post the 5 or 6 lines following the error.

    DT

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  3. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  4. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 20:42
  5. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 20:33

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