EL-58PemulaLitar flip-flop

Flip-flop D: memori 1 bit dengan 74HC74

Bina sendiri bahagian terkecil memori komputer. Flip-flop D di dalam 74HC74 mengambil nilai pada input D sebaik sahaja denyut jam tiba dan menyimpannya sehingga denyut seterusnya. Kamu memberikan data dengan butang dan denyut jam dengan suis gelongsor; LED merah menunjukkan apa yang ada di dalam memori. Kamu melihat konsep sisi naik dengan mata sendiri.

0.0(0)
1 selesai
Flip-flop D: memori 1 bit dengan 74HC74
Ia dibina dengan bekalan 5 V, satu 74HC74, satu butang, satu suis gelongsor, lima perintang dan dua LED. Butang S1 ialah input D. Flip-flop kedua dalam IC membersihkan lantunan suis gelongsor dan menghasilkan denyut jam yang benar-benar bersih. LED merah menunjukkan output Q, dan LED hijau menunjukkan songsangannya. Yang kamu pelajari: flip-flop D, isyarat jam, pencetusan sisi naik, menyimpan data, lantunan suis dan mengapa input CMOS tidak pernah dibiarkan terapung.

Video

Gambar Rajah Litar

Flip-flop D: memori 1 bit dengan 74HC74 - Gambar Rajah Litar

Susun Atur Breadboard

Flip-flop D: memori 1 bit dengan 74HC74 - Susun Atur Breadboard

Langkah Pemasangan

  1. 1

    Plug the MB102 power module onto the end of the breadboard and set both jumper caps to the 5 V position. Leave the module's switch off for now.

  2. 2

    Place the 74HC74 (U1) over the center gap with its notch facing left. The bottom left corner is pin 1; the bottom row runs from 1 to 7 from left to right, and the top row runs from 8 to 14 from right to left.

  3. 3

    Connect pin 14 to the + rail with a jumper wire and pin 7 to the GND (−) rail with a jumper wire.

  4. 4

    Connect pin 4 and pin 1 to the + rail with one jumper wire each. These are the set and reset inputs of the first flip-flop; while they are in the + rail they are disabled.

  5. 5

    Connect pin 12 and pin 11 to the GND rail with one jumper wire each.

  6. 6

    Connect pin 9 to pin 3 with a jumper wire. The clock pulse travels through this wire.

  7. 7

    Plug in the slide switch (SW1) so that its three legs sit in three separate rows. Connect its middle leg to the GND rail with a jumper wire.

  8. 8

    Connect one outer leg of SW1 to pin 10 with a jumper wire. Fit R3 (10 kΩ) between pin 10 and the + rail. Let's call this side of the switch the 1 position.

  9. 9

    Connect the other outer leg of SW1 to pin 13 with a jumper wire. Fit R4 (10 kΩ) between pin 13 and the + rail. This side is the 0 position.

  10. 10

    Fit R1 (10 kΩ) between pin 2 and the GND rail.

  11. 11

    Place the S1 button over the center gap; connect the leg at one corner to the + rail with a jumper wire and the leg at the diagonally opposite corner to pin 2.

  12. 12

    Fit R2 (1 kΩ): one end into the row of pin 5, the other end into an empty row.

  13. 13

    Fit LED1 (red): long leg (anode) into the row of R2's free end, short leg (cathode) into the GND rail.

  14. 14

    Fit R5 (1 kΩ): one end into the row of pin 6, the other end into an empty row.

  15. 15

    Fit LED2 (green): long leg (anode) into the row of R5's free end, short leg (cathode) into the GND rail. Pin 8 stays unconnected.

  16. 16

    Compare the connections with the schematic, move SW1 to the 0 position, then switch on the power module.

Petua: biarkan bateri atau bekalan kuasa tidak disambung semasa membuat pendawaian.

Langkah Ujian

  1. 1

    Switch on the power module: only one of the LEDs must light. Which one lights at power-on is not predictable.

  2. 2

    Hold S1 down and slide SW1 to the 1 position: the red LED must light and the green one must go out. The memory has written a 1.

  3. 3

    Release S1 and move SW1 back to the 0 position: nothing must change. The memory is keeping the 1.

  4. 4

    Without pressing S1, slide SW1 to the 1 position again: red goes out, green lights. This time the memory has written a 0.

  5. 5

    Without touching SW1, press and release S1 a few times: the LEDs must not change. Without a clock pulse the D input is not read.

Cara Ia Berfungsi

The D flip-flop of the 74HC74 copies the value on D to Q the moment the clock input rises from 0 to 1 and keeps it until the next pulse. S1 gives the data, SW1 the clock pulse.

The D input and the clock

The D flip-flop has two important inputs: D, the data to be stored, and the clock (CLK), which says when to store it. The flip-flop does not watch D all the time; it looks once, only when a clock pulse arrives, and puts the value it sees on the Q output.

Rising edge

The 74HC74 looks at the D input the moment the clock signal rises from 0 to 1. This moment is called the rising edge. While the clock sits at 1 or falls to 0, change D as much as you like; Q does not budge. It is like the shutter of a camera: only the picture at the moment you press remains.

Q and Q̄

Pin 5 (Q) gives the stored bit and pin 6 (Q̄) gives its inverse. Because the red LED is connected to Q and the green LED to Q̄, red lights while there is a 1 in the memory and green while there is a 0. The two LEDs never light at the same time.

A clean clock pulse

The set (pin 10) and reset (pin 13) inputs of the second flip-flop in the IC are active at 0. Because SW1 connects its middle terminal to GND, whichever side the switch touches, that input acts: in the 1 position pin 9 is high, in the 0 position it is low. Even if the switch bounces, the output settles at the first touch and produces a single clean edge.

The set and reset pins

The pin 4 (set) and pin 1 (reset) inputs of the first flip-flop can set Q directly to 1 or 0 without waiting for the clock. In this circuit we disabled both by connecting them to the + rail; this way Q changes only on the clock edge.

Jadual Kebenaran

Clock (SW1)D (S1)Q (red)Q̄ (green)
0 to 1001
0 to 1110
Holding at 0 or 1Don't carePrevious statePrevious state
1 to 0Don't carePrevious statePrevious state

While S1 is pressed, D = 1. Q is updated only as the clock rises from 0 to 1.

Formula

  • D flip-flop rule

    On the rising edge: Q(new) = D

    Contoh: If the clock rises from 0 to 1 while D = 1, Q becomes 1 and Q̄ becomes 0

  • Memory capacity

    Number of states = 2^n (n: number of flip-flops)

    Contoh: 1 flip-flop stores 2^1 = 2 states; 8 flip-flops side by side make 2^8 = 256 states, that is, 1 byte

  • LED current

    I = (Vout − VLED) / R2

    Contoh: (5 V − 2 V) / 1 kΩ = 3 mA; below the 4 mA that is the safe limit for a 74HC output

Kesilapan Lazim

  • Nothing happens when I slide the switch.

    The jumper wire between pin 9 and pin 3 is missing, or the middle leg of SW1 is not at GND.

  • The LED does not change right away when I press S1.

    This is not a fault, it is the circuit itself. The D input is read only at the moment SW1 is slid to the 1 position.

  • The LEDs change at random.

    R1 is not pulling pin 2 to GND, or one of pins 1, 4, 11, 12 has been left floating.

  • The IC heats up.

    Switch off the power at once. The IC may be fitted backwards, or a voltage higher than 5 V may have been applied.

Soalan Lazim

Mengapakah saya memberikan denyut jam dengan suis gelongsor dan bukan dengan butang?

Sesentuh logam di dalam butang melantun beberapa kali semasa kamu menekan dan menghasilkan berpuluh-puluh denyut dalam satu tekanan. Flip-flop mengira setiap satu sebagai denyut jam yang berasingan. Suis gelongsor, bersama flip-flop kedua dalam IC, menelan lantunan ini dan memberikan satu denyut bersih setiap kali kamu menggelongsorkannya.

Apakah maksud sisi naik?

Ia ialah saat isyarat jam berubah dari 0 ke 1. 74HC74 hanya melihat input D pada saat ini. Semasa jam kekal pada 1, kekal pada 0 atau jatuh dari 1 ke 0, output tidak berubah walau apa pun nilai D. Berkat ini, semua memori dalam litar dikemas kini pada saat yang sama.

Adakah memori terpadam apabila saya mematikan kuasa?

Ya. Flip-flop menyimpan maklumatnya hanya semasa bekalan ada; apabila kamu memutuskan kuasa dan menghidupkannya semula, ia bangun dalam keadaan rawak. RAM dalam komputer berfungsi dengan cara yang sama. Untuk storan kekal, jenis memori lain seperti flash atau EEPROM digunakan.

Apakah kegunaan flip-flop kedua dalam IC?

Ada dua flip-flop D yang bebas di dalam 74HC74. Yang pertama berfungsi sebagai memori. Kita menyambungkan pin set dan set semula yang kedua ke suis gelongsor dan menggunakannya sebagai penyahlantun. Dengan cara ini, kita mendapat isyarat jam yang bersih tanpa membeli IC tambahan.