วัตถุประสงค์การเรียนรู้Learning Objectives
  • อธิบายสัญญาณดิจิทัล (ลอจิก 0/1, LOW/HIGH) และต่างจากสัญญาณอนาล็อกอย่างไร
  • บอกหน้าที่และเขียนตารางความจริงของเกต 7 ชนิดได้
  • อ่านสัญลักษณ์ของแต่ละเกตได้
  • เข้าใจว่า NAND/NOR เป็น "เกตสากล (universal)" สร้างเกตอื่นได้ทั้งหมด
  • รู้จัก IC ลอจิกตระกูล 74xx / CMOS 4000 และข้อควรระวัง
  • Explain digital signals (logic 0/1, LOW/HIGH) and how they differ from analog
  • State the function and write the truth table of the 7 gates
  • Read each gate's symbol
  • Understand that NAND/NOR are "universal" gates — any gate can be built from them
  • Recognise 74xx / CMOS 4000 logic ICs and their cautions
สัญญาณดิจิทัล: โลกของ 0 กับ 1Digital Signals: the World of 0 and 1
  • สัญญาณดิจิทัลมีแค่ 2 สถานะ: 0 (LOW, ~0 V) และ 1 (HIGH, ~Vcc)
  • ต่างจากอนาล็อกที่แรงดันค่อยๆ เปลี่ยนได้ทุกค่า
  • ลอจิกเกต คือวงจรที่รับอินพุต 0/1 แล้วให้เอาต์พุต 0/1 ตามกฎตรรกะ
  • นำเกตมาต่อกันเป็นวงจรคำนวณ → เป็นพื้นฐานของ คอมพิวเตอร์และดิจิทัลทั้งหมด
  • A digital signal has only two states: 0 (LOW, ~0 V) and 1 (HIGH, ~Vcc)
  • Unlike analog, whose voltage can take any value
  • A logic gate takes 0/1 inputs and gives a 0/1 output by a logic rule
  • Connect gates together to compute → the basis of all computers and digital systems
💡 เปรียบเทียบง่ายๆ 💡 Simple analogy

ลอจิกเกตเหมือน "สวิตช์ไฟที่มีกฎ" — เช่นเกต AND คือ "ไฟติดก็ต่อเมื่อกดสวิตช์ทั้งสองพร้อมกัน" ส่วน OR คือ "กดอันใดอันหนึ่งไฟก็ติด"

A gate is like a "light switch with a rule" — AND means "the light turns on only if both switches are pressed", OR means "press either one and it turns on".

🔗 เกตเหล่านี้สร้างจากทรานซิสเตอร์และบรรจุใน IC — ทบทวนได้ในบท ทรานซิสเตอร์ (สวิตช์) และ IC วงจรรวม 🔗 Gates are built from transistors and packaged in ICs — see the Transistor (as a switch) and IC basics lessons.
เกตพื้นฐาน 7 ชนิดThe 7 Basic Gates
เกตGateนิพจน์BooleanกฎRule
ANDY = A·Bเป็น 1 เมื่อ ทุกอินพุต เป็น 11 only if all inputs are 1
ORY = A+Bเป็น 1 เมื่อ อย่างน้อยหนึ่ง อินพุตเป็น 11 if any input is 1
NOTY = Āกลับค่า (อินเวอร์เตอร์)Inverts the input
NANDY = A·B̅AND แล้วกลับค่าAND then inverted
NORY = A+B̅OR แล้วกลับค่าOR then inverted
XORY = A⊕Bเป็น 1 เมื่ออินพุต ต่างกัน1 when inputs differ
XNORY = A⊕B̅เป็น 1 เมื่ออินพุต เหมือนกัน1 when inputs are the same

ตารางความจริงรวม (2 อินพุต)Combined truth table (2 inputs)

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

NOT

AY
01
10
⭐ ลองเล่น: สลับอินพุตดูเอาต์พุต⭐ Try It: Toggle the Inputs

เลือกชนิดเกต แล้วกดปุ่ม A / B เพื่อสลับค่า 0↔1 ดูว่าเอาต์พุต Y (LED) ติดหรือดับ และแถวที่ตรงกันในตารางความจริงจะถูกไฮไลต์

Pick a gate, then click A / B to toggle 0↔1 and watch the output Y (LED) turn on/off — the matching truth-table row is highlighted.

สายสีเขียว = ลอจิก 1, สีเทา = ลอจิก 0 • LED เขียว = เอาต์พุต 1 Green wire = logic 1, grey = logic 0 • green LED = output 1

เลือกเกตGate

กดเพื่อสลับ 0/1 (NOT ใช้แค่ A)Click to toggle 0/1 (NOT uses A only)

เกตสากล (Universal Gates)Universal Gates
  • NAND และ NOR เรียกว่า "เกตสากล"
  • ใช้ NAND อย่างเดียว (หรือ NOR อย่างเดียว) สร้างเกตอื่นได้ ครบทุกชนิด
  • เช่น NAND ที่ต่ออินพุตเข้าด้วยกัน = NOT, ฯลฯ
  • ทำให้โรงงานผลิต IC ชนิดเดียวก็พอ → ประหยัด
  • NAND and NOR are the "universal" gates
  • Using only NAND (or only NOR) you can build every other gate
  • e.g. a NAND with its inputs tied together = NOT, and so on
  • So a factory can make just one gate type → cheaper
📌 พีชคณิตบูลีน 📌 Boolean algebra

การลดรูปวงจรลอจิกใช้กฎพีชคณิตบูลีน เช่น กฎเดอมอร์แกน: A·B̅ = Ā + B̄ และ A+B̅ = Ā · B̄ — ช่วยแปลงระหว่าง AND/OR/NOT ได้

Logic circuits are simplified with Boolean algebra, e.g. De Morgan's laws: A·B̅ = Ā + B̄ and A+B̅ = Ā · B̄ — handy for converting between AND/OR/NOT.

IC ลอจิกและข้อควรระวังLogic ICs & Cautions
ICเกตGate
7408AND ×4
7432OR ×4
7404NOT ×6
7400NAND ×4
7486XOR ×4

ตระกูล 74xx = TTL, 74HCxx = CMOS เร็ว, 4000 = CMOS ดั้งเดิม

74xx = TTL, 74HCxx = fast CMOS, 4000 = classic CMOS

  • ระดับลอจิก: ดูจาก datasheet ว่าช่วงไหนคือ 0 และ 1 (ขึ้นกับ Vcc/ตระกูล)
  • ห้ามปล่อยอินพุตลอย โดยเฉพาะ CMOS — ต่อลง 0 หรือ 1 ให้แน่นอน
  • ใส่ ตัวเก็บประจุ decoupling 0.1 µF ใกล้ขาไฟทุกตัว
  • เอาต์พุตขับ LED ต้องมี ตัวต้านทานจำกัดกระแส
  • Logic levels: check the datasheet for the 0 and 1 ranges (depend on Vcc/family)
  • Never leave inputs floating, especially CMOS — tie them to a fixed 0 or 1
  • Add a 0.1 µF decoupling capacitor near every supply pin
  • Driving an LED from an output needs a current-limiting resistor
🔗 ลองนำลอจิกไปใช้คู่กับ 555 (เป็นสัญญาณนาฬิกาป้อนวงจรนับ) หรือทดลองวงจรจริงบน เบรดบอร์ด 🔗 Pair logic with the 555 (as a clock for counters) or build real circuits on the Breadboard.