Aula 26 - Contadores Prof. Renan Sebem Disciplina de eletrônica digital Departemanto de engenharia elétrica Centro de Ciências Tecnológicas (CCT) Universidade Do Estado de Santa Catarina (UDESC) Joinville-SC Brasil 02 de julho de 2016 ELD0001 Prof. Renan Sebem Aula 26 1 / 21
Itens da aula Avisos Contadores Contadores síncronos Contadores Assíncronos Divisores de frequência Exercício Referências ELD0001 Prof. Renan Sebem Aula 26 2 / 21
Avisos Avisos Lab. da semana que vem está disponível na página do professor. ELD0001 Prof. Renan Sebem Aula 26 3 / 21
Contadores Definições Estado; Módulo; Contador assíncrono; Contador síncrono; Sequência de contagem. ELD0001 Prof. Renan Sebem Aula 26 4 / 21
Contadores síncronos Caso 1 - Contadores de módulo 2 N síncronos com FFT 356 CHAPTER 14 Sequential Circuits FIGURE 14.3. Synchronous modulo-2 N counters with (a) parallel enable and (b) serial enable. All flip-flops are positive-edge TFFs, where t is a toggle-enable port (Figure 13.24(b)). A partial timing diagram is shown in (c). A partial timing diagram is shown in Figure 14.3(c). It depicts the behavior of the first three stages in Figure 14.3(a), which produce the vector q 2 q 1 qeld0001 0, thus counting Prof. from Renan 0 ("000") Sebem to 7 ("111"). Aula 26Looking at the 5 / 21
Contadores síncronos Caso 1 - Contadores de módulo 2 N síncronos com FFT 14.2 Synchronous Counters FIGURE 14.4. Generation of toggle-enable signals. the first column contains the desired output values (a binary counter). Inspecting that col verify that each output (q 0, q 1,...) must change its value if and only if all preceding ou high. Therefore, because we must produce t = '1' for the TFF to toggle, ANDing the outp preceding stages is the proper solution. This was highlighted with rectangles in the q 2 colu that q 2 changes only when q 1 and q 0 are both '1'), but it can be verified also in the other col the particular case of q 0, because we want it to change at every clock edge (of the proper p t 0 must be permanently '1'. The resulting toggle-enable signals are depicted in the third co Figure 14.4. ELD0001 Prof. Renan Sebem Aula 26 6 / 21
Contadores síncronos Caso 1 - Contadores de módulo 2 N síncronos com FFJK J S Bit #3 S S S 3 J 2 J 1 1 J 0 MSB Bit #2 Bit #1 Bit #0 K K K 1 K R R R R reset clock OBS: Erro, o bit 0 é o LSB. ELD0001 Prof. Renan Sebem Aula 26 7 / 21
Contadores síncronos Caso 2 - Contadores de módulo 2 N síncronos com FFD 358 Exemplo: CHAPTER 14 Projete Sequential Circuits um contador síncrono de 0 até 9 com FFD. FIGURE 14.5. Synchronous modulo-2 N counters implemented using regular DFFs instead of TFFs: (a) With parallel enable; (b) With serial enable (the portions within dark boxes implement TFFs); (c) Generation of the DFF inputs (d 0, d 1,...). ELD0001 Prof. Renan Sebem Aula 26 8 / 21
The advantage of this architecture is its versatility. The same circuit can be used for any value of M. Contadores síncronos This is illustrated in Figure 14.9(b), which shows a 0-to-y counter, where y = y 3 y 2 y 1 y 0 is the minterm corresponding to the desired final value (for example, y 3 y 2 y 1 y 0 = q 3 q 2 q 1 q 0 when the final value is y = "1001" = 9). Caso 3 - Contadores de módulo M síncronos com FFT FIGURE 14.9. (a) Synchronous 0-to-9 counter using TFFs with clear (Example 14.2); (b) Programmable version (0-to-y counter), where y 3 y 2 y 1 y 0 is the minterm corresponding to the desired final value (for example, if y = 9 = "1001", then y 3 y 2 y 1 y 0 = q 3 q 2 q 1 q 0 ). ELD0001 Prof. Renan Sebem Aula 26 9 / 21
Contadores síncronos Caso 5 - Contadores com início diferente de 0 Exemplo: Projete um contador com início em 3 e final 9. ELD0001 Prof. Renan Sebem Aula 26 10 / 21
Contadores síncronos Contador síncrono com sequência arbitrária Exemplo - Projete um contador síncrono com a seguinte sequência: transições CK 3 2 1 0 0 0 0 0 0 1 0 0 0 1 14 1 1 1 0 9 1 0 0 1 12 1 1 0 0 2 0 0 1 0 7 0 1 1 1 5 0 1 0 1 ELD0001 Prof. Renan Sebem Aula 26 11 / 21
Contadores Assíncronos Caso 1 - Contador assíncrono crescente modulo 2 N 370 CHAPTER 14 Sequential Circuits FIGURE 14.16. Asynchronous modulo-2 N upward counters constructed with (a) and (b) TFFs or (c) and (d) DFFs. q 2, and so on. Therefore, there is no risk of accidentally resetting the flip-flops during state transitions. ELD0001 Prof. Renan Sebem Aula 26 12 / 21
Contadores Assíncronos Caso 1 - Contador assíncrono decrescente modulo 2 N 14.3 Asynchronous Counters 369 ELD0001 Prof. Renan Sebem Aula 26 13 / 21
Contadores Assíncronos Caso 1 - Contador assíncrono reversível Utiliza-se um multiplexador para escolher se é crescente ou decrescente: 0 1 2 3 MSB S S S S clock 1 1 J Bit #0 K A0 Y mux A1 S0 1 1 J Bit #1 K A0 Y mux A1 S0 1 1 J Bit #2 K A0 Y mux A1 S0 1 1 J Bit #3 K R R R R reset up/down ELD0001 Prof. Renan Sebem Aula 26 14 / 21
Contadores Assíncronos 14.4 Signal Generators 371 Caso 2 - Assíncrono com módulo M (= 6) is reached, causing the counter to return to zero. The corresponding timing diagram is included in Figure 14.17. As can be observed, this approach, though simple, does exhibit a brief glitch when the output value is 6 (the glitch occurs in q 1 ). The time delays are depicted in the inset, where the vertical lines are 1 ns apart (it takes 4 ns for the glitch to occur and it lasts 2 ns). Exemplo: Contador de 0 a 5. FIGURE 14.17. Asynchronous 0-to-5 counter of Example 14.7. 14.4 Signal Generators This section describes the generation of irregular square waves, which constitutes a typical application for counters. By definition, a signal generator is a circuit that takes the clock as its main input and from it produces a predefined glitch-free signal at the output. The design technique described here ELD0001 is a simplified Prof. Renan procedure. Sebem In Chapter Aula 2615, a formal design 15 / 21
Divisores de frequência Exemplo do relógio O ponteiro de segundo tem o período de 1s; O ponteiro de minuto tem o período de 60s; O ponteiro de segundo varia com a frequência de uma vez por segundo; O ponteiro de minuto varia com a frequência de uma vez por 60 segundos; Ou seja, o ponteiro de minuto "conta"até sessenta segundos. ELD0001 Prof. Renan Sebem Aula 26 16 / 21
Divisores de frequência Caso 1 -Divisor de frequência por 2 n Observe que cada coluna à esquerda demora o dobro do número de transições no clock: transições CK 3 2 1 0 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 10 1 0 1 0 11 1 0 1 1 12 1 1 0 0 13 1 1 0 1 14 1 1 1 0 15 1 1 1 1 ELD0001 Prof. Renan Sebem Aula 26 17 / 21
Divisores de frequência Caso 2 - Divisão por M com fase assimétrica 14.5 Frequency Dividers 375 FIGURE 14.21. Timing diagram for binary (a) 0-to-4 (M = 5) and (b) 0-to-5 (M = 6) counters. FIGURE 14.22. Timing diagram for a divide-by-9 with symmetric phase. based on the timing diagram of Figure 14.22, where M = 9. Note that the desired signal (q) has transitions at both clock edges, so this is a dual-edge signal generator. One way of obtaining q is by first generating the signal called q a, which stays low during (M 1)/2 clock cycles and high during (M + 1)/2 clock ELD0001 periods. A copy Prof. of Renan this signal, Sebem called qaula b, is 26 then created, which is 18 / 21
Exercício Exercício - Projeto através de máquinas de estados finitos Uma loja deseja ter controle de quantas pessoas estão dentro da loja a fim de melhorar seu atendimento e sua segurança. A loja possui uma porta de entrada e uma porta de saída, cada uma equipada com um sensor de presença. Considere que a cada transição positiva do sinal do sensor da porta de entrada deve-se incrementar o número de pessoas na contagem, e a cada transição positiva no sensor da porta de saída deve-se decrementar o número de pessoas na contagem. A frequência de entrada/ saída de pessoas na loja é menor que 1 Hz. Deseja-se contar até 7 pessoas. 1. Determine qual o tipo de contador a ser utilizado, o seu módulo e a sequência de contagem; 2. Faça a lógica combinacional para as portas de entrada e saída; 3. Desenhe o circuito; 4. Crie a tabela verdade. ELD0001 Prof. Renan Sebem Aula 26 19 / 21
Referências [1] Mairton de Oliveira Melo. Eletrônica Digital Teoria e Laboratório. Editora Udesc, 2002. [2] Volnei Pedroni. Digital electronics and design with VHDL. Morgan Kaufmann, 2008. ELD0001 Prof. Renan Sebem Aula 26 20 / 21
Aula 26 - Contadores Prof. Renan Sebem Disciplina de eletrônica digital Departemanto de engenharia elétrica Centro de Ciências Tecnológicas (CCT) Universidade Do Estado de Santa Catarina (UDESC) Joinville-SC Brasil 02 de julho de 2016 Obrigado. ELD0001 Prof. Renan Sebem Aula 26 21 / 21