Documentation quirks, errors and suggestions.

[sub]I just downloaded the 3.2.15 manual and see a mistake with the email. [/sub]
[sub]Mine does not have the I/O report control. I believe that was in the 3.2.16[/sub]

[sharedmedia=core:attachments:4515]
 
Here's a case of where 2 outputs should never be on at the same time.
......
I based this on using 8 bits (0-7 places) which is a sum of 255. The 252 for off is 255 -1 (bit 1) and -2 (bit 2). If you are using 16 bits etc. The highest sum of bits used (1+2+4+8+16+32+...) then subtract the bit you wish to set to 0 and this what you ANDB with to set the var or ram to a zero for the desired bit or bits.

252 (decimal) is 11111100 (bin) so yes, an inverted mask for two LSB

ANDB VAR1 252 VAR1
I don't understand why you do this - it wipes out all your effort above, ie, it clears bits 0 and 1 that you just set!

ANDB VAR1 2 OP2
This will ALWAYS set output 2 off (since var1 will always have bit 1 = 0 from above)

This no-op isn't required as andb won't skip

ANDB VAR1 1 OP1
This will always set output 1 off (since var1 will always have bit 0 = 0 from above)

Set OP2 0
Output 2 is already off, you can't make it "more" off :)

If I'm wrong on this, then I hope Russ and CAI slap me and correct me.
ROSS... :)
 
You're right about the NOP and the set OP2 to 0
Code:
[size=5]START
TSTLE T3 370
ORB VAR1 1 VAR1		 sets var1 bit 1 to 1 if less than 37
TSTGT T3 370
ANDB VAR1 254 If over 37 set var1 bit1 to 0 to make sure OP1 and OP2 not on at same time
TSTLE T3 390	
ORB VAR1 2 VAR1			 sets var1 bit 2 to 1 if less than 39
TSTLE T3 370
ANDB VAR1 253 VAR1	 sets var1 bit 2 to 0 if less than 37
TSTGT T3 430
ANDB VAR1 252 VAR1 If over 43 clear all bits set in var1
ANDB VAR1 2 OP2 If var1 bit 2 is set to 1 then set OP2 to on
ANDB VAR1 1 OP1 If var1 bit 1 is set to 1 then set OP2 to on
END

The logic is executed sequentially or at least from what I see.
If the temp is less than or equal to 37 we set a 1 for var1:1 If the temp is above 37 we set a 0 for var1:1
If the temp is less than 39 we set var1:2 to a 1 and if the temp is less than 37 we set the var1:2 bit to 0 because var1:1 will be on and we cant have both on at the same time.

Is this any better? How would you ensure 1 is off and the other on using bitwise operands?
 
Why not use XORB to turn off the bit?
XORB VAR1 2 VAR1 will turn bit 2 off, if that bit was 1 before.
If you use a lot of bits, since each VAR allowing up to 31 bits being used for different flags, calculator is a lot easier to see say bit 30, or bit 28 value.
 
Back
Top