Wrong use of the not and xor functions with bit variables ?
Code: Select all
{*
* Project name: Ess
* Target Platform: PIC24FJ256GB110
Compiler: mikroPascal Pro for dsPIC30/33 and PIC24 v4.6 and V4.8 beta
*}
program Test;
var
Bit_1 : bit;
Bit_2 : bit;
Bit_in_word : word;
Full_word_1 : word;
Full_word_2 : word;
begin // Program
//Code to check the displayed values in the watch windows
Bit_1 := False;
Bit_2 := False;
Bit_in_word.0 := False;
Bit_in_word.1 := False;
Full_word_1 := False;
Full_word_2 := False;
Bit_1 := True;
Bit_2 := True;
Bit_in_word.0 := True;
Bit_in_word.1 := True;
Full_word_1 := True;
Full_word_2 := True;
Bit_1 := False;
Bit_2 := False;
Bit_in_word.0 := False;
Bit_in_word.1 := False;
Full_word_1 := False;
Full_word_2 := False;
while TRUE do // Main loop
begin
//Code to test the NOT and XOR problem
//The result is depanding of the order of the lines
Bit_1 := not Bit_1; //Bit is only be set
Bit_in_word.0 := not Bit_in_word.0; //Bit is only be set
Full_word_1 := not Full_word_1; //OK
Bit_2 := True xor Bit_2; //Bit do not change
Bit_in_word.1 := True xor Bit_in_word.1; //Bit do not change
Full_word_2 := True xor Full_word_2; //OK
end; //Main loop
end. // Program