Serial inputting


Closed Thread
Results 1 to 3 of 3
  1. #1
    Peter987's Avatar
    Peter987 Guest

    Default Serial inputting

    Howdy
    Can anyone give me some examples please in more detailed depth regarding the MELabs Pic Compiler command serin.

    I have two 16F84 PICS communicating perfectly using one byte at a time, however I am in the dark as to how to use the command
    serin 1,N1200,b10,b11,b12,b13 to receive multiple bytes.

    How does the serin command know when the last byte is sent etc. What choices do I have?

    What do you do in the case of less bytes are transmitted than there are variables allocated for in the serin command?

    Some examples would be much appreciated.

    Many thanks in advance,
    Peter987

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Peter987 View Post
    Howdy
    Can anyone give me some examples please in more detailed depth regarding the MELabs Pic Compiler command serin.

    I have two 16F84 PICS communicating perfectly using one byte at a time, however I am in the dark as to how to use the command
    serin 1,N1200,b10,b11,b12,b13 to receive multiple bytes.

    How does the serin command know when the last byte is sent etc. What choices do I have?

    What do you do in the case of less bytes are transmitted than there are variables allocated for in the serin command?

    Some examples would be much appreciated.

    Many thanks in advance,
    Peter987
    ->How does the serin command know when the last byte is sent etc.
    Depends on what you mean by 'last byte'. If you mean the last byte in a block of data, well, that's all up to you, a counter, a stop character, knowing that there are always X numbers of bytes in a block of data, anything you want. If you mean the last byte in a serin command with 4 variables, then it's when the 4th variable gets received.

    ->What do you do in the case of less bytes are transmitted than there are variables allocated for in the serin command?
    Check out the 'timeout' option of the serin command as described in the PBP manual. Remember, serin, and PBP in general, are only as smart as you make them. If serin is written to get one byte, it's going to get one byte, if it's written to get 10 bytes, it's getting 10 bytes, unless you tell it to do something else, like timeout.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Peter987 View Post
    Howdy
    Can anyone give me some examples please in more detailed depth regarding the MELabs Pic Compiler command serin.
    Welcome on the forum Peter987. Well there's many code example in here, just type SERIN in the search engine. OK you'll have to spend few minutes/hours days, but you may found some interesting tips as well.

    I have two 16F84 PICS communicating perfectly using one byte at a time, however I am in the dark as to how to use the command
    serin 1,N1200,b10,b11,b12,b13 to receive multiple bytes.

    How does the serin command know when the last byte is sent etc.
    Well, serin will receive one byte at the time and will finish once B13 is received... even if it take 1 mSec, 1minute or 1 Hour to have it.

    What choices do I have?
    It always depend of what else you PIC will do, and what you need to do with those data... tell us more... don't be afraid, you won't break your keyboard by typing more infos

    What do you do in the case of less bytes are transmitted than there are variables allocated for in the serin command?
    usually, i will cry or find a solution

    As Skimask said, the Timeout option may work.

    If it was me, i would choose another PIC with a USART for that... it open a wide range of better option than using a Timeout label.
    Steve

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

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  4. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35
  5. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46

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