SERIN2/SEROUT2 - first data received is always garbage


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: SERIN2/SEROUT2 - first data received is always garbage

    Because the idle state of the serial line, for the mode you've selected, is high and you're driving the pin low when the PIC starts up. When the receiver sees that low it Thinks its the startbit and starts to shift in data which you aren't actually sending. That's the garbage you get. This happens BEFORE the execution of the SEROUT command which will THEN set it up properly for you.

    If you, in your "startup code" set the pin you're going to use as the serial out pin high and then set it to output (as Ioannis showed) then the "line" idles at the correct state and the receiver isn't "triggered" until the SEROUT command actually exectutes.

    Another (IMHO better) option is to NOT clear the TRIS bit for that particular pin.
    That way it'll remain in high impedance mode until the SEROUT command actually executes - and it will set the pin to output AND set the idle state properly based on the MODE you select.

    /Henrik.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Thumbs up SERIN2/SEROUT2 - first data received is always garbage

    Thanks a lot
    Roger

Similar Threads

  1. '[HD44780] Controller received data whist busy' error while simulating
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th February 2014, 09:54
  2. Replies: 2
    Last Post: - 15th December 2012, 01:19
  3. display received data
    By NURULHAIZA in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th May 2010, 06:03
  4. serin2/serout2
    By tazntex in forum Serial
    Replies: 14
    Last Post: - 19th September 2008, 22:01
  5. Serin2/ Serout2
    By Armadus in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th June 2008, 00:02

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