Page 1 of 1

Booleans

Posted: Tue Apr 19, 2011 7:00 pm
by Jan Lichtenbelt
Booleans are true or false. Depending on the programm used true and false does have different values, like 1 and 0 or 0 and -1.
In Flowcode true=1 and false=0. Say Flag is a boolean (byte with only one bit used) and the next calculation is correct:
Flag = (1 and 1)
The following if-statement: If Flag=1 ? can also written as If Flag ? and works correct in Flowcode.

My question is do both if statement give the same results in a PIC-microcontroller (after translation into C , assembler and hex)?

Kind regards

Jan Lichtenbelt

Re: Booleans

Posted: Wed Apr 20, 2011 10:03 am
by Benj
Hello Jan,

Yes both comparisons will work the same with the values 0 and 1 however the decision "if flag" will return true if flag is anything but 0. This is standard C functionality and should work with all versions of Flowcode no problems.

Your line "Flag = (1 and 1)" will also work fine.

Re: Booleans

Posted: Wed Apr 20, 2011 10:14 am
by Jan Lichtenbelt
Dear Ben,

Thanks for your answer. In the meanwhile I checked it in practice, see Flowcode file attached.

Kind regards

Jan Lichtenbelt