I have a difficult logic task to analyze bits and seems that compiler can't solve this correctly.
input data is array of 4 bytes:
byte order in array is 0, 1, 2, 3
bit alignment is hi to low; 76543210
11101011 11111100 00110101 00100010 // need to make last init
11101011 11111100 00111111 00101000 // door open
11101011 11111100 00111100 00101011 // no paper
11100011 11111100 00100101 00101010 // paper lo
11100011 11111100 00110101 00111010 // paper hi
11100011 11111100 01110101 01101010 // paper out
PF_Status variable is byte
maybe I want too much of compiler, but next code does not work:
Code: Select all
PF_Status.B0:= ((TheResult[2].B1 = 1) and (TheResult[3].B1 = 0));// paper door open
PF_STatus.B2:= ((TheResult[2].B3 = 1) and (TheResult[2].B4 = 1) and (TheResult[3].B0 = 1));// no paper
PF_Status.B3:= not PF_Status.B2;
PF_Status.B4:= not PF_Status.B2;
/// some code omitted
PF_STatus.B3:= ((TheResult[2].B4 = 0) and (TheResult[3].B4 = 0) and (TheResult[3].B0 = 0));// paper lo
PF_STatus.B4:= ((TheResult[2].B4 = 1) and (TheResult[3].B4 = 1) and (TheResult[3].B0 = 0));// paper hi
PF_STatus.B5:= ((TheResult[2].B6 = 1) and (TheResult[3].B6 = 1));// paper out