Serial Communication Problem


Results 1 to 24 of 24

Threaded View

  1. #5
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi!

    =============================================
    The PicBasic Pro SERIN2 command has an optional
    flow control pin. The SERIN2 command does this
    handshaking flow control on a byte by byte basis.
    Some computers may send several bytes before
    they even check the status of their handshaking lines.
    ==============================================


    The idea below does not use the flow control pin.

    Define first the data frames.

    START character
    The start character is present only one time in
    the data frame. (The first byte). If you use
    Notepad, the START character has to be printable.

    END character
    The end character is present only one time in
    the data frame. (The last byte). If you use
    Notepad, the END character has to be printable.

    DUMMY character(s)
    The DUMMY character is present one or more times
    in the data frame. The frame can have
    from 0 to 42 DUMMY characters.(See example below).
    If you use Notepad, the DUMMY characters need to
    be printable.

    DATA character(s)
    Any value except the values used for the
    START, END and DUMMY characters.
    The frame can have from 1 to 40 DATA
    characters. If you use Notepad, the DATA characters
    need to be printable.

    When you choose the character for START, END
    and DUMMY, choose characters that you will never
    use in the DATA characters. Maybe one day you
    will send DATA to an LCD display, so don't
    waste useful ASCII characters.

    * * *

    Example data frames in a Notepad file:

    S = Start character
    X = DATA character(s)
    E = END character
    D = DUMMY character(s)

    <START><DATA><DUMMY><END>

    The DUMMY character(s) is (are) used only if
    DATA is less than 40 bytes or if you need
    to send DUMMY data frames to the PIC.
    While the PC sends out the dummy data frames
    the PIC has time to do something else.
    (Remember we don't use any flow control).


    The following 5 lines are the Notepad file:

    SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE
    SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDE
    DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
    SXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE
    SXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE

    Where:

    The first line is a data frame with 40 bytes of data.
    The second line is a data frame with 39 bytes of data.
    The third line is a dummy frame.
    The fourth line is a data frame with 10 bytes of data.
    The fifth line is a data frame with 1 byte of data.

    * * * *

    At 9600 baud the PC sends 960 bytes per second.
    (Terminal 8N1, raw ASCII file send).

    The data frames are always 42 bytes long plus the
    two bytes that Notepad will put at the end of
    each line. (CR and LF).
    To send out 44 bytes the PC will need 46 ms
    at 9600 baud.

    * * *

    If the above idea is compatible with your design, I will
    help you with the PicBasic Pro code.


    Best regards,


    Luciano
    Last edited by Luciano; - 28th April 2005 at 19:45.

Similar Threads

  1. Replies: 18
    Last Post: - 4th July 2017, 14:26
  2. serial communication problem
    By kindaichi in forum Serial
    Replies: 13
    Last Post: - 11th March 2010, 16:37
  3. Replies: 5
    Last Post: - 20th March 2006, 01:34
  4. Problem in Serial Communication
    By uuq1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th June 2005, 07:17
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

Members who have read this thread : 2

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