Serial data problem


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Serial data problem

    Hi. I have a loop which checks pir1.5 to see if any serial data is available. If it is then it loops to get it. Im inputting 18 characters at a time but the last few get missed off. Its random how many but always 1-3.

    To start with i would like to know is there a limit to how many characters can be stored in the buffer before it starts losing info?

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


    Did you find this post helpful? Yes | No

    Default

    Depending the way you implemented it, unless your Oscillator speed and/or baudrate settings are not right, i can't figure out what's wrong.

    EDIT: but i already experimented some weird stuff with cheap USB-to-Serial adapters...
    Steve

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

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Does it matter if there is a slight delay before i start getting data from the buffer?

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Silly question.

    Code:
                if rcsta.1=1 then
                    rcsta.4=0
                    rcsta.4=1
                endif
    Does that empty the buffer?

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


    Did you find this post helpful? Yes | No

    Default

    nope that clear the overrun error. If you want to clear the buffer, you need to read RCREG 'till RCIF flag is cleared.

    Code:
    TempVar Var Byte
    RCIF var PIR1.5
    
    WHILE RCIF 
        TempVar = RCREG
        WEND
    Steve

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

  6. #6
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Hmm. I am running that too but only once all the data i want has been received. I dunno.

    Ive uploaded the code. Sorry its so long and confusing.
    Attached Files Attached Files

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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