Skip to content

SkyNex Academy Β· Analog and Digital Systems

Digital Electronics Exercise Book

266 logic exercises, from number systems to PLC programming. Write your answer in the box under each question: the box turns green when it is correct and red when it is wrong. 206 questions are checked automatically; for the others, compare with the answer and mark yourself.

Your progress: 0 / 266 answeredβœ“ 0 rightβœ— 0 wrong
How to type your answers
  • Numbers: just the digits, e.g. 101101, 2F or βˆ’45. You can leave out leading zeros (except for complements and codes, where every bit counts).
  • Boolean expressions: A' for NOT A, letters side by side (or Β·) for AND, + for OR, βŠ• or ^ for XOR, brackets as needed. Example: AB' + (A + C)'. Any expression with the right truth table is accepted, but β€œsimplify” questions also want the shortest form.
  • Measured values with a unit prefix: 6.87 Hz, 76 ms, 1.5k, 2.2 Β΅s. Answers within 3 % are correct.
  • Lists (segments, outputs, states): separate with commas, e.g. b, c, f, g. The order does not matter.
  • Your answers are saved in this browser, so you can come back later.

Part 1 Β· Combinational logic

Chapter 1

Number systems and codes

Binary, octal and hexadecimal numbers, binary arithmetic, signed numbers and the codes used inside digital equipment.

1.1 Binary and decimal

Key ideas

  • Each binary place is worth twice the place on its right: …, 16, 8, 4, 2, 1 . Β½, ΒΌ, β…›, …
  • Decimal β†’ binary: divide by 2 again and again and read the remainders from the bottom up.
  • Decimal fraction β†’ binary: multiply the fraction by 2 again and again and read the whole-number parts from the top down.
  • With n bits you can count from 0 to 2ⁿ βˆ’ 1.
  1. 1.1.1Basic

    Convert these binary numbers to decimal:

    (a) (1011)β‚‚

    (b) (11010)β‚‚

    (c) (100111)β‚‚

    (d) (11111111)β‚‚

    Your answer

    β–ΈShow answer

    Answer

    (a) (11)₁₀

    (b) (26)₁₀

    (c) (39)₁₀

    (d) (255)₁₀

  2. 1.1.2Basic

    Convert these decimal numbers to binary:

    (a) (19)₁₀

    (b) (46)₁₀

    (c) (100)₁₀

    (d) (255)₁₀

    Your answer

    β–ΈShow answer

    Answer

    (a) (10011)β‚‚

    (b) (101110)β‚‚

    (c) (1100100)β‚‚

    (d) (11111111)β‚‚

  3. 1.1.3Basic

    Show every step of converting 46 to binary by repeated division by 2.

    Your answer

    β–ΈShow answer

    Answer

    DivisionQuotientRemainder
    46 Γ· 2230
    23 Γ· 2111
    11 Γ· 251
    5 Γ· 221
    2 Γ· 210
    1 Γ· 201

    Read the remainders from the bottom up: 46 = (101110)β‚‚.

  4. 1.1.4Practice

    Convert these binary numbers (with fractions) to decimal:

    (a) (101.11)β‚‚

    (b) (1100.011)β‚‚

    (c) (0.1011)β‚‚

    Your answer

    β–ΈShow answer

    Answer

    (a) (5.75)₁₀

    (b) (12.375)₁₀

    (c) (0.6875)₁₀

  5. 1.1.5Practice

    Convert to binary (give at most 6 bits after the point):

    (a) (6.75)₁₀

    (b) (13.625)₁₀

    (c) (0.3)₁₀

    Your answer

    β–ΈShow answer

    Answer

    (a) (110.11)β‚‚

    (b) (1101.101)β‚‚

    (c) (0.010011)β‚‚ (0.3 never ends in binary; 0.010011… β‰ˆ 0.297)

  6. 1.1.6Basic

    What is the largest decimal number you can write with (a) 6 bits (b) 8 bits (c) 12 bits?

    Your answer

    β–ΈShow answer

    Answer

    (a) 2^6 βˆ’ 1 = 63

    (b) 2^8 βˆ’ 1 = 255

    (c) 2^12 βˆ’ 1 = 4095

  7. 1.1.7Practice

    How many bits are needed to write (a) 1000 (b) 5000 (c) 65 535 in binary?

    Your answer

    β–ΈShow answer

    Answer

    (a) 10 bits (2^9 = 512 is too small, 2^10 = 1024 is enough)

    (b) 13 bits (2^12 = 4096 is too small, 2^13 = 8192 is enough)

    (c) 16 bits (2^15 = 32768 is too small, 2^16 = 65536 is enough)

  8. 1.1.8Challenge

    A sensor sends a reading as 10 bits. (a) How many different values can it send? (b) If 0 means 0 Β°C and the largest value means 100 Β°C, what temperature does the reading 1000000000 stand for?

    Your answer

    β–ΈShow answer

    Answer

    (a) 2¹⁰ = 1024 values (0 to 1023).

    (b) 1000000000β‚‚ = 512, so the temperature is 512 Γ— 100 / 1023 β‰ˆ 50 Β°C.

1.2 Octal and hexadecimal

Key ideas

  • Octal uses the digits 0–7; one octal digit = 3 bits.
  • Hexadecimal uses 0–9 and A–F (A = 10 … F = 15); one hex digit = 4 bits.
  • Binary β†’ octal/hex: group the bits in 3s or 4s starting from the point, adding zeros at the ends if needed.
  1. 1.2.1Basic

    Convert these octal numbers to decimal:

    (a) (57)β‚ˆ

    (b) (144)β‚ˆ

    (c) (777)β‚ˆ

    (d) (1750)β‚ˆ

    Your answer

    β–ΈShow answer

    Answer

    (a) (47)₁₀

    (b) (100)₁₀

    (c) (511)₁₀

    (d) (1000)₁₀

  2. 1.2.2Basic

    Convert these decimal numbers to octal:

    (a) (100)₁₀

    (b) (365)₁₀

    (c) (1000)₁₀

    Your answer

    β–ΈShow answer

    Answer

    (a) (144)β‚ˆ

    (b) (555)β‚ˆ

    (c) (1750)β‚ˆ

  3. 1.2.3Basic

    Convert these binary numbers to octal:

    (a) (101110)β‚‚

    (b) (11011011)β‚‚

    (c) (1101.0111)β‚‚

    Your answer

    β–ΈShow answer

    Answer

    (a) (56)β‚ˆ

    (b) (333)β‚ˆ

    (c) (15.34)β‚ˆ

  4. 1.2.4Basic

    Convert these octal numbers to binary:

    (a) (47)β‚ˆ

    (b) (362)β‚ˆ

    (c) (7.25)β‚ˆ

    Your answer

    β–ΈShow answer

    Answer

    (a) (100111)β‚‚

    (b) (11110010)β‚‚

    (c) (111.010101)β‚‚

  5. 1.2.5Basic

    Convert these hexadecimal numbers to decimal:

    (a) (2F)₁₆

    (b) (A0)₁₆

    (c) (3E8)₁₆

    (d) (FFFF)₁₆

    Your answer

    β–ΈShow answer

    Answer

    (a) (47)₁₀

    (b) (160)₁₀

    (c) (1000)₁₀

    (d) (65535)₁₀

  6. 1.2.6Basic

    Convert these decimal numbers to hexadecimal:

    (a) (75)₁₀

    (b) (255)₁₀

    (c) (4096)₁₀

    (d) (2025)₁₀

    Your answer

    β–ΈShow answer

    Answer

    (a) (4B)₁₆

    (b) (FF)₁₆

    (c) (1000)₁₆

    (d) (7E9)₁₆

  7. 1.2.7Basic

    Convert these binary numbers to hexadecimal:

    (a) (11010110)β‚‚

    (b) (101111100101)β‚‚

    (c) (1110.1011)β‚‚

    Your answer

    β–ΈShow answer

    Answer

    (a) (D6)₁₆

    (b) (BE5)₁₆

    (c) (E.B)₁₆

  8. 1.2.8Basic

    Convert these hexadecimal numbers to binary:

    (a) (7C)₁₆

    (b) (B3F)₁₆

    (c) (1A.8)₁₆

    Your answer

    β–ΈShow answer

    Answer

    (a) (0111 1100)β‚‚ (each hex digit becomes 4 bits)

    (b) (1011 0011 1111)β‚‚ (each hex digit becomes 4 bits)

    (c) (0001 1010.1000)β‚‚ (each hex digit becomes 4 bits)

  9. 1.2.9Practice

    Convert (3F7)₁₆ to octal by going through binary.

    Your answer

    β–ΈShow answer

    Answer

    (3F7)₁₆ = 11 1111 0111 = 001 111 110 111 = (1767)β‚ˆ

  10. 1.2.10Practice

    Convert (2735)β‚ˆ to hexadecimal.

    Your answer

    β–ΈShow answer

    Answer

    (2735)β‚ˆ = 10111011101β‚‚ = (5DD)₁₆ (= 1501 in decimal)

  11. 1.2.11Challenge

    A memory chip uses the addresses 0000₁₆ to 3FFF₁₆. (a) How many memory locations does it have? (b) How many address lines (bits) does it need?

    Your answer

    β–ΈShow answer

    Answer

    (a) 3FFF₁₆ = 16383, so there are 16384 locations (16 K).

    (b) 16384 = 2¹⁴, so 14 address lines.

  12. 1.2.12Challenge

    Web colours are written as three hex bytes: #RRGGBB. Give the red, green and blue values in decimal for (a) #FF8000 (b) #1E90FF.

    Your answer

    β–ΈShow answer

    Answer

    (a) R = FF = 255, G = 80 = 128, B = 00 = 0 (orange)

    (b) R = 1E = 30, G = 90 = 144, B = FF = 255 (blue)

1.3 Binary arithmetic

Key ideas

  • Addition: 0+0 = 0, 0+1 = 1, 1+1 = 0 carry 1, 1+1+1 = 1 carry 1.
  • Subtraction: 0βˆ’0 = 0, 1βˆ’0 = 1, 1βˆ’1 = 0, 0βˆ’1 = 1 borrow 1.
  • Multiplication and division work like in decimal, but every partial product is either 0 or the number itself.
  1. 1.3.1Basic

    Add:

    (a) 1011 + 0110

    (b) 11101 + 10111

    (c) 1011.01 + 110.11

    (d) 1111 + 1111

    Your answer

    β–ΈShow answer

    Answer

    (a) 10001 (11 + 6 = 17)

    (b) 110100 (29 + 23 = 52)

    (c) 10010 (11.25 + 6.75 = 18)

    (d) 11110 (15 + 15 = 30)

  2. 1.3.2Basic

    Subtract:

    (a) 1101 βˆ’ 0110

    (b) 101000 βˆ’ 10011

    (c) 1100.1 βˆ’ 11.11

    Your answer

    β–ΈShow answer

    Answer

    (a) 111 (13 βˆ’ 6 = 7)

    (b) 10101 (40 βˆ’ 19 = 21)

    (c) 1000.11 (12.5 βˆ’ 3.75 = 8.75)

  3. 1.3.3Practice

    Multiply:

    (a) 1011 Γ— 101

    (b) 1101 Γ— 110

    (c) 111 Γ— 111

    Your answer

    β–ΈShow answer

    Answer

    (a) 110111 (11 Γ— 5 = 55)

    (b) 1001110 (13 Γ— 6 = 78)

    (c) 110001 (7 Γ— 7 = 49)

  4. 1.3.4Practice

    Divide:

    (a) 110110 Γ· 110

    (b) 1111000 Γ· 1010

    (c) 1010001 Γ· 1001

    Your answer

    β–ΈShow answer

    Answer

    (a) 1001 (54 Γ· 6 = 9)

    (b) 1100 (120 Γ· 10 = 12)

    (c) 1001 (81 Γ· 9 = 9)

  5. 1.3.5Practice

    Add the three numbers 1101 + 1011 + 111 and check your answer in decimal.

    Your answer

    β–ΈShow answer

    Answer

    11111β‚‚ = 31 (13 + 11 + 7 = 31).

  6. 1.3.6Challenge

    Multiplying a binary number by 2 shifts it one place to the left. What do you get when you shift 0010 1101 (a) one place left (b) two places right? Give the decimal values too.

    Your answer

    β–ΈShow answer

    Answer

    (a) 0101 1010 = 90 (= 45 Γ— 2)

    (b) 0000 1011 = 11 (= 45 Γ· 4, the remainder 1 is lost)

1.4 Complements and signed numbers

Key ideas

  • 1’s complement: change every 0 into 1 and every 1 into 0.
  • 2’s complement: the 1’s complement plus 1. It is how computers store negative numbers.
  • In n-bit 2’s complement the left bit is the sign (0 = +, 1 = βˆ’) and the range is βˆ’2ⁿ⁻¹ to +2ⁿ⁻¹ βˆ’ 1.
  • A βˆ’ B = A + (2’s complement of B); ignore the carry out of the left-most bit.
  1. 1.4.1Basic

    Give the 1’s complement of:

    (a) 1011

    (b) 01101100

    (c) 11110000

    Your answer

    β–ΈShow answer

    Answer

    (a) 0100

    (b) 10010011

    (c) 00001111

  2. 1.4.2Basic

    Give the 2’s complement of:

    (a) 0101

    (b) 00011010

    (c) 10000000

    (d) 11111111

    Your answer

    β–ΈShow answer

    Answer

    (a) 1011

    (b) 11100110

    (c) 10000000

    (d) 00000001

  3. 1.4.3Basic

    Write these numbers in 8-bit 2’s complement:

    (a) +37

    (b) βˆ’37

    (c) βˆ’100

    (d) βˆ’1

    (e) βˆ’128

    Your answer

    β–ΈShow answer

    Answer

    (a) 00100101

    (b) 11011011

    (c) 10011100

    (d) 11111111

    (e) 10000000

  4. 1.4.4Practice

    What decimal values do these 8-bit 2’s complement numbers stand for?

    (a) 00101101

    (b) 11010011

    (c) 10000001

    (d) 11111110

    Your answer

    β–ΈShow answer

    Answer

    (a) +45

    (b) βˆ’45

    (c) βˆ’127

    (d) βˆ’2

  5. 1.4.5Practice

    Use the 2’s complement method to work out (8 bits): (a) 45 βˆ’ 19 (b) 25 βˆ’ 40 (c) βˆ’20 βˆ’ 30.

    Your answer

    β–ΈShow answer

    Answer

    (a) 00101101 + 11101101 = 1 00011010 β†’ ignore the carry β†’ 00011010 = +26

    (b) 00011001 + 11011000 = 11110001 β†’ no carry, so the result is negative: βˆ’(2’s complement of 11110001) = βˆ’15

    (c) 11101100 + 11100010 = 1 11001110 β†’ ignore the carry β†’ 11001110 = βˆ’50

  6. 1.4.6Practice

    Use 1’s complement subtraction (with end-around carry) to work out 1011 βˆ’ 0110.

    Your answer

    β–ΈShow answer

    Answer

    1’s complement of 0110 = 1001.

    1011 + 1001 = 1 0100 β†’ the carry 1 is added back to the result (end-around carry): 0100 + 1 = 0101.

    Answer: 0101 = 5 (11 βˆ’ 6 = 5).

  7. 1.4.7Basic

    What is the range of numbers you can store in (a) 8-bit (b) 16-bit 2’s complement?

    Your answer

    β–ΈShow answer

    Answer

    (a) βˆ’128 to +127

    (b) βˆ’32 768 to +32 767

  8. 1.4.8Challenge

    Add the 8-bit signed numbers 01110000 and 00110000. Is the answer correct? Explain what happened.

    Your answer

    β–ΈShow answer

    Answer

    01110000 (+112) + 00110000 (+48) = 10100000. In 8-bit 2’s complement this reads βˆ’96, which is wrong: +160 is bigger than +127. This is an overflow: two positive numbers gave a negative-looking result. Overflow happens when both numbers have the same sign and the result has the other sign.

1.5 Binary codes: BCD, Excess-3, Gray and ASCII

Key ideas

  • BCD (8421): every decimal digit is written as its own 4-bit group. 1010 to 1111 are not used.
  • Excess-3: every digit is written as (digit + 3) in 4 bits. It is self-complementing.
  • Gray code: only one bit changes between two neighbouring numbers. G = B βŠ• (B shifted right by one).
  • ASCII: a 7-bit code for letters, digits and signs, e.g. β€˜A’ = 65 = 41₁₆.
  1. 1.5.1Basic

    Write in BCD:

    (a) 59

    (b) 306

    (c) 2025

    Your answer

    β–ΈShow answer

    Answer

    (a) 0101 1001

    (b) 0011 0000 0110

    (c) 0010 0000 0010 0101

  2. 1.5.2Basic

    Decode these BCD numbers:

    (a) 1001 0011

    (b) 0111 0000 0110

    (c) 0001 0101 1000 0100

    Your answer

    β–ΈShow answer

    Answer

    (a) 93

    (b) 706

    (c) 1584

  3. 1.5.3Practice

    Compare the binary and BCD forms of 97. Which needs more bits?

    Your answer

    β–ΈShow answer

    Answer

    Binary: 1100001 (7 bits). BCD: 1001 0111 (8 bits). BCD needs more bits but is easier to show on a display.

  4. 1.5.4Basic

    Is 0110 1101 a valid BCD number? Explain.

    Your answer

    β–ΈShow answer

    Answer

    No. The right group 1101 = 13 is not a decimal digit; BCD only uses 0000 to 1001.

  5. 1.5.5Challenge

    Add 47 + 35 in BCD. Show the correction step.

    Your answer

    β–ΈShow answer

    Answer

    0100 0111 (47)

    + 0011 0101 (35)

    = 0111 1100

    The right group 1100 is more than 9, so add 0110: 1100 + 0110 = 1 0010 β†’ write 0010, carry 1 into the next group: 0111 + 1 = 1000.

    Result: 1000 0010 = 82. βœ”

  6. 1.5.6Basic

    Write in Excess-3:

    (a) 4

    (b) 27

    (c) 905

    Your answer

    β–ΈShow answer

    Answer

    (a) 0111

    (b) 0101 1010

    (c) 1100 0011 1000

  7. 1.5.7Practice

    Decode the Excess-3 number 0110 1001 1011.

    Your answer

    β–ΈShow answer

    Answer

    Subtract 3 from each group: 0110 β†’ 3, 1001 β†’ 6, 1011 β†’ 8. Answer: 368.

  8. 1.5.8Challenge

    Show that Excess-3 is self-complementing using the digit 2.

    Your answer

    β–ΈShow answer

    Answer

    2 in Excess-3 = 0101. Its 9’s complement is 7 = 1010. Inverting every bit of 0101 gives 1010, which is exactly the Excess-3 code of 7: the 1’s complement of the code gives the code of the 9’s complement.

  9. 1.5.9Basic

    Convert binary to Gray code:

    (a) 0110

    (b) 1011

    (c) 1111

    (d) 10010

    Your answer

    β–ΈShow answer

    Answer

    (a) 0101

    (b) 1110

    (c) 1000

    (d) 11011

  10. 1.5.10Basic

    Convert Gray code to binary:

    (a) 1101

    (b) 1000

    (c) 0111

    Your answer

    β–ΈShow answer

    Answer

    (a) 1001

    (b) 1111

    (c) 0101

  11. 1.5.11Practice

    Write the full 3-bit Gray code sequence from 0 to 7.

    Your answer

    β–ΈShow answer

    Answer

    DecimalBinaryGray
    0000000
    1001001
    2010011
    3011010
    4100110
    5101111
    6110101
    7111100
  12. 1.5.12Practiceself-marked

    Why is Gray code used in rotary position encoders?

    Your answer

    β–ΈShow answer

    Answer

    Only one bit changes from one position to the next, so the reader can never see a false value while several bits change at slightly different moments (e.g. 0111 β†’ 1000 in binary could be read as 1111 for a moment).

  13. 1.5.13Basic

    Give the ASCII code of the letters S, K and Y in decimal, hex and 7-bit binary.

    Your answer

    β–ΈShow answer

    Answer

    LetterDecimalHexBinary
    S83531010011
    K754B1001011
    Y89591011001
  14. 1.5.14Practice

    What is the difference between the ASCII codes of β€˜a’ and β€˜A’? How can a program change a lowercase letter into a capital?

    Your answer

    β–ΈShow answer

    Answer

    β€˜a’ = 97, β€˜A’ = 65: the difference is 32 = 0100000β‚‚. Clearing bit 5 (or subtracting 32) turns any lowercase letter into a capital.

  15. 1.5.15Practice

    The character β€˜7’ and the number 7 are not the same in a computer. Give both in binary.

    Your answer

    β–ΈShow answer

    Answer

    Number 7 = 0000111. Character β€˜7’ (ASCII 55) = 0110111.

Chapter 2

Logic gates

The basic gates, their truth tables and symbols, universal gates and tristate outputs.

2.1 Basic gates and truth tables

Key ideas

  • NOT: Y = A'. AND: Y = AΒ·B (1 only if all inputs are 1). OR: Y = A + B (1 if any input is 1).
  • NAND = AND followed by NOT; NOR = OR followed by NOT.
  • XOR: Y = A βŠ• B = A'B + AB' (1 when the inputs are different). XNOR: 1 when the inputs are equal.
  • A gate with n inputs has 2ⁿ rows in its truth table.
  1. 2.1.1Basic

    Write the truth table of a 2-input AND, OR, NAND, NOR, XOR and XNOR gate in one table.

    Your answer

    β–ΈShow answer

    Answer

    ABANDORNANDNORXORXNOR
    00001101
    01011010
    10011010
    11110001
  2. 2.1.2Basic

    Write the truth table of a 3-input NAND gate and a 3-input NOR gate.

    Your answer

    β–ΈShow answer

    Answer

    ABCNANDNOR
    00011
    00110
    01010
    01110
    10010
    10110
    11010
    11100
  3. 2.1.3Basic

    How many rows does the truth table of a 5-input AND gate have? In how many of them is the output 1?

    Your answer

    β–ΈShow answer

    Answer

    2⁡ = 32 rows. The output is 1 in only one row (all inputs 1).

  4. 2.1.4Practice

    Two signals are sampled at 8 moments: A = 11001010, B = 10100110. Give the output of (a) AND (b) OR (c) XOR (d) NAND for each moment.

    Your answer

    β–ΈShow answer

    Answer

    (a) 10000010

    (b) 11101110

    (c) 01101100

    (d) 01111101

  5. 2.1.5Practice

    A gate gives these outputs for AB = 00, 01, 10, 11: 1, 0, 0, 0. Which gate is it? And for 0, 1, 1, 0?

    Your answer

    β–ΈShow answer

    Answer

    1, 0, 0, 0 is a NOR gate. 0, 1, 1, 0 is an XOR gate.

  6. 2.1.6Basic

    Name the TTL chip that holds each of these: four 2-input NAND gates, six NOT gates, four 2-input AND gates, four 2-input OR gates, four 2-input XOR gates, four 2-input NOR gates.

    Your answer

    β–ΈShow answer

    Answer

    7400 (NAND), 7404 (NOT), 7408 (AND), 7432 (OR), 7486 (XOR), 7402 (NOR). On these 14-pin chips pin 14 is +5 V and pin 7 is ground.

  7. 2.1.7Challenge

    A NAND gate has inputs A and B. Its output goes to a NOR gate together with input C. Write the expression for the output Y and its truth table.

    Your answer

    β–ΈShow answer

    Answer

    Y = ((AB)' + C)' = ABΒ·C'

    ABCY
    0000
    0010
    0100
    0110
    1000
    1010
    1101
    1110

2.2 Negative-AND, Negative-OR, XOR uses and the INHIBIT gate

Key ideas

  • Negative-AND (inputs inverted, then AND) = NOR. Negative-OR = NAND (De Morgan).
  • XOR gives the parity of its inputs: the output is 1 when an odd number of inputs are 1.
  • INHIBIT gate: Y = AΒ·B'. Input B blocks (inhibits) A.
  1. 2.2.1Basic

    Show with a truth table that a Negative-AND gate (A'Β·B') behaves like a NOR gate.

    Your answer

    β–ΈShow answer

    Answer

    ABA'Β·B'(A+B)'
    0011
    0100
    1000
    1100
  2. 2.2.2Basic

    Show with a truth table that a Negative-OR gate (A' + B') behaves like a NAND gate.

    Your answer

    β–ΈShow answer

    Answer

    ABA'+B'(AB)'
    0011
    0111
    1011
    1100
  3. 2.2.3Practice

    An even-parity bit is added to 7-bit data so the total number of 1s is even. Find the parity bit for:

    (a) 1011000

    (b) 1110111

    (c) 0110100

    (d) 1000001

    Your answer

    β–ΈShow answer

    Answer

    (a) 1 β†’ sent as 10110001

    (b) 0 β†’ sent as 11101110

    (c) 1 β†’ sent as 01101001

    (d) 0 β†’ sent as 10000010

  4. 2.2.4Practice

    Which gate can you use to check whether two bits are equal? Draw the idea for comparing two 2-bit numbers A1A0 and B1B0.

    Your answer

    β–ΈShow answer

    Answer

    An XNOR gate gives 1 when its two inputs are equal. For 2-bit numbers: E = (A1 βŠ™ B1)Β·(A0 βŠ™ B0): two XNOR gates followed by an AND gate.

  5. 2.2.5Basic

    Write the truth table of an INHIBIT gate Y = AΒ·B'. What does input B do?

    Your answer

    β–ΈShow answer

    Answer

    ABY
    000
    010
    101
    110

    When B = 1 the output is always 0 (A is blocked). When B = 0 the output follows A.

  6. 2.2.6Challenge

    A machine motor M may only run when the start switch S is on and the safety guard G is NOT open (G = 1 means open). Which gate do you need? Write the expression.

    Your answer

    β–ΈShow answer

    Answer

    An INHIBIT gate: M = SΒ·G'. The guard input inhibits the start switch.

2.3 Universal gates and tristate logic

Key ideas

  • NAND and NOR are universal: any logic circuit can be built with only NAND gates or only NOR gates.
  • A tristate (three-state) output can be 0, 1 or Z (high impedance, disconnected). The enable input decides.
  • Several tristate outputs can share one bus wire, but only one may be enabled at a time.
  1. 2.3.1Basicself-marked

    Show how to make a NOT gate from (a) one NAND gate (b) one NOR gate.

    Your answer

    β–ΈShow answer

    Answer

    (a) Join both NAND inputs together: (AΒ·A)' = A'.

    (b) Join both NOR inputs together: (A + A)' = A'.

  2. 2.3.2Practice

    Build a 2-input AND gate and a 2-input OR gate using only NAND gates. How many gates does each need?

    Your answer

    β–ΈShow answer

    Answer

    AND: NAND followed by a NAND used as an inverter: ((AB)')' = AB β†’ 2 gates.

    OR: invert each input with a NAND, then NAND them: (A'Β·B')' = A + B β†’ 3 gates.

  3. 2.3.3Practice

    Build a 2-input OR gate and a 2-input AND gate using only NOR gates.

    Your answer

    β–ΈShow answer

    Answer

    OR: NOR followed by a NOR inverter β†’ 2 gates.

    AND: invert each input with a NOR, then NOR them: (A' + B')' = AB β†’ 3 gates.

  4. 2.3.4Challengeself-marked

    Build an XOR gate from four 2-input NAND gates. Give the output of each gate.

    Your answer

    β–ΈShow answer

    Answer

    G1 = (AB)'. G2 = (AΒ·G1)'. G3 = (BΒ·G1)'. Y = (G2Β·G3)' = AΒ·G1 + BΒ·G1 = (A + B)(AB)' = A'B + AB' = A βŠ• B.

  5. 2.3.5Basic

    A tristate buffer has data input A and active-high enable E. Write its truth table.

    Your answer

    β–ΈShow answer

    Answer

    EAY
    00Z
    01Z
    100
    111
  6. 2.3.6Practiceself-marked

    Two tristate buffers drive the same bus wire. Buffer 1 outputs 1 and buffer 2 outputs 0, and both are enabled. What happens, and how is it avoided?

    Your answer

    β–ΈShow answer

    Answer

    Bus contention: one output pushes the wire high while the other pulls it low. A large current flows, the level is unknown and the chips can be damaged. A decoder is used so that only one enable is active at a time.

Chapter 3

Boolean algebra and Karnaugh maps

The laws of Boolean algebra, SOP and POS forms, minterms and maxterms, and simplification with Karnaugh maps.

🧩 Practise this chapter in the SkyNex Lab: live circuits, no code

3.1 Laws and algebraic simplification

Key ideas

  • A + 0 = A, AΒ·1 = A, A + 1 = 1, AΒ·0 = 0, A + A = A, AΒ·A = A, A + A' = 1, AΒ·A' = 0, (A')' = A.
  • Absorption: A + AB = A, A(A + B) = A, A + A'B = A + B.
  • Distributive: A(B + C) = AB + AC and A + BC = (A + B)(A + C).
  • De Morgan: (A + B)' = A'B' and (AB)' = A' + B'.
  1. 3.1.1Basicself-marked

    Name the law used in each line: (a) A + 1 = 1 (b) AΒ·A' = 0 (c) A + AB = A (d) (AB)' = A' + B' (e) A(B + C) = AB + AC

    Your answer

    β–ΈShow answer

    Answer

    (a) annulment / OR with 1 (b) complement law (c) absorption (d) De Morgan’s theorem (e) distributive law

  2. 3.1.2Basic

    Simplify: Y = AB + AB' + A'B

    Your answer

    β–ΈShow answer

    Answer

    Y = A + B

  3. 3.1.3Basic

    Simplify: Y = A + AB

    Your answer

    β–ΈShow answer

    Answer

    Y = A

  4. 3.1.4Basic

    Simplify: Y = A(A + B)

    Your answer

    β–ΈShow answer

    Answer

    Y = A

  5. 3.1.5Basic

    Simplify: Y = A + A'B

    Your answer

    β–ΈShow answer

    Answer

    Y = A + B

  6. 3.1.6Practice

    Simplify: Y = (A + B)(A + C)

    Your answer

    β–ΈShow answer

    Answer

    Y = A + BC

  7. 3.1.7Practice

    Simplify: Y = AB + A'C + BC

    Your answer

    β–ΈShow answer

    Answer

    Y = AB + A'C

  8. 3.1.8Practice

    Simplify: Y = A'B'C + A'BC + AB'C + ABC

    Your answer

    β–ΈShow answer

    Answer

    Y = C

  9. 3.1.9Practice

    Simplify: Y = (A + B')(A' + B)

    Your answer

    β–ΈShow answer

    Answer

    Y = AB + A'B'

  10. 3.1.10Practice

    Simplify: Y = A'B'C' + A'BC' + AB'C' + ABC'

    Your answer

    β–ΈShow answer

    Answer

    Y = C'

  11. 3.1.11Practice

    Simplify: Y = ABC + ABC' + AB'C

    Your answer

    β–ΈShow answer

    Answer

    Y = AB + AC

  12. 3.1.12Practice

    Use De Morgan’s theorem to write these without a bar over more than one letter: (a) (A + B + C)' (b) (AB + C)' (c) ((A + B)C')'

    Your answer

    β–ΈShow answer

    Answer

    (a) A'B'C'

    (b) (AB)'Β·C' = (A' + B')C'

    (c) (A + B)' + C = A'B' + C

  13. 3.1.13Challengeself-marked

    Prove with algebra that AB + A'C + BC = AB + A'C (the consensus theorem).

    Your answer

    β–ΈShow answer

    Answer

    BC = BC(A + A') = ABC + A'BC.

    So AB + A'C + BC = AB + ABC + A'C + A'BC = AB(1 + C) + A'C(1 + B) = AB + A'C. βœ”

  14. 3.1.14Practice

    Check with a truth table that A + A'B = A + B.

    Your answer

    β–ΈShow answer

    Answer

    ABA + A'BA + B
    0000
    0111
    1011
    1111

3.2 SOP, POS, minterms and maxterms

Key ideas

  • A minterm is an AND term that contains every variable once; it is 1 for exactly one row. m3 for ABC is A'BC.
  • A maxterm is an OR term that is 0 for exactly one row. M3 for ABC is (A + B' + C').
  • F = Ξ£m(rows where F = 1) = Ξ M(rows where F = 0).
  1. 3.2.1Basic

    Write the minterm and the maxterm for row 5 of a 3-variable truth table (A is the MSB).

    Your answer

    β–ΈShow answer

    Answer

    Row 5 = 101 β†’ minterm m5 = AB'C, maxterm M5 = (A' + B + C').

  2. 3.2.2Basic

    F(A, B, C) = Ξ£m(1, 4, 6, 7). Write F as a canonical SOP expression and as a list of maxterms.

    Your answer

    β–ΈShow answer

    Answer

    F = A'B'C + AB'C' + ABC' + ABC

    F = Ξ M(0, 2, 3, 5)

  3. 3.2.3Practice

    Write the truth table of F(A, B, C) = Ξ£m(0, 3, 5, 6). What simple gate circuit does it describe?

    Your answer

    β–ΈShow answer

    Answer

    ABCF
    0001
    0010
    0100
    0111
    1000
    1011
    1101
    1110

    F is 1 when an even number of inputs are 1: F = (A βŠ• B βŠ• C)' (an XNOR of three inputs).

  4. 3.2.4Practice

    Convert F(A, B, C, D) = Ξ M(0, 2, 5, 7, 8, 10, 13, 15) into Ξ£m form.

    Your answer

    β–ΈShow answer

    Answer

    F = Ξ£m(1, 3, 4, 6, 9, 11, 12, 14)

3.3 Karnaugh maps

Key ideas

  • Rows and columns of a K-map are in Gray order (00, 01, 11, 10) so neighbours differ by one variable.
  • Group the 1s in rectangles of 1, 2, 4, 8 or 16 cells; groups may wrap around the edges and may overlap.
  • Make the groups as big as possible and use as few groups as possible.
  • Group the 0s instead to get the POS form.
  1. 3.3.1Basic

    Use a 3-variable K-map to simplify F(A, B, C) = Ξ£m(1, 3, 5, 7). Also give the POS form.

    Your answer

    β–ΈShow answer

    Answer

    F = C (POS: F = C)

  2. 3.3.2Basic

    Use a 3-variable K-map to simplify F(A, B, C) = Ξ£m(0, 2, 4, 6).

    Your answer

    β–ΈShow answer

    Answer

    F = C'

  3. 3.3.3Basic

    Use a 3-variable K-map to simplify F(A, B, C) = Ξ£m(1, 2, 3, 7).

    Your answer

    β–ΈShow answer

    Answer

    F = BC + A'B + A'C

  4. 3.3.4Basic

    Use a 3-variable K-map to simplify F(A, B, C) = Ξ£m(0, 1, 2, 4, 5).

    Your answer

    β–ΈShow answer

    Answer

    F = B' + A'C'

  5. 3.3.5Basic

    Use a 3-variable K-map to simplify F(A, B, C) = Ξ£m(2, 3, 4, 5, 6).

    Your answer

    β–ΈShow answer

    Answer

    F = AB' + A'B + BC'

  6. 3.3.6Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(0, 1, 2, 5, 8, 9, 10).

    Your answer

    β–ΈShow answer

    Answer

    F = B'C' + B'D' + A'C'D

  7. 3.3.7Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(4, 5, 6, 7, 12, 13, 14, 15).

    Your answer

    β–ΈShow answer

    Answer

    F = B

  8. 3.3.8Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(0, 2, 5, 7, 8, 10, 13, 15).

    Your answer

    β–ΈShow answer

    Answer

    F = BD + B'D'

  9. 3.3.9Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(1, 3, 4, 6, 9, 11, 12, 14).

    Your answer

    β–ΈShow answer

    Answer

    F = BD' + B'D

  10. 3.3.10Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(0, 1, 3, 7, 8, 9, 11, 15).

    Your answer

    β–ΈShow answer

    Answer

    F = CD + B'C'

  11. 3.3.11Practice

    Use a 4-variable K-map to simplify F(A, B, C, D) = Ξ£m(2, 3, 6, 7, 10, 11, 13, 15).

    Your answer

    β–ΈShow answer

    Answer

    F = A'C + B'C + ABD

  12. 3.3.12Practice

    Give the minimal POS form of F(A, B, C, D) = Ξ£m(0, 1, 2, 3, 4, 6, 8, 9, 10, 11).

    Your answer

    β–ΈShow answer

    Answer

    F = (A' + B')(B' + D') (SOP for comparison: F = B' + A'D')

  13. 3.3.13Challenge

    Draw the 4-variable K-map of F = A'B'C'D' + A'B'CD' + AB'C'D' + AB'CD' and simplify it. Why is the answer so short?

    Your answer

    β–ΈShow answer

    Answer

    F = B'D'. The four 1s are the four corners of the map; corners are neighbours because the map wraps around in both directions.

3.4 Don’t-care conditions and design problems

Key ideas

  • A don’t-care (x or d) is an input combination that never happens or whose output does not matter.
  • Use a don’t-care as a 1 when it makes a group bigger; otherwise ignore it.
  • BCD inputs 1010 to 1111 never happen, so they are don’t-cares.
  1. 3.4.1Practice

    Simplify F(A, B, C, D) = Ξ£m(1, 3, 7, 11, 15) with don’t-cares d(0, 2, 5).

    Your answer

    β–ΈShow answer

    Answer

    F = CD + A'B'

  2. 3.4.2Practice

    Simplify F(A, B, C, D) = Ξ£m(0, 4, 8, 12) with don’t-cares d(2, 6, 10, 14).

    Your answer

    β–ΈShow answer

    Answer

    F = D'

  3. 3.4.3Practice

    Simplify F(A, B, C, D) = Ξ£m(5, 6, 7) with don’t-cares d(10, 11, 12, 13, 14, 15).

    Your answer

    β–ΈShow answer

    Answer

    F = BC + BD

  4. 3.4.4Practice

    Three judges vote with switches A, B and C. A lamp lights when at least two judges press their switch. Write the truth table and the simplest expression.

    Your answer

    β–ΈShow answer

    Answer

    ABCL
    0000
    0010
    0100
    0111
    1000
    1011
    1101
    1111

    L = AB + AC + BC

  5. 3.4.5Challenge

    A BCD digit ABCD drives a 7-segment display. Segment a (the top bar) is on for the digits 0, 2, 3, 5, 6, 7, 8 and 9. Find the simplest expression for segment a, using don’t-cares.

    Your answer

    β–ΈShow answer

    Answer

    a = A + C + BD + B'D'

  6. 3.4.6Challenge

    Design a circuit with a BCD input ABCD whose output is 1 when the digit can be divided by 3 (0 counts as not divisible). Use don’t-cares.

    Your answer

    β–ΈShow answer

    Answer

    Digits 3, 6, 9 β†’ F = AD + BCD' + B'CD

  7. 3.4.7Challenge

    Implement F = AB + CD using only NAND gates.

    Your answer

    β–ΈShow answer

    Answer

    F = AB + CD = ((AB)'Β·(CD)')' β†’ NAND A with B, NAND C with D, then NAND the two results: 3 NAND gates.

  8. 3.4.8Practice

    A car alarm Z sounds when the engine is off (E = 0) and either a door is opened (D = 1) or the glass breaks (G = 1). Write the expression and the truth table.

    Your answer

    β–ΈShow answer

    Answer

    Z = E'(D + G)

    EDGZ
    0000
    0011
    0101
    0111
    1000
    1010
    1100
    1110

Chapter 4

Combinational circuits

Adders, subtractors, comparators, multiplexers, demultiplexers, encoders and decoders.

4.1 Adders and subtractors

Key ideas

  • Half adder: S = A βŠ• B, C = AB.
  • Full adder: S = A βŠ• B βŠ• Cin, Cout = AB + Cin(A βŠ• B). Two half adders + an OR gate make a full adder.
  • Half subtractor: D = A βŠ• B, Bout = A'B. Full subtractor: D = A βŠ• B βŠ• Bin, Bout = A'B + (A βŠ• B)'Bin.
  • An XOR gate with a control input M is a controlled inverter: M = 0 passes B, M = 1 inverts B.
  1. 4.1.1Basic

    Write the truth table of a half adder and give the expressions for S and C.

    Your answer

    β–ΈShow answer

    Answer

    ABSC
    0000
    0110
    1010
    1101

    S = A βŠ• B, C = AB

  2. 4.1.2Basic

    Write the truth table of a full adder.

    Your answer

    β–ΈShow answer

    Answer

    ABCinSCout
    00000
    00110
    01010
    01101
    10010
    10101
    11001
    11111
  3. 4.1.3Practiceself-marked

    Show that Cout = AB + Cin(A βŠ• B) is the same as the majority function AB + ACin + BCin.

    Your answer

    β–ΈShow answer

    Answer

    Both are 1 in exactly the rows Ξ£m(3, 5, 6, 7) (when at least two inputs are 1). K-map of Ξ£m(3, 5, 6, 7): Cout = AΒ·B + AΒ·Cin + BΒ·Cin.

  4. 4.1.4Practice

    A 4-bit parallel adder (7483) adds A3A2A1A0 + B3B2B1B0 with carry-in C0. Find the sum and the carry out:

    (a) A = 0101, B = 0011, C0 = 0

    (b) A = 1001, B = 0111, C0 = 0

    (c) A = 1111, B = 0001, C0 = 1

    (d) A = 1100, B = 1010, C0 = 0

    Your answer

    β–ΈShow answer

    Answer

    (a) S = 1000, C4 = 0 (5 + 3 + 0 = 8)

    (b) S = 0000, C4 = 1 (9 + 7 + 0 = 16)

    (c) S = 0001, C4 = 1 (15 + 1 + 1 = 17)

    (d) S = 0110, C4 = 1 (12 + 10 + 0 = 22)

  5. 4.1.5Basic

    Write the truth table of a half subtractor (A βˆ’ B).

    Your answer

    β–ΈShow answer

    Answer

    ABDBout
    0000
    0111
    1010
    1100
  6. 4.1.6Practice

    Write the truth table of a full subtractor (A βˆ’ B βˆ’ Bin).

    Your answer

    β–ΈShow answer

    Answer

    ABBinDBout
    00000
    00111
    01011
    01101
    10010
    10100
    11000
    11111
  7. 4.1.7Challenge

    A 4-bit adder–subtractor uses XOR gates on the B inputs and the mode line M as carry-in. Work out A βˆ’ B for A = 0110, B = 0011 and for A = 0011, B = 0110. Explain the carry out.

    Your answer

    β–ΈShow answer

    Answer

    M = 1: B is inverted and 1 is added (2’s complement).

    (a) 0110 + 1100 + 1 = 1 0011 β†’ carry out 1 means the result is positive: 0011 = +3.

    (b) 0011 + 1001 + 1 = 0 1101 β†’ carry out 0 means the result is negative, in 2’s complement: 1101 = βˆ’3.

4.2 Comparators

Key ideas

  • 1-bit comparator: (A > B) = AB', (A < B) = A'B, (A = B) = (A βŠ• B)'.
  • A multi-bit comparator looks at the most significant bits first; the 7485 compares two 4-bit numbers and can be cascaded.
  1. 4.2.1Basic

    Write the truth table and the three output expressions of a 1-bit comparator.

    Your answer

    β–ΈShow answer

    Answer

    ABA>BA=BA<B
    00010
    01001
    10100
    11010

    (A > B) = AB', (A = B) = A'B' + AB, (A < B) = A'B

  2. 4.2.2Practice

    Write the expression for A = B for two 2-bit numbers A1A0 and B1B0.

    Your answer

    β–ΈShow answer

    Answer

    (A = B) = (A1 βŠ™ B1)Β·(A0 βŠ™ B0), where βŠ™ is XNOR.

  3. 4.2.3Practice

    Give the 7485 outputs (A>B, A=B, A<B) for: (a) A = 1011, B = 1001 (b) A = 0110, B = 0110 (c) A = 0111, B = 1000

    Your answer

    β–ΈShow answer

    Answer

    (a) 1, 0, 0 β€” decided at bit A1

    (b) 0, 1, 0 (with the cascade input A = B held at 1)

    (c) 0, 0, 1 β€” decided at the MSB

  4. 4.2.4Challengeself-marked

    How do you connect two 7485 chips to compare two 8-bit numbers?

    Your answer

    β–ΈShow answer

    Answer

    The low chip compares bits 0–3; its three outputs go into the cascade inputs (A>B, A=B, A<B) of the high chip, which compares bits 4–7. The low chip’s cascade inputs are tied A=B = 1, A>B = A<B = 0. The high chip’s outputs give the final answer.

4.3 Multiplexers and demultiplexers

Key ideas

  • A multiplexer (MUX) connects one of 2ⁿ data inputs to its output; n select lines choose which.
  • Y of a 4-to-1 MUX = S1'S0'D0 + S1'S0D1 + S1S0'D2 + S1S0D3.
  • Any function of n variables can be made with a 2ⁿ-to-1 MUX (or a 2ⁿ⁻¹-to-1 MUX with the last variable on the data inputs).
  • A demultiplexer (DEMUX) sends one input to one of 2ⁿ outputs.
  1. 4.3.1Basic

    How many select lines do these multiplexers need: 4-to-1, 8-to-1, 16-to-1, 32-to-1?

    Your answer

    β–ΈShow answer

    Answer

    2, 3, 4, 5

  2. 4.3.2Basic

    An 8-to-1 MUX has D0…D7 = 1, 0, 0, 1, 1, 1, 0, 1. What is the output for S2S1S0 = 011, 101, 110?

    Your answer

    β–ΈShow answer

    Answer

    011 β†’ D3 = 1; 101 β†’ D5 = 1; 110 β†’ D6 = 0

  3. 4.3.3Practice

    Implement F(A, B, C) = Ξ£m(1, 2, 6, 7) with an 8-to-1 MUX. What goes on each data input?

    Your answer

    β–ΈShow answer

    Answer

    A, B, C go to S2, S1, S0. D0…D7 = 0, 1, 1, 0, 0, 0, 1, 1.

  4. 4.3.4Challenge

    Implement the same function F(A, B, C) = Ξ£m(1, 2, 6, 7) with a 4-to-1 MUX, using A and B as select lines.

    Your answer

    β–ΈShow answer

    Answer

    For each value of AB, compare F with C:

    ABF for C=0, C=1Data input
    000, 1D0 = C
    011, 0D1 = C'
    100, 0D2 = 0
    111, 1D3 = 1
  5. 4.3.5Challenge

    Implement F(A, B, C) = Ξ£m(0, 2, 3, 5) with a 4-to-1 MUX (A, B on the select lines).

    Your answer

    β–ΈShow answer

    Answer

    D0 = C', D1 = 1, D2 = C, D3 = 0

  6. 4.3.6Basic

    A 1-to-4 DEMUX has data input D = 1 and select S1S0 = 10. Which output is 1?

    Your answer

    β–ΈShow answer

    Answer

    Y2 = 1; Y0, Y1 and Y3 are 0.

  7. 4.3.7Practice

    Write the four output expressions of a 1-to-4 demultiplexer.

    Your answer

    β–ΈShow answer

    Answer

    Y0 = S1'S0'D, Y1 = S1'S0D, Y2 = S1S0'D, Y3 = S1S0D

4.4 Encoders and decoders

Key ideas

  • An encoder turns one active input out of 2ⁿ into an n-bit code. A priority encoder outputs the code of the highest active input.
  • A decoder does the opposite: an n-bit code makes exactly one of 2ⁿ outputs active. The 74LS138 is a 3-to-8 decoder with active-LOW outputs.
  • A decoder plus an OR gate can make any function: OR together the outputs of its minterms.
  • The 7447 decodes BCD for a common-anode 7-segment display.
  1. 4.4.1Basic

    Write the expressions of a 2-to-4 decoder with inputs A, B.

    Your answer

    β–ΈShow answer

    Answer

    Y0 = A'B', Y1 = A'B, Y2 = AB', Y3 = AB

  2. 4.4.2Basic

    An 8-to-3 encoder has input 5 active. What are its outputs A2A1A0?

    Your answer

    β–ΈShow answer

    Answer

    101

  3. 4.4.3Practice

    A 4-to-2 priority encoder gets inputs D3D2D1D0 = 0110. What is the output? Which input wins?

    Your answer

    β–ΈShow answer

    Answer

    D2 has the highest priority among the active inputs, so the output is 10. A valid-output flag V would be 1.

  4. 4.4.4Practice

    A 74LS138 has its enables active and CBA = 110. Give all eight outputs (they are active-LOW).

    Your answer

    β–ΈShow answer

    Answer

    Y6 = 0; all the others (Y0–Y5, Y7) = 1.

  5. 4.4.5Challenge

    Build a full adder from a 3-to-8 decoder and two OR gates.

    Your answer

    β–ΈShow answer

    Answer

    Put A, B, Cin on the decoder inputs.

    S = OR of outputs 1, 2, 4, 7 (S = Ξ£m(1, 2, 4, 7))

    Cout = OR of outputs 3, 5, 6, 7 (Cout = Ξ£m(3, 5, 6, 7))

  6. 4.4.6Practice

    Which segments of a 7-segment display light for the digits 2, 4 and 7?

    Your answer

    β–ΈShow answer

    Answer

    (a) 2: a, b, d, e, g

    (b) 4: b, c, f, g

    (c) 7: a, b, c

  7. 4.4.7Challenge

    Design a 3-bit binary-to-Gray converter. Give the expressions for G2, G1 and G0.

    Your answer

    β–ΈShow answer

    Answer

    G2 = B2, G1 = B2 βŠ• B1, G0 = B1 βŠ• B0

    B2B1B0G2G1G0
    000000
    001001
    010011
    011010
    100110
    101111
    110101
    111100

Part 2 Β· Sequential logic and control

Chapter 5

Sequential logic and the 555 clock

Synchronous and asynchronous circuits, clock signals and how a 555 timer makes them.

5.1 Sequential circuits and clock signals

Key ideas

  • A combinational circuit’s output depends only on its present inputs; a sequential circuit also remembers its past (it has memory).
  • Synchronous circuits change state only on a clock edge; asynchronous circuits change as soon as an input changes.
  • Clock period T = 1/f. Duty cycle = time HIGH Γ· period Γ— 100 %.
  1. 5.1.1Basicself-marked

    Give two differences between a combinational and a sequential circuit, with one example of each.

    Your answer

    β–ΈShow answer

    Answer

    Combinational: no memory, output depends only on the present inputs (e.g. adder, decoder).

    Sequential: has memory (flip-flops), output depends on the inputs and the stored state (e.g. counter, shift register).

  2. 5.1.2Basicself-marked

    Why are synchronous circuits used more often than asynchronous ones?

    Your answer

    β–ΈShow answer

    Answer

    All flip-flops change together on the clock edge, so the timing is predictable. Asynchronous circuits can have races and short false states because signals arrive at slightly different times.

  3. 5.1.3Basic

    A clock signal has a frequency of 25 kHz and is HIGH for 10 Β΅s in each period. Find the period and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    T = 1/25 kHz = 40 Β΅s. Duty cycle = 10/40 Γ— 100 = 25 %.

  4. 5.1.4Practice

    A clock has a period of 0.5 ms and a duty cycle of 60 %. How long is it HIGH and how long LOW? What is its frequency?

    Your answer

    β–ΈShow answer

    Answer

    HIGH = 0.3 ms, LOW = 0.2 ms, f = 1/0.5 ms = 2 kHz.

5.2 The 555 timer

Key ideas

  • Pins: 1 GND, 2 trigger, 3 output, 4 reset, 5 control voltage, 6 threshold, 7 discharge, 8 +Vcc.
  • Inside: two comparators (at β…“ Vcc and β…” Vcc), an SR flip-flop, a discharge transistor and an output stage.
  • Astable: tH = 0.693(RA + RB)C, tL = 0.693Β·RBΒ·C, f = 1.44 / ((RA + 2RB)C), duty = (RA + RB)/(RA + 2RB).
  • Monostable: one pulse of width T = 1.1Β·RΒ·C each time pin 2 is pulled below β…“ Vcc.
  1. 5.2.1Basicself-marked

    Name the eight pins of the 555 timer and say what pins 2, 4 and 6 do.

    Your answer

    β–ΈShow answer

    Answer

    1 GND, 2 trigger, 3 output, 4 reset, 5 control voltage, 6 threshold, 7 discharge, 8 +Vcc.

    Pin 2 starts a cycle when it drops below β…“ Vcc; pin 4 resets the timer when pulled LOW (tie to Vcc if not used); pin 6 ends the HIGH time when it rises above β…” Vcc.

  2. 5.2.2Basic

    With Vcc = 9 V, at what voltages do the two comparators of a 555 switch?

    Your answer

    β–ΈShow answer

    Answer

    β…“ Γ— 9 = 3 V (trigger comparator) and β…” Γ— 9 = 6 V (threshold comparator).

  3. 5.2.3Basic

    A 555 astable has RA = 1 kΞ©, RB = 10 kΞ© and C = 10 Β΅F. Find tH, tL, the frequency and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    tH = 0.693 Γ— (1 kΞ© + 10 kΞ©) Γ— 10 Β΅F = 76.2 ms

    tL = 0.693 Γ— 10 kΞ© Γ— 10 Β΅F = 69.3 ms

    f = 1 / (tH + tL) = 6.87 Hz

    Duty cycle = 52.4 %

  4. 5.2.4Basic

    A 555 astable has RA = 4.7 kΞ©, RB = 47 kΞ© and C = 1 Β΅F. Find tH, tL, the frequency and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    tH = 0.693 Γ— (4.7 kΞ© + 47 kΞ©) Γ— 1 Β΅F = 35.8 ms

    tL = 0.693 Γ— 47 kΞ© Γ— 1 Β΅F = 32.6 ms

    f = 1 / (tH + tL) = 14.6 Hz

    Duty cycle = 52.4 %

  5. 5.2.5Practice

    A 555 astable has RA = 10 kΞ©, RB = 10 kΞ© and C = 100 nF. Find tH, tL, the frequency and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    tH = 0.693 Γ— (10 kΞ© + 10 kΞ©) Γ— 100 nF = 1.39 ms

    tL = 0.693 Γ— 10 kΞ© Γ— 100 nF = 693 Β΅s

    f = 1 / (tH + tL) = 481 Hz

    Duty cycle = 66.7 %

  6. 5.2.6Practice

    A 555 astable has RA = 2.2 kΞ©, RB = 68 kΞ© and C = 10 nF. Find tH, tL, the frequency and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    tH = 0.693 Γ— (2.2 kΞ© + 68 kΞ©) Γ— 10 nF = 486 Β΅s

    tL = 0.693 Γ— 68 kΞ© Γ— 10 nF = 471 Β΅s

    f = 1 / (tH + tL) = 1.04 kHz

    Duty cycle = 50.8 %

  7. 5.2.7Basic

    A 555 monostable has R = 100 kΞ© and C = 10 Β΅F. How long is the output pulse?

    Your answer

    β–ΈShow answer

    Answer

    T = 1.1 Γ— 100 kΞ© Γ— 10 Β΅F = 1.1 s

  8. 5.2.8Basic

    A 555 monostable has R = 47 kΞ© and C = 100 Β΅F. How long is the output pulse?

    Your answer

    β–ΈShow answer

    Answer

    T = 1.1 Γ— 47 kΞ© Γ— 100 Β΅F = 5.17 s

  9. 5.2.9Basic

    A 555 monostable has R = 1 MΞ© and C = 2.2 Β΅F. How long is the output pulse?

    Your answer

    β–ΈShow answer

    Answer

    T = 1.1 Γ— 1 MΞ© Γ— 2.2 Β΅F = 2.42 s

  10. 5.2.10Practice

    Design a 555 astable that gives about 1 kHz with C = 100 nF and RA = 1 kΞ©. Find RB.

    Your answer

    β–ΈShow answer

    Answer

    1.44 / ((RA + 2RB)Β·C) = 1000 β†’ RA + 2RB = 1.44 / (1000 Γ— 100 nF) = 14.4 kΞ© β†’ RB = (14.4 βˆ’ 1) / 2 = 6.7 kΞ© (use 6.8 kΞ©: f β‰ˆ 986 Hz).

  11. 5.2.11Challengeself-marked

    Why can a basic 555 astable never give a duty cycle of 50 % or less? How can a diode across RB fix this?

    Your answer

    β–ΈShow answer

    Answer

    The capacitor charges through RA + RB but discharges only through RB, so tH is always longer than tL. A diode in parallel with RB lets the capacitor charge through RA only: tH = 0.693Β·RAΒ·C and tL = 0.693Β·RBΒ·C. With RA = RB the duty cycle is 50 %.

  12. 5.2.12Practice

    You need a 10-second delay from a 555 monostable with C = 100 Β΅F. Which resistor do you need?

    Your answer

    β–ΈShow answer

    Answer

    R = T / (1.1 C) = 10 / (1.1 Γ— 100 Β΅F) = 90.9 kΞ© (use 91 kΞ© or a 100 kΞ© trimmer).

Chapter 6

Flip-flops

Latches and flip-flops: SR, clocked SR, D, JK, T and master–slave.

6.1 SR latch and clocked SR flip-flop

Key ideas

  • A flip-flop stores one bit. Q is the stored bit and Q' its complement.
  • SR: S = 1 sets Q to 1, R = 1 resets Q to 0, S = R = 0 holds, S = R = 1 is not allowed.
  • A NAND latch has active-LOW inputs (S' and R'); a NOR latch has active-HIGH inputs.
  • A clocked (gated) SR only reacts while the clock/enable is active.
  1. 6.1.1Basicself-marked

    Write the characteristic (truth) table of a clocked SR flip-flop.

    Your answer

    β–ΈShow answer

    Answer

    SRQ⁺Action
    00Qhold
    010reset
    101set
    11?not allowed
  2. 6.1.2Basicself-marked

    Why is S = R = 1 not allowed for a NOR SR latch?

    Your answer

    β–ΈShow answer

    Answer

    Both outputs are forced to 0, so Q and Q' are no longer complements. When S and R return to 0 together, the final state depends on which gate is faster: it cannot be predicted.

  3. 6.1.3Practice

    A clocked SR flip-flop starts with Q = 0. At each clock pulse the inputs (S, R) are: (1,0), (0,0), (0,1), (0,0), (1,0), (1,1). Give Q after each pulse.

    Your answer

    β–ΈShow answer

    Answer

    Q = 1, 1, 0, 0, 1, ? (the last pulse has S = R = 1: invalid, the state cannot be predicted).

  4. 6.1.4Practiceself-marked

    Draw (describe) an SR latch made of two NAND gates and write its truth table.

    Your answer

    β–ΈShow answer

    Answer

    Each NAND output feeds one input of the other NAND. The free inputs are S' and R' (active LOW).

    S'R'QAction
    11Qhold
    011set
    100reset
    001 (Q = Q' = 1)not allowed
  5. 6.1.5Challenge

    Give the characteristic equation of the SR flip-flop and check it for S = 1, R = 0 and Q = 0.

    Your answer

    β–ΈShow answer

    Answer

    Q⁺ = S + R'Q (with SR = 0).

    S = 1, R = 0, Q = 0: Q⁺ = 1 + 1Β·0 = 1 βœ” (set).

6.2 D, JK and T flip-flops

Key ideas

  • D: Q⁺ = D. It removes the forbidden state of the SR by using S = D and R = D'.
  • JK: like SR, but J = K = 1 toggles. Q⁺ = JQ' + K'Q.
  • T: T = 1 toggles, T = 0 holds. Q⁺ = T βŠ• Q. A JK with J = K = T is a T flip-flop.
  • Edge-triggered flip-flops change only on the rising (↑) or falling (↓) clock edge.
  1. 6.2.1Basicself-marked

    Write the truth tables of the D, JK and T flip-flops.

    Your answer

    β–ΈShow answer

    Answer

    DQ⁺
    00
    11
    JKQ⁺
    00Q (hold)
    010 (reset)
    101 (set)
    11Q' (toggle)
    TQ⁺
    0Q (hold)
    1Q' (toggle)
  2. 6.2.2Basic

    A rising-edge D flip-flop starts with Q = 0. D at each rising edge is 1, 1, 0, 1, 0, 0, 1. Give Q after each edge.

    Your answer

    β–ΈShow answer

    Answer

    Q = 1, 1, 0, 1, 0, 0, 1 (Q simply copies D at each edge).

  3. 6.2.3Practice

    A JK flip-flop starts with Q = 0. The inputs (J, K) at each clock edge are (1,0), (1,1), (1,1), (0,0), (0,1), (1,1), (1,0). Give Q after each edge.

    Your answer

    β–ΈShow answer

    Answer

    Q = 1, 0, 1, 1, 0, 1, 1

  4. 6.2.4Practice

    A T flip-flop starts with Q = 1. T at each clock edge is 1, 1, 0, 1, 1, 1, 0. Give Q after each edge.

    Your answer

    β–ΈShow answer

    Answer

    Q = 0, 1, 1, 0, 1, 0, 0

  5. 6.2.5Practiceself-marked

    Show how to turn (a) a JK flip-flop into a D flip-flop (b) a JK into a T flip-flop (c) a D flip-flop into a T flip-flop.

    Your answer

    β–ΈShow answer

    Answer

    (a) J = D, K = D' (an inverter between J and K).

    (b) Join J and K together: J = K = T.

    (c) D = T βŠ• Q (an XOR gate feeding back Q).

  6. 6.2.6Practiceself-marked

    Write the excitation tables of the JK, D and T flip-flops (the inputs needed for each change Q β†’ Q⁺).

    Your answer

    β–ΈShow answer

    Answer

    QQ⁺JKDT
    000x00
    011x11
    10x101
    11x010
  7. 6.2.7Challenge

    Prove the JK characteristic equation Q⁺ = JQ' + K'Q from its truth table with a K-map.

    Your answer

    β–ΈShow answer

    Answer

    Q⁺ is 1 for (J, K, Q) = 001, 100, 101, 110. On a 3-variable map, 100 and 110 give JQ' and 001 and 101 give K'Q. So Q⁺ = JQ' + K'Q.

6.3 Master–slave flip-flops, preset and clear

Key ideas

  • A master–slave flip-flop is two latches: the master follows the inputs while CLK = 1, the slave copies the master when CLK goes to 0.
  • This stops the β€˜race-around’ problem of a level-triggered JK with J = K = 1.
  • Preset (PRE) and clear (CLR) are asynchronous inputs: they act at once, without waiting for the clock.
  1. 6.3.1Basicself-marked

    What is the race-around condition and how does the master–slave arrangement stop it?

    Your answer

    β–ΈShow answer

    Answer

    In a level-triggered JK with J = K = 1, Q keeps toggling as long as the clock is HIGH, so the final state is unknown. In a master–slave flip-flop the master is cut off from the output while it changes, and the slave changes only once, on the falling edge.

  2. 6.3.2Practice

    A 74LS76 JK flip-flop has active-LOW PRE and CLR. What is Q when (a) PRE = 0, CLR = 1 (b) PRE = 1, CLR = 0 (c) PRE = CLR = 1?

    Your answer

    β–ΈShow answer

    Answer

    (a) Q = 1 at once (preset)

    (b) Q = 0 at once (clear)

    (c) normal clocked JK operation

  3. 6.3.3Practiceself-marked

    Why do we say that preset and clear are asynchronous inputs?

    Your answer

    β–ΈShow answer

    Answer

    They change Q immediately, whatever the clock is doing. Normal inputs (J, K, D) only act on a clock edge.

Chapter 7

Frequency division and counters

Dividing frequencies with toggle flip-flops, ripple and synchronous counters, up/down and presettable counters, cascading and counter design.

7.1 Frequency division

Key ideas

  • A toggle flip-flop (D with D = Q', or JK with J = K = 1) changes state on every clock edge: its output frequency is f/2.
  • n toggle flip-flops in a chain divide by 2ⁿ.
  1. 7.1.1Basicself-marked

    How do you connect a D flip-flop so that it divides the clock frequency by 2?

    Your answer

    β–ΈShow answer

    Answer

    Connect Q' back to D. On every active edge Q takes the opposite value, so Q has half the clock frequency (and a 50 % duty cycle).

  2. 7.1.2Basic

    A 32.768 kHz watch crystal clock goes through a chain of toggle flip-flops. What is the frequency after (a) 1 (b) 5 (c) 15 flip-flops?

    Your answer

    β–ΈShow answer

    Answer

    (a) 16.4 kHz

    (b) 1.02 kHz

    (c) 1 Hz

  3. 7.1.3Practice

    How many toggle flip-flops are needed to turn 1 MHz into a frequency below 1 kHz? What frequency do you get?

    Your answer

    β–ΈShow answer

    Answer

    2¹⁰ = 1024 β†’ 10 flip-flops give 1 MHz / 1024 = 977 Hz.

  4. 7.1.4Practice

    A 50 Hz mains signal is shaped into a square wave and divided by 2 six times. What is the output frequency and period?

    Your answer

    β–ΈShow answer

    Answer

    50 / 64 = 0.7813 Hz, period = 1.28 s.

7.2 Ripple (asynchronous) counters

Key ideas

  • In a ripple counter only the first flip-flop gets the clock; each next flip-flop is clocked by the previous output.
  • n flip-flops count 0 to 2ⁿ βˆ’ 1 (modulus 2ⁿ).
  • For a modulus N < 2ⁿ, a NAND gate detects N and clears all flip-flops.
  • Each stage adds its delay: the maximum clock frequency is about 1 / (n Γ— tpd).
  1. 7.2.1Basic

    How many flip-flops are needed for a counter of modulus (a) 8 (b) 10 (c) 60 (d) 100?

    Your answer

    β–ΈShow answer

    Answer

    (a) 3 flip-flops

    (b) 4 flip-flops

    (c) 6 flip-flops

    (d) 7 flip-flops

  2. 7.2.2Basic

    A 4-bit binary ripple counter starts at 0000. What does it show after (a) 9 (b) 16 (c) 37 clock pulses?

    Your answer

    β–ΈShow answer

    Answer

    (a) 1001 (9 mod 16 = 9)

    (b) 0000 (16 mod 16 = 0)

    (c) 0101 (37 mod 16 = 5)

  3. 7.2.3Practice

    Design a MOD-6 ripple counter. How many flip-flops do you need, and which outputs go to the reset NAND gate?

    Your answer

    β–ΈShow answer

    Answer

    3 flip-flops. The counter must clear when it reaches 6 = 110, so the NAND gate takes Q2 and Q1; its output drives the CLR inputs. The counter shows 0 to 5.

  4. 7.2.4Practice

    Design a MOD-10 ripple counter. How many flip-flops do you need, and which outputs go to the reset NAND gate?

    Your answer

    β–ΈShow answer

    Answer

    4 flip-flops. The counter must clear when it reaches 10 = 1010, so the NAND gate takes Q3 and Q1; its output drives the CLR inputs. The counter shows 0 to 9.

  5. 7.2.5Practice

    Design a MOD-12 ripple counter. How many flip-flops do you need, and which outputs go to the reset NAND gate?

    Your answer

    β–ΈShow answer

    Answer

    4 flip-flops. The counter must clear when it reaches 12 = 1100, so the NAND gate takes Q3 and Q2; its output drives the CLR inputs. The counter shows 0 to 11.

  6. 7.2.6Practice

    Design a MOD-5 ripple counter. How many flip-flops do you need, and which outputs go to the reset NAND gate?

    Your answer

    β–ΈShow answer

    Answer

    3 flip-flops. The counter must clear when it reaches 5 = 101, so the NAND gate takes Q2 and Q0; its output drives the CLR inputs. The counter shows 0 to 4.

  7. 7.2.7Practice

    Each flip-flop in a 4-bit ripple counter has a delay of 25 ns. What is the longest settling time and the highest safe clock frequency?

    Your answer

    β–ΈShow answer

    Answer

    4 Γ— 25 ns = 100 ns β†’ fmax β‰ˆ 1 / 100 ns = 10 MHz.

  8. 7.2.8Challenge

    Why does a ripple counter that goes from 0111 to 1000 show false states for a short time? Which false states can appear?

    Your answer

    β–ΈShow answer

    Answer

    The flip-flops change one after the other: 0111 β†’ 0110 β†’ 0100 β†’ 0000 β†’ 1000. The short β€˜glitch’ states 0110, 0100 and 0000 can be decoded by mistake. Synchronous counters avoid this.

  9. 7.2.9Practiceself-marked

    The 7490 is a decade counter and the 7493 a 4-bit binary counter. How do you get MOD-10 and MOD-16 from them?

    Your answer

    β–ΈShow answer

    Answer

    7490: join QA to input B (CLK B) and clock input A; the reset pins R0(1), R0(2) are held LOW β†’ counts 0–9.

    7493: join QA to input B and clock input A; R0(1), R0(2) LOW β†’ counts 0–15.

7.3 Synchronous, up/down and presettable counters

Key ideas

  • In a synchronous counter every flip-flop gets the same clock. A flip-flop toggles when all lower bits are 1 (count up).
  • fmax = 1 / (tpd of a flip-flop + tpd of the AND gates).
  • An up/down counter toggles a stage when all lower bits are 1 (up) or all lower bits are 0 (down).
  • A presettable counter (74190–74193) can be loaded with any starting value.
  1. 7.3.1Basicself-marked

    Give the J and K inputs of each stage of a 4-bit synchronous binary up-counter.

    Your answer

    β–ΈShow answer

    Answer

    J0 = K0 = 1, J1 = K1 = Q0, J2 = K2 = Q0Q1, J3 = K3 = Q0Q1Q2.

  2. 7.3.2Practice

    In a synchronous counter each flip-flop has tpd = 20 ns and each AND gate 10 ns. What is the highest clock frequency? Compare it with a 4-bit ripple counter made of the same flip-flops.

    Your answer

    β–ΈShow answer

    Answer

    Synchronous: 1 / (20 + 10) ns = 33.3 MHz.

    Ripple: 1 / (4 Γ— 20 ns) = 12.5 MHz. The synchronous counter is faster, and the difference grows with more bits.

  3. 7.3.3Basic

    A 4-bit up/down counter is at 0110. Write the next five states when counting (a) up (b) down.

    Your answer

    β–ΈShow answer

    Answer

    (a) 0110 β†’ 0111 β†’ 1000 β†’ 1001 β†’ 1010 β†’ 1011

    (b) 0110 β†’ 0101 β†’ 0100 β†’ 0011 β†’ 0010 β†’ 0001

  4. 7.3.4Practice

    A down counter starts at 0011. What does it show after 5 clock pulses?

    Your answer

    β–ΈShow answer

    Answer

    1110 (it wraps from 0000 to 1111).

  5. 7.3.5Practice

    A 74193 is loaded with 1001 and then counts up. What does it show after 10 pulses? Which output tells you it passed 1111?

    Your answer

    β–ΈShow answer

    Answer

    9 + 10 = 19 β†’ 19 βˆ’ 16 = 3 β†’ 0011. The carry output (CO) gives a pulse when the count rolls over from 1111 to 0000.

  6. 7.3.6Challengeself-marked

    Use a presettable 4-bit counter to make a MOD-12 counter that counts from 4 to 15.

    Your answer

    β–ΈShow answer

    Answer

    Use a counter with synchronous load, e.g. the 74163. Set the data inputs to 0100 and feed the ripple-carry output (RCO = 1 at 15) through an inverter to the active-LOW LOAD input. At the clock edge after 15 the counter loads 4 instead of going to 0: 4, 5, …, 15, 4, … = 12 states.

7.4 Cascading counters

Key ideas

  • Counters in cascade multiply their moduli: MOD-10 followed by MOD-6 = MOD-60.
  • Two cascaded BCD (decade) counters count 00 to 99.
  1. 7.4.1Basic

    What is the total modulus of (a) a MOD-10 and a MOD-6 counter in cascade (b) three MOD-10 counters (c) MOD-16 and MOD-16?

    Your answer

    β–ΈShow answer

    Answer

    (a) 60 (b) 1000 (c) 256

  2. 7.4.2Practice

    A digital clock needs a 1 Hz pulse from a 1 kHz oscillator. Which counters do you cascade?

    Your answer

    β–ΈShow answer

    Answer

    Three decade (MOD-10) counters: 1 kHz Γ· 10 Γ· 10 Γ· 10 = 1 Hz.

  3. 7.4.3Practiceself-marked

    How do you build the seconds part (00–59) of a clock from counters?

    Your answer

    β–ΈShow answer

    Answer

    A decade counter for the units (0–9) clocks a MOD-6 counter for the tens (0–5). The tens counter is reset when it reaches 6 (0110); its reset pulse also clocks the minutes counter.

  4. 7.4.4Challenge

    Two cascaded BCD counters show 3 7. What do they show after 68 more pulses?

    Your answer

    β–ΈShow answer

    Answer

    37 + 68 = 105 β†’ the display only has two digits, so it shows 05 (and has rolled over once).

7.5 Designing counters with any sequence

Key ideas

  • 1. Draw the state diagram. 2. Make the state table (present state β†’ next state).
  • 3. Use the excitation table of the chosen flip-flop to find its inputs.
  • 4. Simplify each input with a K-map (unused states are don’t-cares). 5. Draw the circuit.
  1. 7.5.1Practice

    Design a synchronous MOD-5 counter (0 β†’ 4) with JK flip-flops.

    Your answer

    β–ΈShow answer

    Answer

    Q2Q1Q0Q2⁺Q1⁺Q0⁺J2K2J1K1J0K0
    0000010x0x1x
    0010100x1xx1
    0100110xx01x
    0111001xx1x1
    100000x10x0x

    J2 = Q1Β·Q0

    K2 = 1

    J1 = Q0

    K1 = Q0

    J0 = Q2'

    K0 = 1

    Unused states 101, 110, 111 are don’t-cares.

  2. 7.5.2Challenge

    Design a synchronous counter with JK flip-flops for the sequence 000 β†’ 010 β†’ 101 β†’ 110 β†’ 111 β†’ 000 …

    Your answer

    β–ΈShow answer

    Answer

    Q2Q1Q0Q2⁺Q1⁺Q0⁺J2K2J1K1J0K0
    0000100x1x0x
    0101011xx11x
    101110x01xx1
    110111x0x01x
    111000x1x1x1

    J2 = Q1

    K2 = Q1Β·Q0

    J1 = 1

    K1 = Q0 + Q2'

    J0 = Q1

    K0 = 1

    Unused states 001, 011, 100 were used as don’t-cares.

  3. 7.5.3Challenge

    Design a synchronous counter with D flip-flops that counts only the odd numbers 1, 3, 5, 7.

    Your answer

    β–ΈShow answer

    Answer

    Q2Q1Q0Q2⁺Q1⁺Q0⁺D2D1D0
    001011011
    011101101
    101111111
    111001001

    D2 = Q2Β·Q1' + Q2'Β·Q1

    D1 = Q1'

    D0 = 1

    (Q0 stays at 1 all the time.)

  4. 7.5.4Challenge

    Design a synchronous counter with T flip-flops for the sequence 000 β†’ 001 β†’ 011 β†’ 111 β†’ 110 β†’ 100 β†’ 000 …

    Your answer

    β–ΈShow answer

    Answer

    Q2Q1Q0Q2⁺Q1⁺Q0⁺T2T1T0
    000001001
    001011010
    011111100
    111110001
    110100010
    100000100

    T2 = Q2Β·Q1' + Q2'Β·Q1

    T1 = Q1Β·Q0' + Q1'Β·Q0

    T0 = Q2Β·Q0 + Q2'Β·Q0'

  5. 7.5.5Practiceself-marked

    After designing a counter you must check the unused states. Why?

    Your answer

    β–ΈShow answer

    Answer

    At power-on the counter can start in an unused state. You must make sure every unused state leads back into the main sequence (self-starting counter); otherwise it can get stuck in a loop of unused states.

Chapter 8

Shift registers and shift-register counters

SISO, SIPO, PISO, PIPO, bidirectional and universal shift registers, ring counters and Johnson counters.

8.1 Shift registers

Key ideas

  • A shift register is a chain of D flip-flops with a common clock. Each pulse moves the data one place.
  • SISO: serial in, serial out (a delay line). SIPO: serial in, parallel out. PISO: parallel in, serial out. PIPO: parallel in, parallel out.
  • An n-bit SISO needs n clock pulses to load n bits and n more to read them out.
  • A universal shift register (74194) can shift left, shift right, load in parallel or hold, chosen by S1S0.
  1. 8.1.1Basicself-marked

    Name the four kinds of shift register and give one use for SIPO and one for PISO.

    Your answer

    β–ΈShow answer

    Answer

    SISO, SIPO, PISO, PIPO. SIPO: turning serial data from a UART into a parallel byte, or driving many LEDs from three wires (74HC595). PISO: reading eight buttons on one input wire (74HC165).

  2. 8.1.2Basic

    A 4-bit shift-right register holds 0000. The serial input gets 1, 0, 1, 1 (one bit per clock pulse). Give the contents after each pulse.

    Your answer

    β–ΈShow answer

    Answer

    Pulse 1: 1000

    Pulse 2: 0100

    Pulse 3: 1010

    Pulse 4: 1101

  3. 8.1.3Practice

    A 4-bit shift-right register holds 1010. The serial input gets 0, 1, 1, 0, 0. Give the contents after each pulse.

    Your answer

    β–ΈShow answer

    Answer

    Pulse 1: 0101

    Pulse 2: 1010

    Pulse 3: 1101

    Pulse 4: 0110

    Pulse 5: 0011

  4. 8.1.4Basic

    How many clock pulses do you need to load a byte into an 8-bit SIPO register? How many to read it out of a SISO register?

    Your answer

    β–ΈShow answer

    Answer

    8 pulses to load. A SISO needs 8 pulses to load and 8 more to take it all out at the serial output.

  5. 8.1.5Practice

    A SISO register has 8 stages and is clocked at 1 MHz. How long is a bit delayed between input and output?

    Your answer

    β–ΈShow answer

    Answer

    8 Γ— 1 Β΅s = 8 Β΅s.

  6. 8.1.6Practice

    The 74194 has mode inputs S1S0. What does it do for 00, 01, 10 and 11?

    Your answer

    β–ΈShow answer

    Answer

    00 hold, 01 shift right, 10 shift left, 11 parallel load.

  7. 8.1.7Challenge

    A 4-bit register holds 0011 (= 3). What value does it hold after shifting left once and after shifting right twice (0s shifted in)? What arithmetic does this do?

    Your answer

    β–ΈShow answer

    Answer

    Shift left: 0110 = 6 (Γ— 2). From 0011, shift right twice: 0000 (3 Γ· 4 = 0, the remainder is lost). Shifting left multiplies by 2; shifting right divides by 2.

8.2 Ring and Johnson counters

Key ideas

  • Ring counter: Q of the last stage goes back to D of the first; one 1 circulates. n flip-flops β†’ n states.
  • Johnson (twisted-ring) counter: Q' of the last stage goes back; n flip-flops β†’ 2n states.
  • Each Johnson state can be decoded with one 2-input AND gate.
  1. 8.2.1Basic

    List the states of a 4-bit ring counter that starts at 1000.

    Your answer

    β–ΈShow answer

    Answer

    1000 β†’ 0100 β†’ 0010 β†’ 0001 β†’ 1000 …

  2. 8.2.2Basic

    List the states of a 4-bit Johnson counter that starts at 0000.

    Your answer

    β–ΈShow answer

    Answer

    0000 β†’ 1000 β†’ 1100 β†’ 1110 β†’ 1111 β†’ 0111 β†’ 0011 β†’ 0001 β†’ 0000 …

  3. 8.2.3Basic

    How many states do you get from (a) a 5-bit ring counter (b) a 5-bit Johnson counter (c) a 5-bit binary counter?

    Your answer

    β–ΈShow answer

    Answer

    (a) 5 (b) 10 (c) 32

  4. 8.2.4Practice

    You need a MOD-10 counter with outputs that never glitch. How many flip-flops does a Johnson counter need, and how many a ring counter?

    Your answer

    β–ΈShow answer

    Answer

    Johnson: 5 flip-flops (2 Γ— 5 = 10). Ring: 10 flip-flops.

  5. 8.2.5Practice

    A 3-bit Johnson counter is clocked at 600 Hz. What is the frequency at each output?

    Your answer

    β–ΈShow answer

    Answer

    The sequence has 6 states and each output is HIGH for 3 of them, so every output is a 600/6 = 100 Hz square wave (50 % duty), shifted in time from the others.

  6. 8.2.6Challenge

    Which two outputs must an AND gate use to decode the state 1100 of a 4-bit Johnson counter (sequence 0000, 1000, 1100, …)?

    Your answer

    β–ΈShow answer

    Answer

    1100 is the only state where Q1 = 1 and Q2 = 0 (with the bits written Q0Q1Q2Q3), so the gate is Q1Β·Q2'.

Chapter 9

Logic families

TTL and CMOS, their sub-families and the parameters that describe a logic gate: voltage levels, noise margin, fan-out, delay and power.

9.1 Families and parameters

Key ideas

  • TTL (bipolar transistors, 5 V): 74, 74LS, 74S, 74AS, 74ALS, 74F. CMOS (MOSFETs): 4000, 74HC, 74HCT, 74AC, 74LVC.
  • Standard TTL: VIH = 2 V, VIL = 0.8 V, VOH = 2.4 V, VOL = 0.4 V.
  • Noise margins: NMH = VOH βˆ’ VIH and NML = VIL βˆ’ VOL.
  • Fan-out = the smaller of IOH/IIH and IOL/IIL.
  • Speed–power product = propagation delay Γ— power per gate (in pJ).
  1. 9.1.1Basicself-marked

    Name three TTL sub-families and three CMOS sub-families.

    Your answer

    β–ΈShow answer

    Answer

    TTL: 74 (standard), 74LS (low-power Schottky), 74F (fast). CMOS: 4000 series, 74HC (high-speed CMOS), 74HCT (HC with TTL-level inputs).

  2. 9.1.2Basic

    Find the HIGH and LOW noise margins of standard TTL.

    Your answer

    β–ΈShow answer

    Answer

    NMH = 2.4 βˆ’ 2.0 = 0.4 V

    NML = 0.8 βˆ’ 0.4 = 0.4 V

  3. 9.1.3Practice

    A 74HC gate at 5 V has VOH = 4.4 V, VIH = 3.5 V, VIL = 1.5 V, VOL = 0.1 V. Find its noise margins and compare them with TTL.

    Your answer

    β–ΈShow answer

    Answer

    NMH = 4.4 βˆ’ 3.5 = 0.9 V, NML = 1.5 βˆ’ 0.1 = 1.4 V. CMOS has much bigger noise margins, so it is less sensitive to noise.

  4. 9.1.4Basic

    Standard TTL: IOH = 400 Β΅A, IIH = 40 Β΅A, IOL = 16 mA, IIL = 1.6 mA. What is the fan-out?

    Your answer

    β–ΈShow answer

    Answer

    HIGH: 400/40 = 10, LOW: 16/1.6 = 10 β†’ fan-out = 10.

  5. 9.1.5Practice

    A 74LS gate has IOH = 400 Β΅A, IOL = 8 mA, and each 74LS input needs IIH = 20 Β΅A, IIL = 0.4 mA. How many 74LS inputs can it drive?

    Your answer

    β–ΈShow answer

    Answer

    HIGH: 400/20 = 20, LOW: 8/0.4 = 20 β†’ fan-out = 20.

  6. 9.1.6Challenge

    A 74LS output (IOL = 8 mA, IOH = 400 Β΅A) must drive standard 74 inputs (IIL = 1.6 mA, IIH = 40 Β΅A). What is the fan-out?

    Your answer

    β–ΈShow answer

    Answer

    LOW: 8/1.6 = 5, HIGH: 400/40 = 10 β†’ fan-out = 5 (the LOW state limits it).

  7. 9.1.7Practice

    A gate has tPLH = 11 ns and tPHL = 7 ns. What is its average propagation delay?

    Your answer

    β–ΈShow answer

    Answer

    tpd = (11 + 7) / 2 = 9 ns.

  8. 9.1.8Practice

    A TTL chip with four gates draws ICCH = 8 mA and ICCL = 22 mA at 5 V. Find the average power per gate. With tpd = 10 ns, what is the speed–power product?

    Your answer

    β–ΈShow answer

    Answer

    Average ICC = (8 + 22)/2 = 15 mA β†’ P = 5 V Γ— 15 mA = 75 mW per chip = 18.75 mW per gate.

    Speed–power product = 10 ns Γ— 18.75 mW = 187.5 pJ.

  9. 9.1.9Basicself-marked

    Give two advantages of CMOS over TTL and one advantage of TTL.

    Your answer

    β–ΈShow answer

    Answer

    CMOS: very low power when not switching, wide supply range (3–15 V for the 4000 series), large noise margins, high fan-out.

    TTL: less sensitive to static electricity; older TTL was faster than early CMOS.

9.2 Inside the gates: TTL, PMOS, NMOS and CMOS

Key ideas

  • Standard TTL NAND: multi-emitter input transistor, phase splitter and totem-pole output.
  • Open-collector outputs need a pull-up resistor and can be joined (wired-AND).
  • CMOS inverter: a P-MOSFET to Vdd and an N-MOSFET to ground; one of them is always off, so almost no current flows when idle.
  • CMOS NAND: two P-MOSFETs in parallel to Vdd and two N-MOSFETs in series to ground.
  1. 9.2.1Basicself-marked

    Explain how a CMOS inverter works for input 0 and input 1.

    Your answer

    β–ΈShow answer

    Answer

    Input 0: the P-MOSFET is on and the N-MOSFET is off β†’ the output is connected to Vdd (1).

    Input 1: the N-MOSFET is on and the P-MOSFET is off β†’ the output is connected to ground (0).

  2. 9.2.2Practice

    In a 2-input CMOS NAND gate, which transistors are on when A = 1 and B = 0? What is the output?

    Your answer

    β–ΈShow answer

    Answer

    The P-MOSFET of B is on (it is in parallel to Vdd), the N-MOSFET of A is on but the N-MOSFET of B is off, so the series path to ground is open. Output = 1.

  3. 9.2.3Practiceself-marked

    Why must unused CMOS inputs never be left floating?

    Your answer

    β–ΈShow answer

    Answer

    A floating CMOS input picks up noise and static, can sit half-way between 0 and 1, turn both MOSFETs on (extra current, heat) and make the output oscillate. Tie it to Vdd or ground (or to a used input).

  4. 9.2.4Practiceself-marked

    What is a totem-pole output? Why must two totem-pole outputs never be connected together?

    Your answer

    β–ΈShow answer

    Answer

    Two transistors stacked between Vcc and ground: one pulls HIGH, the other pulls LOW. If one output is HIGH and the other LOW, a large current flows from Vcc to ground through both and can destroy them.

  5. 9.2.5Challenge

    Three open-collector outputs are joined to one pull-up resistor. What logic function does the joined wire give?

    Your answer

    β–ΈShow answer

    Answer

    Wired-AND: the wire is HIGH only if all three outputs are HIGH (off); any output that is LOW pulls the wire LOW.

Chapter 10

Introduction to control systems

Transducers, sensors, actuators, and open-loop versus closed-loop control.

10.1 Transducers, sensors and actuators

Key ideas

  • A transducer changes one form of energy into another.
  • A sensor (input transducer) measures a physical quantity and gives an electrical signal.
  • An actuator (output transducer) turns an electrical signal into action: movement, heat, light, sound.
  1. 10.1.1Basic

    Sort these into sensors and actuators: thermistor, DC motor, LDR, solenoid valve, microphone, loudspeaker, push-button, relay, ultrasonic sensor, heater.

    Your answer

    β–ΈShow answer

    Answer

    Sensors: thermistor, LDR, microphone, push-button, ultrasonic sensor.

    Actuators: DC motor, solenoid valve, loudspeaker, relay, heater.

  2. 10.1.2Basicself-marked

    Give the energy change made by: (a) a microphone (b) a loudspeaker (c) a solar cell (d) an LED (e) a thermocouple.

    Your answer

    β–ΈShow answer

    Answer

    (a) sound β†’ electrical (b) electrical β†’ sound (c) light β†’ electrical (d) electrical β†’ light (e) heat β†’ electrical

  3. 10.1.3Practiceself-marked

    Choose a sensor for each job: (a) detect a person in a room (b) measure the level of water in a tank (c) count bottles on a conveyor (d) measure motor speed.

    Your answer

    β–ΈShow answer

    Answer

    (a) PIR motion sensor (b) ultrasonic or float sensor (c) infrared beam (photoelectric) sensor (d) tachogenerator or optical encoder

  4. 10.1.4Practiceself-marked

    What is the difference between an analogue and a digital sensor? Give one example of each.

    Your answer

    β–ΈShow answer

    Answer

    An analogue sensor gives a signal that changes continuously with the quantity (thermistor, LDR). A digital sensor gives only ON/OFF or a coded number (limit switch, digital temperature sensor).

10.2 Open-loop and closed-loop control

Key ideas

  • A control system has an input (set point), a controller, an actuator and the process (plant) being controlled.
  • Open loop: no measurement of the output; the controller cannot correct errors.
  • Closed loop: a sensor feeds the output back; the controller compares it with the set point (error = set point βˆ’ feedback) and corrects it.
  1. 10.2.1Basic

    Say whether each system is open-loop or closed-loop: (a) a toaster with a timer (b) an oven thermostat (c) a washing machine that runs a fixed program (d) a car’s cruise control (e) traffic lights on a timer (f) a water tank with a float valve.

    Your answer

    β–ΈShow answer

    Answer

    (a) open (b) closed (c) open (d) closed (e) open (f) closed

  2. 10.2.2Basicself-marked

    Draw (describe) the block diagram of a closed-loop temperature control system and name each block.

    Your answer

    β–ΈShow answer

    Answer

    Set point β†’ comparator (error detector) β†’ controller β†’ actuator (heater) β†’ process (room/oven) β†’ output temperature. A sensor (thermistor) measures the temperature and feeds it back to the comparator.

  3. 10.2.3Practiceself-marked

    Give two advantages and two disadvantages of closed-loop control compared with open-loop.

    Your answer

    β–ΈShow answer

    Answer

    Advantages: corrects disturbances automatically; more accurate.

    Disadvantages: more complex and costly (needs sensors); can become unstable (oscillate) if badly tuned.

  4. 10.2.4Practice

    A room heater has its set point at 22 Β°C. The sensor reads 19 Β°C. What is the error and what does the controller do?

    Your answer

    β–ΈShow answer

    Answer

    Error = 22 βˆ’ 19 = +3 Β°C. The controller switches the heater on (or increases its power) until the error is about 0.

  5. 10.2.5Challengeself-marked

    Why does a simple ON/OFF thermostat use a small dead band (hysteresis), e.g. ON below 21.5 Β°C and OFF above 22.5 Β°C?

    Your answer

    β–ΈShow answer

    Answer

    Without a dead band the heater would switch on and off very quickly around 22 Β°C, wearing out the relay. The dead band makes the temperature swing a little but keeps the switching slow.

Chapter 11

Sequential function charts (SFC / GRAFCET)

Steps, transitions and actions; action qualifiers; and the rules for serial, selection and parallel branches.

11.1 Steps, transitions and actions

Key ideas

  • A step is a stable state of the machine; the initial step has a double square. An active step has a token.
  • A transition sits between two steps and has a condition (receptivity). It fires when the step before it is active and its condition is true.
  • Actions are written in a rectangle beside the step. Qualifiers: N (while active), S (set, stored), R (reset), L (time limited), D (delayed), P (pulse).
  1. 11.1.1Basicself-marked

    What do these SFC symbols mean: a double square, a single square, a short horizontal bar on a link, a rectangle beside a step?

    Your answer

    β–ΈShow answer

    Answer

    Double square: initial step. Single square: normal step. Bar on the link: transition (with its condition written beside it). Rectangle: the action done while the step is active.

  2. 11.1.2Basicself-marked

    Give the meaning of the action qualifiers N, S, R, L, D and P.

    Your answer

    β–ΈShow answer

    Answer

    N: action on while the step is active. S: set (stays on after the step ends). R: reset an action set earlier. L: on for a limited time. D: starts after a delay. P: a single pulse when the step becomes active.

  3. 11.1.3Practiceself-marked

    A press works like this: when the start button S is pressed, the ram goes down (DOWN) until the low limit switch L1; then it goes up (UP) until the high limit switch L0; then it waits for the next start. Write the SFC.

    Your answer

    β–ΈShow answer

    Answer

    [[0]]   (wait)
      |
      + SΒ·L0
      |
     [1] β€” DOWN
      |
      + L1
      |
     [2] β€” UP
      |
      + L0
      |
     back to step 0
  4. 11.1.4Practiceself-marked

    A mixer tank: press START β†’ open valve V1 until the level sensor H is reached β†’ run the mixer M for 30 s β†’ open the drain valve V2 until the low sensor B β†’ back to the start. Write the SFC with the timer.

    Your answer

    β–ΈShow answer

    Answer

    [[0]]
      + START
     [1] β€” V1
      + H
     [2] β€” M ; start timer T1 = 30 s
      + T1 done
     [3] β€” V2
      + B
     back to 0
  5. 11.1.5Challengeself-marked

    Why does an action with the S qualifier need a later step with the R qualifier?

    Your answer

    β–ΈShow answer

    Answer

    S keeps the action on even after its step is no longer active. Without a step that resets it (R), the action would stay on for ever.

11.2 Rules of evolution: serial, selection and parallel branches

Key ideas

  • Serial: steps follow each other one by one.
  • Selection (OR) branch: a single horizontal line; only one of the paths is taken, the one whose transition is true first. Conditions should exclude each other.
  • Parallel (AND) branch: a double horizontal line; all paths start together, and the chart only continues when every path has finished (synchronisation).
  • A transition fires when (1) all the steps before it are active and (2) its condition is true. Firing deactivates the steps before and activates the steps after it, at the same moment.
  1. 11.2.1Basicself-marked

    What is the difference between a selection branch and a parallel branch in an SFC? How are they drawn?

    Your answer

    β–ΈShow answer

    Answer

    Selection: one path out of several is chosen (single horizontal line, a transition on each path). Parallel: all paths run at the same time (double horizontal line, one common transition before and after).

  2. 11.2.2Practiceself-marked

    A sorting machine measures a box: if it is big (G) it pushes it left (PL); if it is small (G') it pushes it right (PR); then it returns to waiting. Draw the SFC with a selection branch.

    Your answer

    β–ΈShow answer

    Answer

    [[0]]
      + box present
     [1] β€” measure
      ─────┬────────────┬─────
           + G          + G'
          [2] β€” PL     [3] β€” PR
           + left end   + right end
      ─────┴────────────┴─────
     back to 0
  3. 11.2.3Practiceself-marked

    A machine must drill (step D) and polish (step P) at the same time; when both are finished it unloads the part. Which kind of branch do you use and when does the unload step start?

    Your answer

    β–ΈShow answer

    Answer

    A parallel (AND) branch: after the start transition both steps D and P become active together. The unload step only starts when both branches have reached their last step and the common transition after the double line is true.

  4. 11.2.4Challenge

    Steps 4 and 7 are active. The transition after them (with a double line) has the condition β€˜ready’ = 1. Step 5 is not active. Which steps are active after the transition fires if it leads to step 8?

    Your answer

    β–ΈShow answer

    Answer

    Only step 8. Firing deactivates 4 and 7 and activates 8 at the same moment (step 5 plays no part).

Chapter 12

Programmable logic controllers (PLC)

What a PLC is, how it scans its program, and programming in ladder logic, statement list and function blocks.

12.1 PLC structure and operation

Key ideas

  • A PLC is an industrial computer: power supply, CPU, memory, input modules, output modules and a programming device.
  • Scan cycle: 1) read all inputs, 2) run the program, 3) update all outputs, 4) housekeeping/communication, then repeat.
  • Advantages over relay logic: easy to change, fewer wires, fault finding, timers and counters built in, small size.
  1. 12.1.1Basicself-marked

    Name the main parts of a PLC and say what each one does.

    Your answer

    β–ΈShow answer

    Answer

    Power supply (gives the PLC its voltages), CPU (runs the program), memory (stores the program and data), input module (connects switches and sensors), output module (drives lamps, relays, motors through contactors), programming device (PC or handheld to write the program).

  2. 12.1.2Basicself-marked

    Describe the four steps of the PLC scan cycle.

    Your answer

    β–ΈShow answer

    Answer

    1. Read inputs into the input image table. 2. Execute the program rung by rung, top to bottom. 3. Write the results to the outputs. 4. Housekeeping and communication. Then start again.

  3. 12.1.3Practice

    A PLC has a scan time of 10 ms. A push-button is pressed for only 4 ms. Can the PLC miss it? Explain.

    Your answer

    β–ΈShow answer

    Answer

    Yes. Inputs are only read once per scan; if the 4 ms press happens between two input reads, the PLC never sees it. Fast signals need a high-speed input or an interrupt.

  4. 12.1.4Basicself-marked

    Give four advantages of a PLC over hard-wired relay control.

    Your answer

    β–ΈShow answer

    Answer

    The program can be changed without rewiring; much less wiring and fewer relays; built-in timers and counters; easy fault finding with status lights and the programming software; smaller, more reliable, can communicate with other systems.

12.2 Ladder logic

Key ideas

  • The left rail is the power line. A rung is read from left to right; rungs are read from top to bottom.
  • β€”| |β€” normally open contact (true when the input is 1). β€”|/|β€” normally closed contact (true when the input is 0). β€”( )β€” output coil.
  • Contacts in series = AND. Contacts in parallel = OR.
  • A seal-in (latching) contact keeps a motor running after the start button is released.
  1. 12.2.1Basicself-marked

    Draw the ladder rung for Y = AΒ·B (AND) and for Y = A + B (OR).

    Your answer

    β–ΈShow answer

    Answer

    AND:  |--[ A ]--[ B ]--------( Y )--|
    
    OR:   |--+--[ A ]--+-------( Y )--|
             |         |
             +--[ B ]--+
  2. 12.2.2Basicself-marked

    Draw the ladder rung for Y = A' (NOT) and for Y = AΒ·B'.

    Your answer

    β–ΈShow answer

    Answer

    NOT:   |--[/A ]-----------( Y )--|
    
    AΒ·B':  |--[ A ]--[/B ]----( Y )--|
  3. 12.2.3Practiceself-marked

    Draw a motor start/stop circuit with a seal-in contact. START is a normally open button I0.0, STOP a normally closed button I0.1, the motor M is Q0.0.

    Your answer

    β–ΈShow answer

    Answer

    |--+--[ I0.0 ]--+--[ I0.1 ]--( Q0.0 )--|
       |            |
       +--[ Q0.0 ]--+

    Pressing START energises Q0.0; its own contact in parallel keeps it on after START is released. STOP (wired NC, so the input is 1 when not pressed) opens the rung and stops the motor.

  4. 12.2.4Practiceself-marked

    Write the ladder rung for Y = (A + B)Β·C'.

    Your answer

    β–ΈShow answer

    Answer

    |--+--[ A ]--+--[/C ]--( Y )--|
       |        |
       +--[ B ]--+
  5. 12.2.5Practiceself-marked

    Write the ladder rung for an XOR: Y = AΒ·B' + A'Β·B.

    Your answer

    β–ΈShow answer

    Answer

    |--+--[ A ]--[/B ]--+--( Y )--|
       |               |
       +--[/A ]--[ B ]--+
  6. 12.2.6Practiceself-marked

    Write the statement list (STL) for the start/stop rung with seal-in (Siemens style).

    Your answer

    β–ΈShow answer

    Answer

    A(
    O   I0.0
    O   Q0.0
    )
    A   I0.1
    =   Q0.0
  7. 12.2.7Challengeself-marked

    A tank pump P must run when the low-level switch L is ON and must stop when the high-level switch H turns ON. It must keep running between the two levels. Write the ladder logic.

    Your answer

    β–ΈShow answer

    Answer

    |--+--[ L ]--+--[/H ]--( P )--|
       |        |
       +--[ P ]--+

    L starts the pump, the P contact holds it on while the level rises, and H breaks the rung when the tank is full.

  8. 12.2.8Challenge

    Two buttons A and B must both be pressed (two-hand safety control) to start a press, and a light curtain C (1 = clear) must be clear. Write the logic and the ladder rung.

    Your answer

    β–ΈShow answer

    Answer

    PRESS = AΒ·BΒ·C

    |--[ A ]--[ B ]--[ C ]--( PRESS )--|
  9. 12.2.9Practiceself-marked

    Name the three common PLC programming languages besides ladder logic and explain function block diagrams (FBD) briefly.

    Your answer

    β–ΈShow answer

    Answer

    Statement list (STL / instruction list), function block diagram (FBD) and sequential function chart (SFC); structured text (ST) is also common. In FBD the logic is drawn as boxes (AND, OR, timers) with the inputs on the left and the outputs on the right, like a logic circuit.

  10. 12.2.10Practiceself-marked

    An ON-delay timer T1 has a preset of 5 s and is enabled by input I0.2. Describe what output Q0.1 (driven by the timer’s done bit) does when I0.2 is switched on for 3 s and then for 8 s.

    Your answer

    β–ΈShow answer

    Answer

    3 s: the timer does not reach 5 s, so Q0.1 stays off and the timer resets when I0.2 goes off.

    8 s: Q0.1 turns on 5 s after I0.2 goes on, stays on for the remaining 3 s and goes off together with I0.2.

Revision

Chapter 13

Mixed revision test

Exam-style questions that mix every chapter. Try them without looking back, then check your answers.

13.1 Part A: short questions

  1. 13.1.1Basic

    Convert (222)₁₀ to binary, octal, hexadecimal and BCD.

    Your answer

    β–ΈShow answer

    Answer

    (11011110)β‚‚ = (336)β‚ˆ = (DE)₁₆; BCD: 0010 0010 0010

  2. 13.1.2Basic

    Write βˆ’58 in 8-bit 2’s complement.

    Your answer

    β–ΈShow answer

    Answer

    11000110

  3. 13.1.3Basic

    Give the Gray code of 1100β‚‚.

    Your answer

    β–ΈShow answer

    Answer

    1010

  4. 13.1.4Basic

    Which two gates are called universal gates and why?

    Your answer

    β–ΈShow answer

    Answer

    NAND and NOR: any other gate (and so any logic circuit) can be built from only NAND gates or only NOR gates.

  5. 13.1.5Basic

    How many select lines does a 64-to-1 multiplexer need?

    Your answer

    β–ΈShow answer

    Answer

    6 (2⁢ = 64)

  6. 13.1.6Basic

    What is the frequency at the output of the 4th flip-flop of a ripple counter clocked at 48 kHz?

    Your answer

    β–ΈShow answer

    Answer

    48 kHz / 2⁴ = 3 kHz

  7. 13.1.7Basic

    How many states does a 6-bit Johnson counter have?

    Your answer

    β–ΈShow answer

    Answer

    12

  8. 13.1.8Basic

    Is a street light switched on by a light sensor at dusk an open-loop or a closed-loop system? Explain.

    Your answer

    β–ΈShow answer

    Answer

    Open-loop: the sensor measures the daylight, not the light the lamp produces, so the output is not fed back.

13.2 Part B: longer problems

  1. 13.2.1Practice

    Simplify F(A, B, C, D) = Ξ£m(0, 1, 4, 5, 6, 7, 12, 13) with a K-map. Give the SOP and the POS forms.

    Your answer

    β–ΈShow answer

    Answer

    SOP: F = A'B + BC' + A'C'

    POS: F = (A' + C')(A' + B)(B + C')

  2. 13.2.2Practice

    Design a circuit that compares two 2-bit numbers A = A1A0 and B = B1B0 and gives G = 1 when A > B.

    Your answer

    β–ΈShow answer

    Answer

    G = 1 for (A1A0B1B0) = Ξ£m(4, 8, 9, 12, 13, 14)

    G = A1Β·B1' + A1Β·A0Β·B0' + A0Β·B1'Β·B0'

  3. 13.2.3Practice

    A 555 astable has RA = 2.2 kΞ©, RB = 4.7 kΞ© and C = 47 nF. Find the frequency and the duty cycle.

    Your answer

    β–ΈShow answer

    Answer

    tH = 225 Β΅s, tL = 153 Β΅s, f = 2.65 kHz, duty = 59.5 %

  4. 13.2.4Challenge

    Design a synchronous MOD-6 counter (0 β†’ 5) with D flip-flops.

    Your answer

    β–ΈShow answer

    Answer

    Q2Q1Q0Q2⁺Q1⁺Q0⁺D2D1D0
    000001001
    001010010
    010011011
    011100100
    100101101
    101000000

    D2 = Q2Β·Q0' + Q1Β·Q0

    D1 = Q1Β·Q0' + Q2'Β·Q1'Β·Q0

    D0 = Q0'

  5. 13.2.5Practice

    Write the truth table and the simplest expression for a circuit with three inputs whose output is 1 when exactly one input is 1.

    Your answer

    β–ΈShow answer

    Answer

    ABCY
    0000
    0011
    0101
    0110
    1001
    1010
    1100
    1110

    Y = AB'C' + A'BC' + A'B'C (no simpler SOP exists)

  6. 13.2.6Practice

    A 4-bit shift-left register holds 0110. 1, 1, 0 are shifted in at the right. Give the contents after each pulse.

    Your answer

    β–ΈShow answer

    Answer

    Pulse 1: 1101

    Pulse 2: 1011

    Pulse 3: 0110

  7. 13.2.7Challengeself-marked

    Draw the SFC and the ladder logic for a garage door: button B opens it (OPEN) until the top switch T; after 10 s it closes (CLOSE) until the bottom switch D; a light beam L (1 = blocked) during closing makes it open again.

    Your answer

    β–ΈShow answer

    Answer

    SFC:

    [[0]]
      + B
     [1] β€” OPEN
      + T
     [2] β€” timer 10 s
      + 10 s done
     [3] β€” CLOSE
      ──┬─────────┬──
        + D       + L
      back to 0   back to 1 (open again)

    Ladder (one rung per step, using memory bits M1…M3 for the steps):

    |--[ M1 ]-----------------( OPEN )--|
    |--[ M3 ]--[/L ]-----------( CLOSE )-|
  8. 13.2.8Practiceself-marked

    Compare TTL and CMOS: fill in the table.

    Your answer

    β–ΈShow answer

    Answer

    TTL (74LS)CMOS (74HC)
    TransistorsbipolarMOSFET
    Supply5 V Β± 5 %2–6 V
    Idle powera few mW per gatealmost zero
    Noise marginabout 0.4 Vabout 1 V or more
    Unused inputsfloat HIGH (still tie them)must never float

Notation: A' means NOT A (A with a bar), Β· or writing letters together means AND, + means OR, βŠ• means XOR and βŠ™ means XNOR. Ξ£m lists the minterms (rows where the output is 1), Ξ M the maxterms (rows where it is 0).