Page 1 of 1

Inverting a bool inconsistent using NOT (Flowcode 7)

Posted: Tue Dec 27, 2022 4:51 pm
by licensing
If a boolean variable e.g. LtoR is inverted using NOT function
e.g. LtoR = NOT(LtoR)
then it works in a simulated decision but the generated code
uses bitwise inversion (~) and the resulting value is not equivalent
to false.
CODE GENERATED:
// Flip direction
// Calculation:
// LtoR = NOT (LtoR)
FCV_LTOR = ~(FCV_LTOR)

Re: Inverting a bool inconsistent using NOT (Flowcode 7)

Posted: Tue Dec 27, 2022 4:54 pm
by licensing
LtoR = !(LtoR) works correctly in simulation and generated code.

Re: Inverting a bool inconsistent using NOT (Flowcode 7)

Posted: Tue Dec 27, 2022 8:22 pm
by chipfryer27
Hi

If you do a search for difference between NOT and ! you should get the answer.

This link gives a guide

https://www.tutorialspoint.com/cprogram ... rators.htm

Regards

PS
If you are using Flowcode V7 then please post in that forum.