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
Booleans
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Booleans
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Booleans
Dear Ben,
Thanks for your answer. In the meanwhile I checked it in practice, see Flowcode file attached.
Kind regards
Jan Lichtenbelt
Thanks for your answer. In the meanwhile I checked it in practice, see Flowcode file attached.
Kind regards
Jan Lichtenbelt
- Attachments
-
- Test_Boolean.fcf
- (7 KiB) Downloaded 222 times