| Use of Logical Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 Control Systems Logical functions can be used in a program for a control system. Example : Suppose a control system consists of 8 switches. These may be either OFF (0) or ON (1). It is possible to turn switches on by using the OR instruction. Eg If switches 1, 6 and 8 are already ON and we want to turn on switches 3 and 4... 
 The switches can be switched OFF by using the XOR instruction... 
  | 
        ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 Masking Another use for logical functions is in masking out bits of a number. For example, a character may be input from the keyboard and stored as its ASCII code. The digit 5 for example would be stored as the ASCII pattern 00110101 To convert it into a binary number we need to 'mask out' the first 4 bits of the number. To do this we use the AND function...as shown in this table... 
 
  | 
        ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
        Encryption Take any number A, XOR it with another number B resulting in C. Now take C, XOR it again with B, and the result will be A. This fact is used in encryption, where A is the original data, B is the encryption key and C is the coded data. Demonstration using the encryption key 10101010... 
 
  | 
        ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
        
		 Encryption 
		keeps the hackers out! | 
        ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||