ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer...

12
ECEN 248 ECEN 248 Lab 6: De-Bouncing, Lab 6: De-Bouncing, Counters & LCD Display Counters & LCD Display Control Control Dept. of Electrical and Dept. of Electrical and Computer Engineering Computer Engineering

Transcript of ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer...

Page 1: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

ECEN 248ECEN 248

Lab 6: De-Bouncing, Lab 6: De-Bouncing, Counters & LCD Display Counters & LCD Display

ControlControl

Dept. of Electrical and Dept. of Electrical and Computer EngineeringComputer Engineering

Page 2: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Lab 6 in BriefLab 6 in Brief

Design an eight bit counterDesign an eight bit counter Bouncing counterBouncing counter De-bouncing counterDe-bouncing counter

Learn about configuring the LCD displayLearn about configuring the LCD display

Page 3: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Sequential Logic

We are only handling the combinational logic circuits in the previous labs

Starting from Lab 5, we will deal with the sequential logic circuits

In sequential logic circuits, the output will depend on not only the current input, but also the previous inputs.

Always driven by clock pulses

Page 4: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Counter

Using sequential logic to count clock events

Page 5: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Push Buttons

A push button is a mechanical switch and rely on mechanical contact to generate an electrical pulses

Page 6: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Switch Bouncing

Push Release

When you push the button, it will not instantly give a 0 (or a 1 when inverted); instead, the voltage will fluctuate in a middle region at first. Voltages in the middle region are still interpreted (quantized) as 1’s and 0’s, so the output will “bounce” between 0 and 1 until the value settles. That means even you only push the button once, there will be multiple rising edges generated.

Page 7: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

De-Bouncing Need to get rid of the bounces and get the

“clean” signal Two methods

RS latch based debouncing Needs two buttons

Sampling based de-bouncing One button

Page 8: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Method 1: SR Latch• Use the SR latch to clean the

bouncing signal

S

R

Q

Bounci ng

De-bounced

Page 9: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Method 2: Sampling based debouncing

always @ (posedge clock)if (reset) begin new <= noisy; clean <= noisy; count <= 0; endelse if (noisy != new) begin new <= noisy; count <= 0; endelse if (count == 500000) clean <= new;else count <= count+1;

Page 10: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

LCD DisplayLCD Display•Two Verilog modules

•lcd_disp•Given in the zip file for lab 5•You can reuse this module

•Lcd_int •You need to design a specific lcd_int module for each lab•Determine data display location in LCD •One characters 8bit (check decoder chart Fig. 6.9)•Outputs 32 eight-bit sequences for 32 characters in LCD

Page 11: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

Lab 6 To-Do listLab 6 To-Do list Design 1Design 1

Configure LCD displayConfigure LCD display Design 2Design 2

Design a non-debounced counterDesign a non-debounced counter Design 3Design 3

Design a count-up counter and a count-down Design a count-up counter and a count-down counter using non-debounced signalcounter using non-debounced signal

Design 4Design 4 Design a SR-latch based debounced up-counterDesign a SR-latch based debounced up-counter

Design 5Design 5 Design a sampling-based debounced up-counterDesign a sampling-based debounced up-counter

Page 12: ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control Dept. of Electrical and Computer Engineering.

TodayToday Work on Lab 6Work on Lab 6

2 Weeks later2 Weeks later Lab 6 Post-Lab dueLab 6 Post-Lab due Lab 7 Pre-Lab due at the beginning of classLab 7 Pre-Lab due at the beginning of class

DeadlinesDeadlines