can you make name variables?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hello and thank you Andrew. I tried chip = porta.0 and it won't compile. Then I tried:

    x var byte
    chip var porta.0
    let x = 3
    high chip [x]

    Doesn't work - porta.0 goes high regardless of the value of x. So now I tried:

    high chip + x

    It works! If I replace porta.0 with chip + x in my program it should solve my problem. My 50 line block of code has a lot of adcin & shiftout commands. That's why I run out of program memory when I duplicate the block numerous times. Thank you Andrew. - Peter

  2. #2
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    Gday Pete

    "I tried chip = porta.0 and it won't compile."

    Oops sorry, my mistake when cut and pasting.
    ( You know what they say about shortcuts )
    The "chip var porta.0" syntax you arrived at is correct, and same as my referenced example.

    "high chip [x] doesnt work"

    I used "xport(k) = 1 ' set pin high" syntax
    as it uses less code than the high command ( apparently )
    I was testing using LEDs, so i know that it worked in that mode.
    However your syntax shld also work.
    Based on yr cut and paste, there is a space between chip and [X].
    If this is so, remove it and retry. Shld work then.

    Andrew

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Sorry for the delay Andrew. It works - Thank you. - Peter

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