• Keine Ergebnisse gefunden

1 Examination of the bouncing of a switch with the logic analyzer

N/A
N/A
Protected

Academic year: 2021

Aktie "1 Examination of the bouncing of a switch with the logic analyzer"

Copied!
3
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Lecture 3: Asynchronous Input Signals

G. Kemnitz , TU Clausthal, Institute of Computer Science May 8, 2012

Asynchronous input signals, at the test board the signals from the switches and buttons, has to be sampled before internal processing with a clock period larger than the de-bouncing time (see [1], section 1.5). The following exercises introduce step by step the design of a sequential circuit with asynchronous inputs from switches and buttons.

1 Examination of the bouncing of a switch with the logic analyzer

Program the FPGA so that the switch input

SW0

on the test board is connected via the FPGA with LED

LD0

and pin 5 of expansion connector

A2

(LOC D5) (figure 1 a). Connect the logic analyzer as shown in figure 1 b and record the waveform during turning the switch on several times (Settings for the logic analyzer: 1.500.000 samples per second, trigger on first rising edge of the signal). How long is the maximum observed bouncing time? By which power of two the 50 MHz clock should be divided to sample the switching signal?

0 cable color

LA connection

V

CC0

V

U

D5 D6 E7 D7 D8 D10 B4 B5

E6 C5 C6 C7 C8 C9 A3 A4 A5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 . . . . . .

D5 K12 FPGA

LD0

SW7 LA input 0

bottom b) top a) library ieee ; K13

use ieee.std logic 1164.all;

entity Draht is

Port (x : in std logic ; y, led : out std logic );

end entity;

architecture a of Draht is begin

y <= x;

led <= x;

end architecture;

Figure 1: a) Circuit for exercise 1 b) Connection of the logic analyzer to the expansion connector

A2

(Draht – engl. wire)

2 Counting the signal edges during bouncing

For this experiment the sequential circuit in figure 2 a has to be described in VHDL and pro- grammed in the FPGA. The switching signal is sampled by a shift register of length two. If both values differ the counter state is increased by one. The counter state is displayed on the LEDs.

Tel. 05323/727116

1

(2)

The circuit description consists of a sample process with the clock in the sensitivity list, in which with every rising edge the input signal is assigned to the first shift register bit

SW7 del

and the first shift register bit is assigned to the second shift register bit

SW7 del2. The ”+”-operation is overloaded in the package

ieee.std logic unsigned

, provided by

ISE

. The clock

Clk

is the 50 MHz input clock.

=1 0 +1 1

K12 LD0 P14 L12 N14 P13 N12 P12 P11

LD1 LD2 LD3 LD4 LD5 LD6 LD7 SW7 K13

Clk library ieee ;

use ieee.std logic 1164.all;

use ieee.std logic unsigned .all;

entity Test Ct is

port (Clk, SW7: in std logic ;

LD : out std logic vector(7 downto 0));

end entity;

architecture a of Test Ct is

signal SW7 del, SW7 del2: std logic ; signal s: std logic vector (7 downto 0);

begin

process (Clk) begin

if rising edge (Clk) then SW7 del <= SW7;

SW7 del2 <= SW7 del;

if SW7 del /= SW7 del2 then

s <= s + 1;

end if;

end if;

end process;

LD <= s;

end architecture;

Abbildung 2: a) Circuit for the second exercise b) VHDL program

3 Clock divider

How many bits must have a clock divider to produce approximately a one Hertz clock? Describe a 24 Bit clock divider by using the template for a counter in the previous exercise. The highest eight bits should be connected to the LEDs on the test board and the 16 lower bits to the expansion connector A2 to which the logic analyzer is connected (figure 3).

• Check by observing the LEDs that the right bit position is selected for the one Hertz clock.

• Let the logic analyzer record the counter values starting from 0xa3. For this an appropriate xml-file has to be written.

4 Light effect circuit

Design a self-defined light effect circuit with switches as inputs and LEDs as outputs. The sample process should use the clock frequency determined in exercice 1 and the process to calculate the next state and the LED output with approximately 1 Hertz. An appropriate function would be circular moving light point that changes moving direction by turning a switch on, e.g. to forward by turning on

SW0

and backward by turning on

SW1

. The circuit should react on each turn on, even if the switch already has been turned off before the next rising edge of the 1 Hertz clock.

2

(3)

1

2 0

3 4 5 6 7 expansion connector A2

cable color LA connector

V

CC0

V

U

Clk T9

D5 D6 E7 D7

D8 D10

B4 B5 LA0

LA1 LA2 LA3

LA4 LA5 LA6 LA7

0 1 2 3

4 5 6 7

D5 D6 E7 D7 D8 D10 B4 B5

E6 C5 C6 C7 C8 C9 A3 A4 A5

24

+1

24

K12 LD0 P14 L12 N14

LD1 LD2 LD3

P13 N12 P12 P11

LD4 LD5 LD6 LD7

17 18 19 16

23 22 21 20

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 . . . . . . top

bottom

Figure 3: Clock divider

5 Check list for the compliance test

to section 1:

• a screen shoot of the waveform of the logic analyzer

• the estimated value of the maximum bouncing time

• a reasonable estimation of the sample frequency for de-bouncing to section 2:

• the experimental determined maximum bouncing count per switching activity to section 3:

• the counter index of the 1 Hertz clock

• a screen shoot of the recording of the logic analyzer to section 4:

• a presentation of the light effect circuit

References

[1] G. Kemnitz. Technische Informatik Band 2: Entwurf digitaler Schaltungen. Springer, 2011.

3

Abbildung

Figure 1: a) Circuit for exercise 1 b) Connection of the logic analyzer to the expansion connector
Abbildung 2: a) Circuit for the second exercise b) VHDL program
Figure 3: Clock divider

Referenzen

ÄHNLICHE DOKUMENTE

This research is aimed at acquiring an understanding of how and why the sustainable logic gets activated in an organisation. In order to address this research

samples of animals. To reduce the experimental doses, and thus the unreliability of extrapolations outside the experimental range, one could think of conducting experiments

Overall, this means that NATO policy toward Syria should not aim at prioritizing a humani- tarian purpose – which remains the concern of the UN, not NATO – or

Hempel then showed that (1-4) entail that every sentence (observation report) E confirms every sentence (theory) H, i.e. Since Hempel's negative result, there has hardly

Right And Cut As simple confirmatory consequence relations violate Left Logical Equivalence, Verification, and Right Reflexivity, they are no inductive consequence relations

In this paper we have refined the semantics of the event order logic and have shown how EOL formulas can be transformed into semantically equivalent EOL formulas. Furthermore, we

But then, when discussing the Converse Consequence Condition, Hempel also felt the need for a second concept of confirmation aiming at informative theories.. Given that it was

number of years after maturation increased, the frequency of skipped spawning in the early- 179.. maturing population (scenario 3) stabilised quickly at the expected level