Variable sharing. Not sure how to describe this.


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Variable sharing. Not sure how to describe this.

    Would this be feasible?

    IOUT = POT.lowbyte

    IOUT must only be changed by push button increments and decrements. If they are made equal any change made to POT.lowbyte would change IOUT. How do I get this to work one way only?

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


    Did you find this post helpful? Yes | No

    Default Re: Variable sharing. Not sure how to describe this.

    Not clear to me what you want.
    You say
    IOUT must only be changed by push button increments and decrements.
    and/or
    any change made to POT.lowbyte would change IOUT
    ???
    How do I get this to work one way only?
    Which way do you want??
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Variable sharing. Not sure how to describe this.

    IOUT gets changed with a pushbutton input, either increased or decreased. I need to display that value on an LCD and also send that value out to a digital pot.
    I need to make sure that IOUT is only changed with the pressing of the pushbuttons, and I also need to make sure POT.lowbyte is always the same as IOUT.

    POT is 16bit and I wanted to know if I could load the 8 bit IOUT into POT.lowbyte.

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


    Did you find this post helpful? Yes | No

    Default Re: Variable sharing. Not sure how to describe this.

    Maybe something like this
    Code:
    POT_ROUTINE:
    IF BUTT1 =1 THEN IOUT = 1
    IF BUTT2 = 1 THEN IOUT = 0
    POT = IOUT
    RETURN
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Variable sharing. Not sure how to describe this.

    You're going to have issues with a variable named POT since this is a PBP command, and reserved, but if you just want to alias the low byte in a word var, then use something like this;

    ADPOT VAR WORD
    IOUT VAR ADPOT.BYTE0 ' this is just an alias to the low byte in ADPOT.

    Any value you place in IOUT will be placed in ADPOT.LOWBYTE. And whatever value is in ADPOT.LOWBYTE will also be in IOUT since it's the same RAM address as the low byte in ADPOT . It's in the manual...;o)
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Members who have read this thread : 1

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