Booleans

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
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:

Booleans

Post 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

User avatar
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

Post 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.

User avatar
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

Post 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
Attachments
Test_Boolean.fcf
(7 KiB) Downloaded 222 times

Post Reply