Hi! I have a question about Example 27 (Calulations and use of 'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations.) Where can I read more information on these operators?
Not clear why :
C = ( ( ( A << 2 ) AND 15 ) OR 85 ) >> 1 = 046
D = A * ( ( A MOD 2 ) = 0 ) = 010
E = NOT ( A XOR 60 ) = 201
( if A = 010)
'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations
-
- Posts: 79
- Joined: Mon Aug 03, 2009 12:14 pm
- 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: 'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations
Hello
This page may be of some help.
http://en.wikipedia.org/wiki/Logic_gate
Also this
http://www.learn-c.com/boolean.htm
The pages I have linked above show single bit truth tables. For 8-bit numbers you have to apply the truth table to each individual bit.
eg
01001101 - 77
AND
10101100 - 172
Equals
00001100 - 12
This page may be of some help.
http://en.wikipedia.org/wiki/Logic_gate
Also this
http://www.learn-c.com/boolean.htm
The pages I have linked above show single bit truth tables. For 8-bit numbers you have to apply the truth table to each individual bit.
eg
01001101 - 77
AND
10101100 - 172
Equals
00001100 - 12
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 79
- Joined: Mon Aug 03, 2009 12:14 pm
Re: 'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations
Thank you, I'll study it.
Respectfully, Alexander
-
- Posts: 79
- Joined: Mon Aug 03, 2009 12:14 pm
Re: 'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations
There is a description of all operations except the 'MOD'. Where can I learn about the 'MOD' operation?
Respectfully, Alexander
- 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: 'AND', 'OR', 'MOD', 'NOT' and 'XOR' operations
Hello
The MOD operation collects the non divisible remainder of a division.
For example
20 MOD 5 = 0
21 MOD 5 = 1
22 MOD 5 = 2
23 MOD 5 = 3
24 MOD 5 = 4
25 MOD 5 = 0
This example would count upwards a single digit at a time and then wrap around to 0 when it reaches the MOD value of 50.
count = (count + 1) MOD 50
Useful for performing loops or for creating counters that rollover at odd values.
The MOD operation collects the non divisible remainder of a division.
For example
20 MOD 5 = 0
21 MOD 5 = 1
22 MOD 5 = 2
23 MOD 5 = 3
24 MOD 5 = 4
25 MOD 5 = 0
This example would count upwards a single digit at a time and then wrap around to 0 when it reaches the MOD value of 50.
count = (count + 1) MOD 50
Useful for performing loops or for creating counters that rollover at odd values.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel