HSerin problems on power up


Closed Thread
Results 1 to 9 of 9

Hybrid View

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

    Default

    If there's HSERIN/HSEROUT, you should use DEFINEs, unless you just need to write the USART registers.

    Code:
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler     RX_INT,     _GetData,   PBP,  no
    You want to reset flags, unless, your program will loop in the ISR forever.

    I haven't look the whole thing, but those are the really first thing that jump in my face.
    Steve

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

  2. #2
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default

    Thanks, I'll give the reset flags a try latter. I can't use defines as the baud rate needs to be user configurable in the field.

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

    Default

    Yes you can do it, you define one at the top, then you change it later on the fly by writing SPBRG, RCSTA, TXSTA. Check the datasheet for the recommended sequence.
    Steve

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

  4. #4
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default

    I finally had a chance to try out your suggestions by putting the defines at the beginning of the program and trying to reset the flag, but I have the same result of garbage in on the first transmission, then clear after that. Any other ideas would be appreciated.

    David

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

    Default

    It may happen if your transmitter use SEROUT/SEROUT2/DEBUG and the pin idle state is not set before sending the first data.

    Post your both code, receiver and transmitter end.
    Steve

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

  6. #6
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default

    I use a VB program not a pic as the transmitter. I can leave the program running while the pic is powered down. I give the pic a few seconds stabilization time after power up before the next transmission is sent

    David

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

    Default

    Ok then, modify your VB program to send few garbage character, then a Synch String (let's say OK), and in your ISR use WAIT("OK") . See if this solve your problem.
    Steve

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

Similar Threads

  1. Power problems
    By menta in forum General
    Replies: 50
    Last Post: - 30th July 2008, 23:55
  2. HSERIN and HSEROUT problems
    By amindzo in forum Serial
    Replies: 1
    Last Post: - 6th September 2006, 22:11
  3. HSERIN and HSEROUT problems
    By amindzo in forum General
    Replies: 2
    Last Post: - 31st August 2006, 07:51
  4. problems on power up of PIC
    By dmairspotter in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th June 2006, 15:11
  5. hserin problems
    By HELDERFERRAZ in forum Serial
    Replies: 0
    Last Post: - 11th February 2006, 00:41

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