抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

Counters

A counter is a device to determine the number of elements of a finite set. The modulus of a counter is the number of the states that it can count.

As learned in Chapter 7, flip-flops (FF) can be connected to perform counting operations, and counters,according to the way the FFs are clocked, are classified into two broad categories:

  • Asynchronous counters(异步计数器)根据上一个 FF 的提示,选择改变自身的状态。
  • Synchronous counters(同步计数器)每一个时钟信号发出时,根据之前电路的状态,综合判断是否改变状态。

![image-20230328141351400](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328141351400.png)

Finite State Machine (有限状态机)

A state machine (有限状态机) is a sequential circuit that has a finite number of states occurring in a prescribed order.

E.g., a counter is a typical example of a state machine, and its number of states is the modulus.

image-20230421194311876

有限状态机的一般模式

image-20230329145907967

输入可以是 Enable,Load 等等,参见 74HC163。

**Analysis: ** Derive a behavior model for a given circuit.

  1. Excitation Equation (激励方程/驱动方程) U=f(I,Q)U=f(I,Q)
  2. Characteristic equation (特性方程):Qn+1=g(U,Qn+1)Q^{n+1}=g(U,Q^{n+1})
  3. Output Equation (输出方程) O=h(I,Q)O=h(I,Q)

Screenshot_20230421_195405_com.flexcil.flexcilnot

Design: Design a sequential circuit from a behavior model.

Analysis of Synchronous Sequential Circuits

J-K flip-flops

Qn+1=JQn+KQnQ^{n+1}=J\overline{Q^n}+\overline{K}Q^n

JJ KK QnQ^n Qn+1Q^{n+1}
0 0 0/1 QnQ^n
1 0 0/1 1
0 1 0/1 0
1 1 0/1 Qn\overline{Q^n}

image-20230421195052670

D flip-flops

Qn+1=DQ^{n+1}=D

S-R latches

Qn+1=S+RQn,SR=0Q^{n+1}=S+\overline{R}Q^n,SR=0

![image-20230420153553105](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230420153553105.png)

![image-20230420153725531](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230420153725531.png)

![image-20230421195525448](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421195525448.png)

Design of Synchronous Sequential Circuits

image-20230421195709043

Asynchronous Counters (异步计数器)

3-Bit Asynchronous Counters(三比特异步计数器)

![image-20230328141719059](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328141719059.png)

注意是正边沿触发,因此,检测的是 Q0\overline{Q_0} 等等。

![image-20230328142139514](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328142139514.png)

下降沿触发。两者的输出(经过时间平移之后)是一样的,但是中间的实现方式不同,需要注意都是用上升沿触发或者都是用下降沿触发。

image-20230328142159972

Toggle mode D FFs: connect Qˉ\bar Q to DD.

Propagation Delay

![image-20230328143114493](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328143114493.png)

If the edge-triggered J-K FFs have a a propagation delay of 10 ns, then, the maximum frequency of Clock

f_\max=1/T_\min=1/30 \mathrm{~ns}=33.3\mathrm{~MHz}

Asynchronous Decade Counters(异步十进制计数器)

An nn-bit counter can be designed to have a modulus less than 2n2^n, and the resulting sequence is called a truncated sequence. 如何进行截断?到达特殊状态清零即可。使用 JK 触发器的异步清零功能。

A decade counter involves a sequence of 0000 through 1001.

![image-20230328143733192](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328143733192.png)

只要 Q1=1Q_1=1Q3=1Q_3=1,就可以清零。这种方法称为部分编码。
![image-20230328144127083](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328144127083.png)

Glitch:毛刺,假信号。到达 10101010 状态时,清零信号还未传递,因此会出现 Glitch.

![image-20230328144503859](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328144503859.png)

需要检测第一个不合法的位置,例如,12-based counter 中 1-11 是合法状态,因此需要检测 12 这个状态,在这里,只要 Q3=Q2=1Q_3=Q_2=1 就可以判断是 12 这个状态,然后复位也是只用复位这两位。

74LS93A

74LS93A is an example of an IC asynchronous counter. It has one independent toggle J-K FF driven by CLK A, and three toggle J-K FFs that form a 3-bit asynchronous counter driven by CLK B.

注意 Q0Q_0BB 相连接。

![image-20230328145807626](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328145807626.png)

![image-20230328150455368](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328150455368.png)

异步清零 需要 RO(1),RO(2)RO(1),RO(2) 同时等于 HIGH. 检测状态 10101010.

Synchronous Counters (同步计数器)

In a synchronous counter, all flip-flops are clocked together with a common clock pulse.

Synchronous counters overcome the disadvantage of accumulated propagation delays of the asynchronous ones, but generally they require more circuitry to control state changes.

在同步计数器中,所有的触发器都是用一个共同的时钟脉冲进行时钟连接。

同步计数器克服了异步计数器的累积传播延迟的缺点,但通常它们需要更多的电路来控制状态变化。

2 Bit Synchronous Counter

![image-20230328151017306](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328151017306.png)

![image-20230328151525050](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328151525050.png)

3-Bit Synchronous Binary Counters

![image-20230421173551420](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421173551420.png)

image-20230328151805644

image-20230328152001888

4 bit Synchronous Counter

![image-20230328151839140](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328151839140.png)

模拟进位

![image-20230328204938210](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328204938210.png)

![image-20230328204948036](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328204948036.png)

按照常理,10011001 下一个应该是 10101010,这里要把他变为 00000000,因此我们第一需要添加特判 Q0Q3Q_0Q_3,这时对第三位进行翻转操作,而且当 Q3=1,Q0=1Q_3=1,Q_0=1 时不能翻转 Q1Q_1,因此又需要一个特判。

74HC163

74HC163: 4-bit synchronous binary counter. Features:

  • Data inputs
  • ENT/ENP to enable
  • CLR\overline{CLR} synchronous clear.
  • LOAD\overline{LOAD} synchronous set.

![image-20230328205511616](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328205511616.png)

![image-20230328211357892](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230328211357892.png)

image-20230329151616995

Inhibit:禁止工作,当 ENP,ENTENP,ENT 里面有一个是 0 时。输出状态保持不变。

image-20230420153209008

注意:只有当时钟信号上升时,才会触发数据输出的状态改变。 如果要串联计数器,需要将 RCO 连到下一个计数器的 CLK 信号上,并且让 RCO 与 CLR 连接,以便于清零。

E.g., use 74HC163 to realize a counter with a modulus of 12.

![image-20230421174443669](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421174443669.png)

![image-20230421174559027](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421174559027.png)

74HC160

Synchronous BCD decade counter.

![image-20230421174640661](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421174640661.png)

同步置数:跟着时钟信号,异步清零,只要 CLR=0\overline{CLR}=0 就代表立马清零。

![image-20230421193452730](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421193452730.png)

加/减同步计数器 Up/Down Synchronous Counters

image-20230331142816945

Conditions for flip-flop toggling in the up and down counters.

image-20230401144750559

注意观察 UP/DOWNUP/\overline{DOWN} 的表达,DOWN=UPDOWN=\overline{UP}

74HC190/74HC191

image-20230401145153682

MAX/MIN 常常用于级联计数器,若 D/U=0D/\overline{U}=0,代表 Up,99 进位,若 D/U=0D/\overline{U}=0,代表 Down,00 借位。

Design of Synchronous Counters(同步计数器设计)

![image-20230407151934824](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230407151934824.png)

Design of Synchronous Sequential Circuits

  1. State Diagram

  2. Next-state Table ((In,Qn)Qn+1)((I^n,Q^n) \rightarrow Q^{n+1})

  3. Transition Table of FFs ((Qn,Qn+1)U)((Q^n,Q^{n+1})\rightarrow U)

  4. Karnaugh Maps ((I,Q)U)((I,Q)\rightarrow U)

  5. Logic Expression for U=f(I,Q)U=f(I,Q)

  6. Implementation

Example: Design a 3-bit Gray code counter

(1). State Diagram

![](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421200126786.png)

(2). Next-state table ((In,Qn)Qn+1)\boldsymbol {((I^n,Q^n)\to Q^{n+1})}

![image-20230421200217925](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421200217925.png)

(3). Transition Table of a J-K FF

![image-20230331151142346](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230331151142346.png)

相反的,枚举所有可能的输入。

(4) Karnaugh Maps

![image-20230421200548665](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421200548665.png)

(5). Logic expression for U=f(I,Q)\boldsymbol {U=f(I,Q)}

![image-20230421200653600](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421200653600.png)

(6). Implementation

Implement the expressions with combinational logic, and combine with the flip-flops to create the counter.

Example: Design a counter with the binary count sequence shown in the state diagram. Use D flip-flops.

7.Analyze the design

是否能够自启动

![image-20230421202907206](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230421202907206.png)

Example Design a 3 bit up/down counter with Gray code Sequence.

An Example with Auto Start (Re-) Design

数字控制装置中常用的步进电动机有 A, B, C三个绕组. 电动机运行时要求三个绕组以 A → AB → B → BC → C → CA → A的顺序循环通电. 试设计一个电路实现之。

本任务所需计数器模数为6, 所以触发器的个数应(至少)为3. 我们选用3个J-K触发器.

用三个触发器的输出端 QA,QB,QCQ_A,Q_B,Q_C 分别控制电动机的三个绕组A, B, C, 并以“1”表示通电, “0”表示不通电。以为 QCQBQAQ_CQ_BQ_A序排列:

![image-20230404140812259](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404140812259.png)

![image-20230404141059043](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404141059043.png)

![image-20230404141104920](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404141104920.png)

无关状态以红色表示。

image-20230404141529885

需要让无效的状态到有效的状态。

![image-20230404141750539](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404141750539.png)

强制设为 1.

image-20230404141859052 image-20230404142239961

1111 -> 0010

能不能自启动,需要每一个状态都能走入循环。

Cascaded Counters (级联计数器)

Counter cascading means that the last-stage output of one counter drives the input of the next counter, which can be used to achieve higher-modulus operation.

Asynchronous cascading: The output of a lower-order counter is properly connected to the clock of the next higher-order counter.

![image-20230404143835201](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404143835201.png)

上升沿触发的。

![image-20230404144127756](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404144127756.png)

Asynchronous cascading has high latencies.

Synchronous cascading: The terminal count (e.g., TC, RCO) of a counter is properly connected to the enable (e.g., EN, CTEN) of the next higher-order counter. (All counters have the same clock input.)

![image-20230404144243493](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404144243493.png)

![image-20230404144459162](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404144459162.png)

利用延迟,就可以检测到 TC,发现了前面的计数器已经走过了一个循环。

![image-20230404145910197](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404145910197.png)

需要全部接上。

E.g., the following shows two 74HC190 (up/down decade counter) connected in the UP mode as a cascaded counter with modulus 100.

![image-20230404150657256](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404150657256.png)

Example Determine the frequency of Q0,Q2,Q3Q_0,Q_2,Q_3 for the two 74HC190 in Page 7.

Q3Q_3 Q2Q_2 Q1Q_1 Q0Q_0
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1

fQ0=fin2fQ1=fin5fQ2=fin10fQ3=fin10f_{Q_0}=\frac{f_{\mathrm{in}}}{2}\\ f_{Q_1}=\frac{f_{\mathrm{in}}}{5}\\ f_{Q_2}=\frac{f_{\mathrm{in}}}{10}\\ f_{Q_3}=\frac{f_{\mathrm{in}}}{10}

Cascaded Counters with Truncated Sequences

The previous cascading leads to full-modulus cascading, i.e., the overall modulus is equal to the product of the individual modulus.

A truncated sequence with cascaded counters can be implemented:

![image-20230404152053774](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404152053774.png)

![image-20230404152344790](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404152344790.png)

跳过 0255350\sim 25535 的数。

Counter Decoding (计数器译码)

Counter decoding involves using decoders or logic gates to determine when the counter is in a certain binary state in its sequence.

![image-20230404153051076](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404153051076.png)

Propagation delays of counters (in particular asynchronous) can produce undesirable glitches (毛刺) on the decoding output.

![image-20230404153444821](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404153444821.png)

One way to eliminate the glitches is strobing (选通), which enables the decoded outputs at time after the glitches have a time to disappear.

若 CLK=HIGH,则忽略,有效电平出现的会晚一些。

![image-20230404153817993](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404153817993.png)

Counter Applications (计数器应用)

A Digital Clock.

![image-20230404153803450](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230404153803450.png)

![image-20230405095806593](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230405095806593.png)

Parallel-to-Serial Conversion

![image-20230407143145804](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230407143145804.png)

![image-20230407143211346](C:\Users\Steven Meng\AppData\Roaming\Typora\typora-user-images\image-20230407143211346.png)

image-20230420155939466

评论