SERIN2 freezes


Closed Thread
Results 1 to 8 of 8

Thread: SERIN2 freezes

  1. #1
    xnihilo's Avatar
    xnihilo Guest

    Default SERIN2 freezes

    Hello,

    Could someone help me out with serin2?

    serin2 portA.0,188,3000,toto,[WAIT("$GPRMC")]
    works
    serin2 portA.0,188,3000,toto,[WAIT("$GPRMC"), STR mystring\10]
    does not work (stays stuck in SERIN3

    Why is that? I though that it would wait for a string then collect next 10 bytes and store them in the mystring byte array but it doesn't... Why?

  2. #2
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default Crazy

    THIS does NOT work:

    Code:
    gps:
    LCDOUT $fe,1,"in GPS"
    LCDOUT $fe,$c0,"Serin start"
    PAUSE 2000 
    'SerIn2 PORTA.0,188,3000,toto,[Wait("$GPRMC,"),DEC2 b1,DEC2 b2]   'works
    SerIn2 PORTA.0,188,3000,toto,[wait("$GPRMC"),wait(","),DEC2 hh,DEC2 mm,wait(","),fix,wait(","),DEC2 latdeg,DEC2 latmin,wait(","),NS,wait(","),DEC3 londeg,DEC2 lonmin,wait(","),EO,wait(","),knots,wait("."),DEC2 knotsten,wait(","),DEC3 course,wait(","),DEC2 j,DEC2 m,DEC2 a]    'works
    LCDOUT $fe,1,"found"
    LCDOUT $fe,$c0,"="
    PAUSE 2000
    IF fix="V" Then display
    goto gps
    
    toto:
    LCDOUT $fe,1,"timeout"
    PAUSE 2000 
    GOTO gps
    
    display:
    LCDOUT $fe,1,"Data is:"
    PAUSE 2000
    goto gps
    While THIS works:

    Code:
    gps:
    LCDOUT $fe,1,"in GPS"
    LCDOUT $fe,$c0,"Serin start"
    PAUSE 2000 
    'SerIn2 PORTA.0,188,3000,toto,[Wait("$GPRMC,"),DEC2 b1,DEC2 b2]   'works
    SerIn2 PORTA.0,188,3000,toto,[wait("$GPRMC"),wait(","),DEC2 hh,DEC2 mm,wait(","),fix,wait(","),DEC2 latdeg,DEC2 latmin,wait(","),NS,wait(","),DEC3 londeg,DEC2 lonmin,wait(","),EO,wait(","),knots,wait("."),DEC2 knotsten,wait(","),DEC3 course,wait(","),DEC2 j,DEC2 m,DEC2 a]    'works
    LCDOUT $fe,1,"found"
    LCDOUT $fe,$c0,"="
    PAUSE 2000
    goto gps
    
    toto:
    LCDOUT $fe,1,"timeout"
    PAUSE 2000 
    GOTO gps
    WHY?

  3. #3
    Join Date
    Dec 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Hi xnihilo,

    I think the problem is about STR, i mean PBP doesn't work well (not a bit) with strings.
    But, i have the same problem, SERIN2 freezes when i add a timeout and label of delay. This code doesn't work:

    Code:
    '**
    '
    'Purpose: How many delays do i have?
    '
    '**
    myRX VAR PORTB.0
    
    myVar VAR BYTE
    data VAR BYTE
    
    CALL OnScreen
    
    loop:
    
            SERIN2 myRX,396,100,delay,[wait ("N"),data]
    
    GOTO loop
    
    delay:
            myVar=myVar+1
            CALL OnScreen 
    RETURN
    
    OnScreen:
          lcdout $fe,1
          lcdout #MyVar
    RETURN
    the code doesn't go to delay label.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by KaanInal View Post
    I think the problem is about STR, i mean PBP doesn't work well (not a bit) with strings.
    But, i have the same problem, SERIN2 freezes when i add a timeout and label of delay. This code doesn't work:
    Hmmm. Put the blame on the compiler when your code does not work?

    Maybe you need to look at the CALL section in the manual.
    And that RETURN right after that might not be helping either.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Dec 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Sorry for the misunderstanding it was not a blame, i love this compiler. I didn't find any string functions on my sources, if you knew some please tell me so i can change my sources with correct ones. It was an opinion.

    It was a part of my code but i don't understand what is wrong with the call? Should i use gosub? What do you suggest ?

    Also,
    there is an answer on this page: http://www.picbasic.co.uk/forum/show...highlight=idle

    xnihilo, is that solves your problem too?

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    No problems

    The PIC it's self is not really a string type setup, but PBP gives it a good shot by treating strings as an array. The STR modifier is for that. Yes, more string handling might be nice, or a different way of handling them... But we are so limited on memory the way it is with most PICs that it may be a shot in the foot.

    CALL -- that is for "CALLING" an ASM function.

    The TIME OUT/GOTO label is just that. a GOTO.
    So wherever you send things after a serial time out do not use a RETURN.
    Code:
    SERIN2 myRX,396,100,delay,[wait ("N"),data]
    
    GOTO loop
    
    delay:
            myVar=myVar+1
            CALL OnScreen 
    RETURN
    In the above case replace the RETURN with GOTO LOOP.
    Looks like that is what you want....
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Dec 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I got it .

    Thank you by the way, that explains the "CALL and RETURN overflow" problems on my simulations .

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Glad to bof soivice
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 09:47
  2. Getting SERIN2 to work?
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 22nd July 2009, 20:10
  3. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  4. SERIN2 digit parsing
    By skimask in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th January 2007, 23:15
  5. SEROUT2 and SERIN2 commands
    By bangunprayogi in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th August 2005, 09:03

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