subroutine with hserin


Closed Thread
Results 1 to 7 of 7

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Is it possible to see the whole program?

    Usually for each GOSUB, there's a RETURN

    Code:
    Start:
            Gosub Somewhere
            Gosub Elsewhere
            goto Start
            
    Somewhere:
            HSERIN 2000, SomeWhereElse,[DataXYZ]
            Return
            
    SomewhereElse:
            ToGGLE LED
            RETURN
            
    ElseWhere:
            LCDOUT $FE,1,"Are AZERTY Keyboards still on the market???"
            RETURN
    In Somewhere, if a timeout occure, it jump to SomewhereElse. This is basically a GOTO, BUT you need to use a RETURN to return to Start... or use a variant like...
    Code:
    Somewhere:
            HSERIN 2000, SomeWhereElse,[DataXYZ]
    
    SomewhereEnd:        
            Return
            
    SomewhereElse:
            ToGGLE LED
            Goto SomewhereEnd
    HTH
    Steve

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

  2. #2
    Join Date
    Oct 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Ok

    Thanks for the explanations

    Best regards

  3. #3
    Join Date
    Oct 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post

    Code:
    Start:
            Gosub Somewhere
            Gosub Elsewhere
            goto Start
            
    Somewhere:
            HSERIN 2000, SomeWhereElse,[DataXYZ]
            Return
            
    SomewhereElse:
            ToGGLE LED
            RETURN
            
    ElseWhere:
            LCDOUT $FE,1,"Are AZERTY Keyboards still on the market???"
            RETURN

    Somewhere:
    HSERIN 2000, SomeWhereElse,[DataXYZ]

    SomewhereEnd:
    Return

    SomewhereElse:
    ToGGLE LED
    Goto SomewhereEnd
    [/code]

    HTH

    Then i can use two examples? The compiler detects if it is a routine principal or if it is a subroutine?

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


    Did you find this post helpful? Yes | No

    Default

    Both example have to work. Once it hit a RETURN, it remove 1 from the stack level and jump one instruction bellow the last calling GOSUB.
    Steve

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

Similar Threads

  1. Hserin with Instant Interrupts.
    By ronjodu in forum Serial
    Replies: 17
    Last Post: - 30th December 2014, 20:17
  2. timeout of Hserin, goto, gosub or both?
    By flipper_md in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th October 2009, 18:43
  3. 16F877a Interupt driven Hserin
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd November 2006, 00:38
  4. Hserin not working...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd August 2005, 12:25
  5. Hserin
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th November 2004, 15:42

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