Variable organization


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually, I assumed the maximum variable length to be 65534 bytes (though I've never gone beyond about 8k personally - after all you gotta leave some space for your actual program too!!!)...

    Word variable minus 2 (because you can't have 65536) and it has to be an even number because the way 18F parts store stuff in Program Codespace.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by Melanie View Post
    Actually, I assumed the maximum variable length to be 65534 bytes (though I've never gone beyond about 8k personally - after all you gotta leave some space for your actual program too!!!)...

    Word variable minus 2 (because you can't have 65536) and it has to be an even number because the way 18F parts store stuff in Program Codespace.
    Hi, Mel ..

    I meant the Max Variable NAME length ....

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    PS: Tell me You won't implement a " Variable Stack " ... tell me you won't ... lol
    No, not yet Alain. I think Darrel did this a while back?

    As for the C i do not feel very comfort... That += and =- get me on my nerves!

    Melanie:

    I usually name the variable in a way that is obvious as to what they are doing. But I don't like the CounterA, B, C, D, ... Z variables all to be used for the same task in different places. But I see no other way as the meaning of Local in PBP is not defined.

    Thanks for the talking.

    Ioannis

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you're writing large complex programs, then your chosen PIC probably has so much RAM you're never going to use it all anyway... so why not have a dedicated set of variables for every subroutine and ISR... after all, that's what C does with it's local declarations.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Yes Melanie. That is what in practice I am doing. It would be nice though, if there was a way of recycling variables!

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Maybe the Aliases idea is what you are looking for?
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Absolutely No, Grandpa!

    This will mess up all the variables for sure.

    Ioannis

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16
  5. Storing a variable in EEPROM
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th October 2005, 13:53

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