Shop OBEX P1 Docs P2 Docs Learn Events
MAX operator — Parallax Forums

MAX operator

kawinkawin Posts: 2
edited 2012-07-25 18:10 in General Discussion
Hello all,

1. i just wondering how Basic Stamp "MAX" operator work?
For example, MAX 99 if the value is more than 99, is there any error display or it returns 99?

2. I would like to use it with CCS PIC, can i write it conditinally using if..else?

Thank you so much.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-25 07:08
    There's a complete description of both MAX and MIN in the Stamp Manual starting on page 115. Essentially, these are limit operators. MAX sets a ceiling and MIN sets a floor value. This is opposite to the way you normally thing of maximum and minimum.

    X = Y MAX Z

    This sets X to the lowest value of either Y or Z. It's normally used to limit the value of Y to be no more than the value of Z.

    X = Y MIN Z

    This sets X to the highest value of either Y or Z. It's normally used to limit the value of Y to be no less than the value of Z.

    Regarding CCS PIC. You'll have to look at their manual.
  • kawinkawin Posts: 2
    edited 2012-07-25 18:10
    Great! thanks a lot for the guide. I'm just a beginner now i can understand better.
Sign In or Register to comment.