Help with GOSUB


Closed Thread
Results 1 to 17 of 17

Thread: Help with GOSUB

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,623


    Did you find this post helpful? Yes | No

    Default Re: Help with GOSUB

    Hi,
    RD is just a name that you created which points to same memory adress (PortA) and bit at that adress (.3) as PortA.3 does.

    So RD[i] is then the same thing as PortA.3[i] but why are you doing it? What's the intended purpose of the [i] part of it?

    What will happen is that the first time thru the loop (when i=0) you will set PortA.3 high - which I think is all you want to do, but please correct me if that's not the case. Next time (when i=1) you'll set PortA.4 high. Next time (when i=2) you'll set PortA.5 high and so on. When i is 23456 you will set a bit, which 23456 bits "away" from PortA.3 in the memory map....

    Look at sextion 7.6.5 in the PBP3 manual for more details on array indexing, which is what you're doing effectively.

    I think you'll see the potential issue with this and the fact that it worked before is just pure luck as far as I can see.

    /Henrik.
    Last edited by HenrikOlsson; - 28th July 2015 at 21:07.

Similar Threads

  1. gosub - return
    By l_gaminde in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th August 2010, 11:21
  2. On...gosub
    By circuitpro in forum PBP Wish List
    Replies: 5
    Last Post: - 7th December 2009, 22:40
  3. If ... Then Gosub <> If ... Then Goto?
    By oldtoddler in forum General
    Replies: 6
    Last Post: - 27th February 2006, 12:52
  4. gosub and if-then working together?
    By bartman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd November 2005, 14:54
  5. GoSub Problem
    By ghoot in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th May 2004, 16:15

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