4 Replies Latest reply on Aug 11, 2016 10:27 AM by user_385543602

    uint8 vs int8 causes different outcomes

    user_385543602

      Hi,

         

      The following evaluates true if the variables are int8, but not true if uint8 (which is correct).

         

                  // Turn relays on if over set level
                  if(relay[0] >= dataLocal.level + dataLocal.hysteresis)
                  {
                      FET_1_Write(1);
                  }

         

      The values are:  relay[0] = 0, dataLocal.level = 128, dataLocal.hysteresis = 10.

         

      What am I missing here?  it seems like it is defying computer logic and calling 0 greater than 138...

         

      Thank you,
      Tom