Synchronous USART problems... HELP!!!


Closed Thread
Results 1 to 8 of 8
  1. #1
    moni's Avatar
    moni Guest

    Default Synchronous USART problems... HELP!!!

    Hi Folks,

    I have looked and nobody seems to ever approached the Synchronous high speed issue, so here's a little challange:

    I am trying to transmit a string SYNCHRONOUSLY using HSEROUT with no luck.

    after reading MicroChip's docs, it seems that the SPEN,SYNC and CSRC bits must be set, so I tried:

    DEFINE HSER_SPBRG 59 ' BAUD RATE = 83.333 KBAUD
    DEFINE HSER_RCSTA 20h '
    DEFINE HSER_TXSTA 90h ' sets CSRC and SYNC bits
    DEFINE HSER_CLROERR 1 ' just in case of overflow

    and then some hserout commands like this one:
    HSerout [$11,$12,$13,$23,$34,$43,$81,$13,$3A]

    right after that I had a LCDout command for debugging purposes.

    THE PROGRAM NEVER GOT TO THE LCDOUT PART!!! nothing happend. no serial output, no clock, nothing!
    so I started REM'ing out the defines one by one. the problem was the DEFINE HSER_TXSTA 90h. I have changed it to 20h just to be sure,
    and of course it worked, but Asynchronously.

    Am I doing something wrong or HSERout is limited to Async???

    Please show me the light!

    Thanks

    M.M.
    New York

  2. #2
    moni's Avatar
    moni Guest


    Did you find this post helpful? Yes | No

    Default Forget to mention...

    PS I am using a 20mhz xtal, the pic is a 16F628 on a LAB-X3 board, and yes, the baud rate is 83.3333 kbaud, which is a can-bus sub-standard.

    tnx!

    M.M.

  3. #3
    Join Date
    Oct 2003
    Location
    Cyprus
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Synchronous USART problems... HELP!!!

    Hi,
    First, you must include a DEFINE OSC 20 .
    Second, the line HSerout [$11,$12,$13,$23,$34,$43,$81,$13,$3A]
    I thing does not work like this, put
    HSerout ["11121323344381133A"] instead.

    Regards
    Kypros

  4. #4
    moni's Avatar
    moni Guest


    Did you find this post helpful? Yes | No

    Default

    Kypros,

    Tnx for the reply, but I do have DEFINE OSC 20.


    and there is no problem using
    HSerout [$11,$12,$13,$23,$34,$43,$81,$13,$3A]

    it's a standard hex serial out format (look at the PBP manual)

  5. #5
    electronicsuk's Avatar
    electronicsuk Guest


    Did you find this post helpful? Yes | No

    Default

    Possibly you're causing an overflow error? Although I don't see why that would halt the program.

    Matthew
    Last edited by electronicsuk; - 6th November 2003 at 07:40.

  6. #6
    johnramsbottom's Avatar
    johnramsbottom Guest


    Did you find this post helpful? Yes | No

    Default

    Moni, I'm not sure which PIC you're using. I'm used to using the USART on the 16F7XX series but I don't think the associated registers differ much. Are you setting TXEN? This is bit 5 in TXSTA register. You could just put a hex value of B0h into TXSTA (to set CSRC and SYNC also). Also your value of 20h for TXREG seems a bit odd. Surely you need 80h in RCSTA.

    Hope you get somewhere.

    John R

  7. #7
    johnramsbottom's Avatar
    johnramsbottom Guest


    Did you find this post helpful? Yes | No

    Default

    Sorry, I meant to say RXSTA and not TXREG, but you probably realised. I'm confusing the issue!

    John R

  8. #8
    johnramsbottom's Avatar
    johnramsbottom Guest


    Did you find this post helpful? Yes | No

    Default

    Sorry I 'm still wrong. I meant RCSTA and not TXREG in my original reply.

Similar Threads

  1. My USART problems..
    By Glenn in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 31st July 2009, 01:00
  2. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  3. USART TXREG Problems
    By BigH in forum Serial
    Replies: 2
    Last Post: - 11th January 2006, 00:30
  4. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 21:45
  5. Replies: 5
    Last Post: - 1st December 2004, 12:49

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