can you make name variables?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    Gday Ralph
    The problem Peter is trying to overcome is explained in the bottom para of his initial post, and is the same one i hit.
    When doing the same function multiple times, it is more efficient to build a subroutine. However, if one of the "variables" in that subroutine is a port, yr stuffed.
    By referencing the reqd port the way described, you can set a std integer variable before entering the subroutine, thus bypassing the problem.

    However, it doesnt always work ( according to Melanie ). But it does work for simple on/off type stuff.

    Andrew

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by anj
    When doing the same function multiple times, it is more efficient to build a subroutine.
    Andrew, that's absolutely right,
    but if you don't let us know what the SUB requires as input and what it
    deliveres as output,
    we cant offer much help.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    Gday Ralph
    As per Peters original request
    If I copy the routine and have 3 of them for a.1, a.2, a.3 I run out of code space.
    Having been down the track he went down, i understood his post as meaning he currently had a routine that he would have to copy three times unless he could pass by reference, a port as a variable ( which you cant do ).
    As such all other inputs/outputs were irrelevant at the time, just how to ref a port.
    If he has other probs with his routines, i dont know, i merely advised of a different method i have used to get around referencing ports in subroutines.

    Andrew

Similar Threads

  1. How come they make electronics hard as poss
    By George in forum Off Topic
    Replies: 9
    Last Post: - 13th July 2007, 23:54
  2. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34
  3. Variables not appearing in Watch Window MPLabv7.3
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th June 2006, 14:36
  4. Problems with variables
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th December 2004, 18:37
  5. Bit variables... typo?
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th November 2004, 18:11

Members who have read this thread : 2

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