Can't set 38400 baud @ 48Mhz


Results 1 to 39 of 39

Threaded View

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

    Default

    i suspect a asm math overflow, but can't reproduce it here... and... HSER_BAUD is not define so... i'm lost

    Even worst.. if does the same thing even by writing to the USART register ???

    what happen if you use only the CONFIG fuse, DEFINE OSC AND HSER DEFINEs?

    edit: OK only by writing to the REGISTER, you'll have this error once you add a HSEROUT line, but it fix the problem when you use the DEFINEs as generated by the PicMulticalc as bellow
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 56  ' 38400 Baud @ 48MHz, -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    So the DEFINEs have to be there IF you're using HSEROUT/HSERIN... just because PBP try to load HSER_SPBRG and everything else
    simple code
    Code:
    DEFINE OSC 48
    RCSTA = $90   ' Enable serial port & continuous receive
    TXSTA = $24   ' Enable transmit, BRGH = 1
    SPBRG = 56    ' 38400 Baud @ 48MHz, -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    
    HSEROUT ["HELLO"]
    and it's .LST around warning 202
    Code:
    Warning[202]: Argument out of range.  Least significant bits used.
    000018 0E38           07668         movlw   HSER_SPBRG
    00001A 6EAF           07669         movwf   SPBRG           ; Set baud rate generator reg
                          07670     ifdef HSER_SPBRGH
                          07671       ifdef SPBRGH
                          07672         movlw   HSER_SPBRGH
                          07673         movwf   SPBRGH          ; Set baud rate generator reg high
                          07674       endif
                          07675     endif
    00001C 0E20           07676         movlw   HSER_TXSTA
    00001E 6EAC           07677         movwf   TXSTA           ; Set transmit control reg
    000020 0E90           07678         movlw   HSER_RCSTA
    000022 6EAB           07679         movwf   RCSTA           ; Set receive control reg
    INTERESTING !!!! HSER_SPBRGH is not even listed in the new PBP manual!!!
    Last edited by mister_e; - 7th March 2007 at 04:49.
    Steve

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

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