serin and serin2


Closed Thread
Results 1 to 5 of 5
  1. #1
    rastan's Avatar
    rastan Guest

    Question serin and serin2

    ive just managed to sucessfully use the sein command but i noticed that the pbp manual specifically said that only one character can be used. does this mean that to send a string of information i would have to send letter after letter or is there some sort of modifier that i dont know about.
    if this is the case would it be easier to use the serin2 command?

    thanks

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


    Did you find this post helpful? Yes | No

    Talking

    you talk about two different things here! BTW...

    Yes you can receive only one character at a time... every character is a byte, one variable then. So in this case you have to place every character in a array or EEPROM (As you wish).

    BUT

    you can send almost everything. A string will be send in one shot when using SEROUT statement.
    Steve

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

  3. #3
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    ok how would i go about puttin the information into the array. theres nothing about it in the manual.

    cheers.
    phil

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


    Did you find this post helpful? Yes | No

    Default

    well the easiest solution is to do a simple loop and waiting of an EOT, CR,LF or else to finish storing into ARRAY. i'll assume a 8 element array here.
    Code:
    SerialDataIn VAR BYTE
    MyArray VAR BYTE[8]
    Looping VAR BYTE
    
    CR con 13
    Looping = 0
    
    start:
    while (Looping<8) and (SerialDataIn != CR)
         serin serpin,baudrate,SerialDataIn
         if SerialDataIn != CR then
              MyArray[Looping] = SerialDataIn
              Looping = Looping +1
         endif
    wend
    Steve

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

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Phil, If you use the SERIN2 command you can load an entire array with a single line of code. Here is a line that would work for you:

    MyArray VAR BYTE[8]

    CR con 13

    start:
    SERIN2 serpin,baudrate,[STR MyArray\8\CR]

    This line of code will fill the array with no more than 8 received characters or as many characters until it reaches a cariage return.

    It's all in the manual......

    HTH,
    Dave Purola,

Similar Threads

  1. Serin to Serin2 ??
    By Gixxer in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th January 2008, 03:56
  2. Serin vs Serin2
    By The Master in forum mel PIC BASIC
    Replies: 12
    Last Post: - 19th October 2007, 16:50
  3. serin and serin2??? need to understand
    By tkly36 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th April 2006, 05:13
  4. Serin / Serin2 / Debugin Differences
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th January 2006, 06:32
  5. SERIN SERIN2 Timeout
    By markedwards in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd June 2005, 18:59

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