160 likes | 401 Views
ECT 464. Lecture 2 Binary Mathematics. A shut mouth gathers no foot. He who guards his lips guards his life, but he who speaks rashly will come to ruin. Proverbs 13:3. Number Systems. 0 or 1 0-7 0-F 0-? Binary Octal Hexadecimal Decimal 0000 000 0 0 …….. …… …… ….
E N D
ECT 464 Lecture 2 Binary Mathematics
A shut mouth gathers no foot. He who guards his lips guards his life, but he who speaks rashly will come to ruin.Proverbs 13:3
Number Systems 0 or 1 0-7 0-F 0-? Binary Octal Hexadecimal Decimal 0000 000 0 0 …….. …… …… …. 1111B 17O FH 15
Binary to Decimal Conversion Add the columns with 1’s in them Example: Convert 10110B to Decimal 16 8 4 2 1 1 0 1 1 0 16 + 4 + 2 = 22D
Binary to Octal Conversion Group the columns into groups of three and count from 0-7. Example: Convert 1011100110B to Octal 1 011 100 110 1 3 4 6 1346O
Binary to Hexidecimal Conversion Group the columns into groups of four and count from 0-F. Example: Convert 1011100110B to Hex 10 1110 0110 2 E 6 2E6H
Decimal to Binary Conversion Subtract column values from Decimal value Example: Convert 21D to Binary 32 16 8 4 2 1 1 0 1 0 1
Decimal to Octal Conversion Subtract column values from Decimal value Example: Convert 87D to Octal 64 8 1 1 2 7 127O
Decimal to Hexadecimal Conversion Subtract column values from Decimal value Example: Convert 287D to Hex 256 16 1 1 1 F 11FH
Binary Addition A carry is needed anytime the sum is greater than one. Example: 1010 + 0111 = 10001
Binary Subtraction Two’s Complement seems to be the easiest to understand. Complement and add 1. Example: 00001 10011 = + 10011 - 01010 + 10101 = 1001 = 01001
Logical NOT F = NOT A If A = 0, F = 1 If A = 1, F = 0
Logical AND F = A AND B Both A and B have to be one for F to be one. If either or both are zero, F is zero. A B F 0 0 0 0 1 0 1 0 0 1 1 1
Logical OR F = A OR B Either A or B or both have to be one for F to be one. If both are zero, F is zero. A B F 0 0 0 0 1 1 1 0 1 1 1 1
Logical XOR F = A XOR B Only A or B, not both, have to be one for F to be one. If both are zero or one, F is zero. A B F 0 0 0 0 1 1 1 0 1 1 1 0
Next Class • PLC Selection • Basic Ladder Logic • Input/Output Logic and Wiring