Serin Question


Closed Thread
Results 1 to 4 of 4

Thread: Serin Question

  1. #1
    eoasap's Avatar
    eoasap Guest

    Default Serin Question

    can i do this? no matter what i try i always get the error >> Expected ']'

    SERIN2 GPS_TXA, GBAUD, [WAIT("$GPRMC"),skip 1, str HOUR\2, str MINUTE\2, str SEC\2, skip 1, STAT,skip 1, str LATDEG\2,str LATM\2,skip 1, str LATS\2, skip 1, LATHEAD, skip 1, str LONGD\3, str LONGM\2, skip 1, str LONGS\2, skip 1, LONGH, skip 1, str SP_Knots\5,skip 1, str Heading\5,skip 1, str DATED\2,skip 1, str DATEM\2, Month\2, skip 1, str DATEY\2]

    the variables i'm reading to are all defined as bytes (or an ay of bytes depending)
    Last edited by eoasap; - 11th February 2006 at 02:39.

  2. #2
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    as a temporary fix i can do this, but is it possible to lose data during the command execution time? (baud rate is 4800, xtal is 15Mhz)

    SERIN2 GPS_TXA, GBAUD, [WAIT("$GPRMC"),skip 1, str HOUR\2, str MINUTE\2, str SEC\2]
    SERIN2 GPS_TXA, GBAUD, [skip 5, STAT,skip 1, str LATDEG\2,str LATM\2,skip 1, str LATS\4]
    SERIN2 GPS_TXA, GBAUD, [skip 1, LATHEAD, skip 1,str LONGD\3, str LONGM\2, skip 1]
    SERIN2 GPS_TXA, GBAUD, [str LONGS\4, skip 1, LONGH, skip 1, str SP_Knots\5, skip 1]
    SERIN2 GPS_TXA, GBAUD, [str Heading\5,skip 1, str DATED\2,skip 1, str DATEM\2]
    SERIN2 GPS_TXA, GBAUD, [skip 1, str DATEY\2]

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default Line is tooooo loooooong !!!

    Quoting from the PBP manual....

    4.14. Line-extension Character

    The maximum number of characters that may appear on one PBP line is 256. Longer statements may be extended to the next line using the line-extension character (_) at the end of each line to be continued.

    Branch B0,[label0,label1,label2,_
    label3,label4]


    Your example is 352 characters so it never sees the closing bracket.

    I dont think there is any difference in execution speed between a statement with say 5 variable and 5 statements with a single variable.

    eg.

    lcdout "hello"

    lcdout "h"
    lcdout "e"
    lcdout "l"
    lcdout "l"
    lcdout "o"

    generates the following extract from the assembler

    LCDOUT?C 068h h
    LCDOUT?C 065h e
    LCDOUT?C 06Ch l
    LCDOUT?C 06Ch l
    LCDOUT?C 06Fh o
    LCDOUT?C 068h h
    LCDOUT?C 065h e
    LCDOUT?C 06Ch l
    LCDOUT?C 06Ch l
    LCDOUT?C 06Fh o

    Obviously in the above example it is a lot easier to enter "hello" than 5 separate lines. Using either the single statement or the 5 statements the code compiled to 123 bytes. Using both it was 138 bytes.

    Using your code, I personally find the second "temporary fix" verison to be far more readable and it would be even easier with just "one chunk of data" per statement line.

    That way you would also be able to add comments to each line to say what you are receiving and skipping so that when you come back to your code in a few months time you can instantly tell what you were thinking when you wrote it
    Keith

    www.diyha.co.uk
    www.kat5.tv

  4. #4
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    Keith, thanks for such a quick answer on my question. i actually prefer the second (working) method, but i was just afraid of dropping bytes. great to know that's not the case though!

Similar Threads

  1. serin question?
    By sachymo in forum General
    Replies: 5
    Last Post: - 27th July 2008, 10:04
  2. Simple question about Serin..
    By Donat in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th March 2008, 16:26
  3. serin string question
    By Sam in forum Serial
    Replies: 11
    Last Post: - 2nd December 2006, 21:29
  4. Serin question
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2006, 23:39
  5. 16f872. config ports and serin question.
    By kitcat in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th July 2005, 03:03

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